Redirect back to the discussion control panel when the discussion control panel form is submitted.
svn path=/plone.app.discussion/trunk/; revision=46040
This commit is contained in:
parent
65f1ba8230
commit
13772c6e5b
@ -4,6 +4,10 @@ Changelog
|
||||
1.0RC1 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Redirect back to the discussion control panel when the discussion control
|
||||
panel form is submitted.
|
||||
[timo]
|
||||
|
||||
- Fix document_byline bottom margin if commenter images are disabled.
|
||||
[timo]
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Products.statusmessages.interfaces import IStatusMessage
|
||||
|
||||
from plone.app.registry.browser import controlpanel
|
||||
|
||||
from plone.app.discussion.interfaces import IDiscussionSettings, _
|
||||
|
||||
from z3c.form import button
|
||||
from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
|
||||
|
||||
|
||||
@ -45,6 +48,24 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm):
|
||||
self.widgets['user_notification_enabled'].label = \
|
||||
_(u"User Email Notification")
|
||||
|
||||
@button.buttonAndHandler(_('Save'), name='save')
|
||||
def handleSave(self, action):
|
||||
data, errors = self.extractData()
|
||||
if errors:
|
||||
self.status = self.formErrorsMessage
|
||||
return
|
||||
changes = self.applyChanges(data)
|
||||
IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
|
||||
"info")
|
||||
self.context.REQUEST.RESPONSE.redirect("@@discussion-settings")
|
||||
|
||||
@button.buttonAndHandler(_('Cancel'), name='cancel')
|
||||
def handleCancel(self, action):
|
||||
IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
|
||||
"info")
|
||||
self.request.response.redirect("%s/%s" % (self.context.absolute_url(),
|
||||
self.control_panel_view))
|
||||
|
||||
|
||||
class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
|
||||
form = DiscussionSettingsEditForm
|
||||
|
Loading…
Reference in New Issue
Block a user