# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1277134583 -7200 # Mon Jun 21 17:36:23 2010 +0200 # Node ID a0be668af07af906f4b3d11ca7b7eb2a66379f26 # Parent 68cdbd97a6d36520638af92e9044e6cb5b4c5546 fix comment's form handling: don't put comments relation in hidden section, simply use an HiddenInput. Also fix new comment detection diff --git a/views.py b/views.py --- a/views.py +++ b/views.py @@ -28,9 +28,11 @@ from cubicweb.web.views import primary, baseviews, xmlrss, basecontrollers, treeview _afs = uicfg.autoform_section -_afs.tag_subject_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.tag_subject_of(('*', 'comments', '*'), False) _abaa.tag_object_of(('*', 'comments', '*'), False) @@ -219,6 +221,9 @@ self._cw.add_js(('cubicweb.edition.js', 'cubes.comment.js')) if newcomment is None: newcomment = commented + formvalues = {'comments': commented.eid} + else: + formvalues = {} if self._cw.cnx.anonymous_connection: self.propose_to_login() # hack to avoid tabindex conflicts caused by Ajax requests @@ -242,12 +247,6 @@ domid='commentForm%s' % commented.eid, form_buttons=buttons) 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>' % ( commented.eid, form.render(formvalues={'comments': commented.eid}, main_form_title=u'',