Set CSS classes for the comment form in the updateActions method.
svn path=/plone.app.discussion/trunk/; revision=33520
This commit is contained in:
parent
faf339bec5
commit
2179e447ab
@ -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]
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user