Skip to content

Commit

Permalink
Merge pull request #3719 from plone/controlpanel-actions-modal-settings
Browse files Browse the repository at this point in the history
Show `modal` property when editing an action
  • Loading branch information
mauritsvanrees authored Feb 4, 2023
2 parents 1853e1b + 9d4c402 commit 40a56e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Products/CMFPlone/controlpanel/browser/actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from plone.autoform.form import AutoExtensibleForm
from plone.base.interfaces import IActionSchema
from plone.base.interfaces import INewActionSchema
from plone.base.utils import base_hasattr
from Products.CMFCore.ActionInformation import Action
from Products.CMFCore.interfaces import IAction
from Products.CMFCore.interfaces import IActionCategory
Expand All @@ -14,6 +15,8 @@
from zope.interface import implementer
from zope.lifecycleevent import ObjectCreatedEvent

import json


class ActionListControlPanel(BrowserView):
"""Control panel for the portal actions."""
Expand Down Expand Up @@ -163,6 +166,22 @@ def set_position(self, value):

position = property(get_position, set_position)

def get_modal(self):
return self.context.modal

def set_modal(self, value):
# This property may not exist yet on the context.
if not self.context.hasProperty("modal"):
if base_hasattr(self.context, "modal"):
# We cannot define a property when an attribute with the same
# name already exists.
delattr(self.context, "modal")
self.context._setProperty('modal', value, 'string')
else:
self.context._setPropValue('modal', value)

modal = property(get_modal, set_modal)


class ActionControlPanel(AutoExtensibleForm, form.EditForm):
"""A form to edit a portal action."""
Expand Down
2 changes: 2 additions & 0 deletions news/3709.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix editing `modal` property of an action in `@@actions-controlpanel`.
[petschki]

0 comments on commit 40a56e7

Please sign in to comment.