-
-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show modal
property when editing an action
#3719
Conversation
@petschki thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
return json.loads(self.context.modal) | ||
|
||
def set_modal(self, value): | ||
self.context.modal = json.dumps(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mauritsvanrees not sure if this loads/dumps is needed for the textinput here ... the JSON is validated in plone.base.interfaces.controlpanel.IActionSchema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not needed. With this code, I actually get a validation error when I edit the Delete action and save it without changes: "Expecting property name enclosed in double quotes."
Ah, in the ZMI the value is:
{"actionOptions": {"disableAjaxFormSubmit":true, "redirectOnResponse":true}}
With the current code in this PR, this shows up in the Plone control panel as:
{'actionOptions': {'disableAjaxFormSubmit': True, 'redirectOnResponse': True}}
And this is no json, due to the single quotes and the Python-style booleans.
Funny. :-)
So just use return self.context.modal
and self.context.modal = value
. Then it works for me.
I have pushed a fix.
modal
property when editing an action
This actually does the wrong thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
I answered your remark in a comment, and pushed a fix.
But the setter is still not completely right yet. It works when the property already exists, but not all actions have the modal property. I tried it with the Paste action in Object buttons. In the control panel I can set a modal value and save it, but it does not show up in the ZMI.
Other parts of the code here call self.context._setPropValue
, but that does not do it either. An attribute modal
is set on the context, with the value, but it does not show up in the ZMI. The modal is then not active when I use the paste action: having an attribute is not enough, it has to be a property.
Okay, I have fixed that too, and now the property is there in the ZMI, and the modal is used when pasting.
Can you try it out?
return json.loads(self.context.modal) | ||
|
||
def set_modal(self, value): | ||
self.context.modal = json.dumps(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not needed. With this code, I actually get a validation error when I edit the Delete action and save it without changes: "Expecting property name enclosed in double quotes."
Ah, in the ZMI the value is:
{"actionOptions": {"disableAjaxFormSubmit":true, "redirectOnResponse":true}}
With the current code in this PR, this shows up in the Plone control panel as:
{'actionOptions': {'disableAjaxFormSubmit': True, 'redirectOnResponse': True}}
And this is no json, due to the single quotes and the Python-style booleans.
Funny. :-)
So just use return self.context.modal
and self.context.modal = value
. Then it works for me.
I have pushed a fix.
works here too ... I'll start Jenkins. |
fixes #3709
This needs plone/plone.base#27