From 01f44e31473c940eeda7964c8f34ded618519e06 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Tue, 4 Aug 2009 19:24:47 +0000 Subject: [PATCH] add cancel button. make strings translatable. svn path=/plone.app.discussion/trunk/; revision=28356 --- plone/app/discussion/browser/comments.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index f46035c..3ece16a 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -66,12 +66,14 @@ class View(BrowserView): def __call__(self): comment_id = aq_parent(self).id - self.request.response.redirect(aq_parent(aq_parent(aq_parent(self))).absolute_url() + '#' + comment_id) + self.request.response.redirect( + aq_parent(aq_parent(aq_parent(self))).absolute_url() + + '#' + str(comment_id)) class CommentForm(extensible.ExtensibleForm, form.Form): ignoreContext = True # don't use context to get widget data - label = u"Add a comment" + label = _(u"Add a comment") fields = field.Fields(IComment).omit('portal_type', '__parent__', @@ -89,7 +91,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): super(CommentForm, self).updateWidgets() self.widgets['in_reply_to'].mode = interfaces.HIDDEN_MODE - @button.buttonAndHandler(u'Comment') + @button.buttonAndHandler(_(u"Comment")) def handleApply(self, action): data, errors = self.extractData() @@ -129,9 +131,11 @@ class CommentForm(extensible.ExtensibleForm, form.Form): comment_id = conversation.addComment(comment) # Redirect to comment (inside a content object page) - self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url() + '#' + str(comment_id)) + self.request.response.redirect( + aq_parent(aq_inner(self.context)).absolute_url() + + '#' + str(comment_id)) - @button.buttonAndHandler(u'Reply') + @button.buttonAndHandler(_(u"Reply")) def handleReply(self, action): data, errors = self.extractData() @@ -189,6 +193,11 @@ class CommentForm(extensible.ExtensibleForm, form.Form): # Redirect to comment (inside a content object page) self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url() + '#' + str(reply_to_comment_id)) + @button.buttonAndHandler(_(u"Cancel")) + def handleCancel(self, action): + # This method should never be called, it's only there to show + # a cancel button that is handled by a jQuery method. + pass class ViewletFormWrapper(ViewletBase, layout.FormWrapper):