From 2179e447ab79dbfd118daceb5d40ca656535dd9a Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Wed, 27 Jan 2010 19:20:25 +0000 Subject: [PATCH] Set CSS classes for the comment form in the updateActions method. svn path=/plone.app.discussion/trunk/; revision=33520 --- docs/HISTORY.txt | 1 + plone/app/discussion/browser/comments.py | 34 +++++------------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 8c5e1c0..9153b97 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -4,6 +4,7 @@ Changelog 1.0b3 (XXXX-XX-XX) ------------------ +* Set CSS classes for the comment form in the updateActions method. [timo] * Respect the allow_comments field on an object and avoid calculations if no comments should be shown. [hannosch] * Automatically load the ZCML files of the captcha widgets if they are installed. [hannosch] * Fixed i18n domain in GenericSetup profiles to be ``plone``. Other values aren't supported for GS profiles. [hannosch] diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 8fc225e..3b0fa84 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -41,30 +41,6 @@ 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. - """ - -def commentButtonActionFactory(request, field): - """Comment button action factory. - """ - button = CommentButtonAction(request, field) - button.klass += " context" - return button - - class CommentForm(extensible.ExtensibleForm, form.Form): ignoreContext = True # don't use context to get widget data @@ -87,14 +63,18 @@ class CommentForm(extensible.ExtensibleForm, form.Form): if not portal_membership.isAnonymousUser(): 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 # integrators or later use. self.widgets['author_email'].mode = interfaces.HIDDEN_MODE + + def updateActions(self): + super(CommentForm, self).updateActions() + self.actions['cancel'].addClass("standalone") + self.actions['cancel'].addClass("hide") + self.actions['comment'].addClass("context") + @button.buttonAndHandler(_(u"add_comment_button",default=u"Comment"), name='comment') def handleComment(self, action): context = aq_inner(self.context)