Skip to content
Snippets Groups Projects
Commit a0be668af07a authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

fix comment's form handling: don't put comments relation in hidden section,...

fix comment's form handling: don't put comments relation in hidden section, simply use an HiddenInput. Also fix new comment detection
parent 68cdbd97a6d3
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,5 @@ ...@@ -28,6 +28,5 @@
from cubicweb.web.views import primary, baseviews, xmlrss, basecontrollers, treeview from cubicweb.web.views import primary, baseviews, xmlrss, basecontrollers, treeview
_afs = uicfg.autoform_section _afs = uicfg.autoform_section
_afs.tag_subject_of(('*', 'comments', '*'), formtype='main', section='hidden')
_afs.tag_object_of(('*', 'comments', '*'), formtype='main', section='hidden') _afs.tag_object_of(('*', 'comments', '*'), formtype='main', section='hidden')
...@@ -32,5 +31,8 @@ ...@@ -32,5 +31,8 @@
_afs.tag_object_of(('*', 'comments', '*'), formtype='main', section='hidden') _afs.tag_object_of(('*', 'comments', '*'), formtype='main', section='hidden')
_affk = uicfg.autoform_field_kwargs
_affk.tag_subject_of(('*', 'comments', '*'), {'widget': fw.HiddenInput})
_abaa = uicfg.actionbox_appearsin_addmenu _abaa = uicfg.actionbox_appearsin_addmenu
_abaa.tag_subject_of(('*', 'comments', '*'), False) _abaa.tag_subject_of(('*', 'comments', '*'), False)
_abaa.tag_object_of(('*', 'comments', '*'), False) _abaa.tag_object_of(('*', 'comments', '*'), False)
...@@ -219,6 +221,9 @@ ...@@ -219,6 +221,9 @@
self._cw.add_js(('cubicweb.edition.js', 'cubes.comment.js')) self._cw.add_js(('cubicweb.edition.js', 'cubes.comment.js'))
if newcomment is None: if newcomment is None:
newcomment = commented newcomment = commented
formvalues = {'comments': commented.eid}
else:
formvalues = {}
if self._cw.cnx.anonymous_connection: if self._cw.cnx.anonymous_connection:
self.propose_to_login() self.propose_to_login()
# hack to avoid tabindex conflicts caused by Ajax requests # hack to avoid tabindex conflicts caused by Ajax requests
...@@ -242,12 +247,6 @@ ...@@ -242,12 +247,6 @@
domid='commentForm%s' % commented.eid, domid='commentForm%s' % commented.eid,
form_buttons=buttons) form_buttons=buttons)
cform = form cform = form
if newcomment is not None:
cform.append_field(cform.field_by_name('comments', 'subject',
eschema=newcomment.e_schema))
formvalues = {'comments': commented.eid}
else:
formvalues = {}
self.w(u'<div id="comment%sSlot">%s</div>' % ( self.w(u'<div id="comment%sSlot">%s</div>' % (
commented.eid, form.render(formvalues={'comments': commented.eid}, commented.eid, form.render(formvalues={'comments': commented.eid},
main_form_title=u'', main_form_title=u'',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment