From f93f419f99793488b00df3cd7eebbf48ebb87e9c Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Tue, 26 Jan 2010 10:27:38 +0000 Subject: [PATCH] Custom cancel button class added again. Plone 3.x reply-to-comment form still uses this. svn path=/plone.app.discussion/trunk/; revision=33453 --- plone/app/discussion/browser/comments.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 80acbb3..8fc225e 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -41,6 +41,18 @@ from plone.z3cform import layout, z2 from plone.z3cform.fieldsets import extensible +class CancelButtonAction(button.ButtonAction): + """Cancel button with Plone CSS style. + """ + +def cancelButtonActionFactory(request, field): + """Cancel button action factory. + """ + button = CancelButtonAction(request, field) + button.klass += " standalone hide" + return button + + class CommentButtonAction(button.ButtonAction): """Comment button with Plone CSS style. """ @@ -76,6 +88,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form): self.widgets['author_name'].mode = interfaces.HIDDEN_MODE self.widgets['author_email'].mode = interfaces.HIDDEN_MODE self.buttons['comment'].actionFactory = commentButtonActionFactory + self.buttons['cancel'].actionFactory = cancelButtonActionFactory # XXX: Since we are not using the author_email field in the # current state, we hide it by default. But we keep the field for