Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.2k
feat: allow plugins to disable their edit modal#7989
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
macolo commentedSep 10, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@fsbraun nice! I thought a bit about this and have two use cases:
In summary, would it make sense to also disallow direct drag & drop for Of course, dragging them via a parent plugin should always be possible, as the whole complex can be dragged to another position in the placeholder, can be cut or copied and pasted elsewhere. |
fsbraun commentedSep 10, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@macolo Draging is still fully controlled by Indeed, the parent plugin cannot rely on the existence or order of child plugins. Any management code must be flexible and say recreate a missing child if needed, or might want to merge if there are several children, say, for a single slot. Disabling dragging alone would not solve this issue: There is also pasting or adding plugins. PS: The custom component construct does ignore the order of the child plugins. |
fsbraun commentedSep 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@macolo I have now implemented drag-disabling in principle (CSS and JS side). Shall we go for another plugin option that disables drag for child plugins? It would also need to disable add and paste. Something like |
Reviewer's Guide by SourceryThis pull request introduces the ability to disable the edit modal for plugins. This is achieved by adding an 'edit_disabled' property to the plugin class or instance. Additionally, it allows adding custom classes to the drag item in the structure board via the 'add_structureboard_classes' property. Sequence diagram for plugin edit interaction with disabled editingsequenceDiagram actor User participant UI participant Plugin participant Editor User->>UI: Double clicks plugin UI->>Plugin: Check edit_disabled status alt edit_disabled is true Plugin-->>UI: Editing disabled UI-->>User: No action else edit_disabled is false Plugin-->>UI: Editing allowed UI->>Editor: Open edit modal Editor-->>User: Show edit interface end Class diagram showing plugin edit configuration changesclassDiagram class Plugin { +edit_disabled: bool +add_structureboard_classes: string +allow_children: bool +disable_child_plugins: bool +get_plugin_class() } class PluginInstance { +edit_disabled: bool +add_structureboard_classes: string } Plugin <|-- PluginInstance note for Plugin "New properties added:edit_disabled andadd_structureboard_classes" note for PluginInstance "Can override class-leveledit_disabled setting" State diagram for plugin edit statesstateDiagram-v2 [*] --> Normal Normal --> EditDisabled: edit_disabled=true Normal --> Editable: edit_disabled=false state Editable { [*] --> Ready Ready --> EditModal: Double click EditModal --> Ready: Close modal } state EditDisabled { [*] --> NoEdit NoEdit --> NoEdit: Double click (no effect) } File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess yourdashboard to:
Getting Help
|
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.
Hey@fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please add tests to verify both the frontend and backend behavior of the edit disabling functionality
Here's what I looked at during the review
- 🟡General issues: 1 issue found
- 🟢Security: all looks good
- 🟢Testing: all looks good
- 🟢Complexity: all looks good
- 🟢Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
As discussed in#7982, some plugins' configuration might not be edited. Examples are:
This PR allows plugins to mark themselves asnon-editable by setting
edit_disabled
class property of the plugin class, or by settingedit_disabled
instance property on the plugin instance (potentially dynamically)If either is set, the structure board will not offer the edit button, and double-clicking the plugin on the page or in the structure view will not open the edit modal.
Finally, if the plugin instance has a
add_structureboard_classes
property, those classes will be added to the drag item in the structure board. This can be used to style plugins in the structure board dynamically. Styles would need to be added in a customcms_toolbar.py
.Example
This PR doesnot include the grey text color. I included this to show which plugins donot have edit modals:
Related resources
Checklist
develop-4
Summary by Sourcery
Allow plugins to disable their edit modal by setting the
edit_disabled
property on the plugin class or instance. Add the ability to style plugins in the structure board dynamically by adding classes to theadd_structureboard_classes
property.New Features: