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

fix #343423: editing an existing comment creates a new comment

parent 2b97e7760537
No related branches found
Tags cubicweb-comment-version-1_4_1
No related merge requests found
/* /*
* :organization: Logilab * :organization: Logilab
* :copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. * :copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
* :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr * :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
*/ */
......
...@@ -164,6 +164,7 @@ ...@@ -164,6 +164,7 @@
__select__ = implements('Comment') __select__ = implements('Comment')
jsfunc = "processComment(%s, '%s')" jsfunc = "processComment(%s, '%s')"
jsonmeth = 'edit_comment'
def cell_call(self, row, col): def cell_call(self, row, col):
self.comment_form(self.entity(row, col)) self.comment_form(self.entity(row, col))
...@@ -175,7 +176,7 @@ ...@@ -175,7 +176,7 @@
# hack to avoid tabindex conflicts caused by Ajax requests # hack to avoid tabindex conflicts caused by Ajax requests
self.req.next_tabindex = count(20).next self.req.next_tabindex = count(20).next
jseid = dumps(commented.eid) jseid = dumps(commented.eid)
buttons = [Button(onclick=self.jsfunc % (jseid, 'add_comment')), buttons = [Button(onclick=self.jsfunc % (jseid, self.jsonmeth)),
Button(stdmsgs.BUTTON_CANCEL, Button(stdmsgs.BUTTON_CANCEL,
onclick=self.jsfunc % (jseid, ''))] onclick=self.jsfunc % (jseid, ''))]
form = self.vreg.select_object('forms', 'edition', self.req, form = self.vreg.select_object('forms', 'edition', self.req,
...@@ -192,6 +193,8 @@ ...@@ -192,6 +193,8 @@
id = 'inlinecommentform' id = 'inlinecommentform'
__select__ = match_kwargs('commented') # explicit call when it makes sense __select__ = match_kwargs('commented') # explicit call when it makes sense
jsonmeth = 'add_comment'
def call(self, commented): def call(self, commented):
self.initialize_varmaker() self.initialize_varmaker()
newcomment = self.vreg.etype_class('Comment')(self.req) newcomment = self.vreg.etype_class('Comment')(self.req)
......
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