Skip to content
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

ZMI: Determining if an object doesn't need/want a modal Add dialog #535

Closed
dataflake opened this issue Apr 4, 2019 · 1 comment

Comments

@dataflake
Copy link
Member

commented Apr 4, 2019

Right now there is a hardcoded list of constructor and product names inside zmi/styles/resources/zmi_base.js for items that don't want to show the modal dialog when adding them to a container.

There are many Zope products out there that worked fine before just attempting to redirect to their container without showing an add form, which now pop up the modal dialog that just renders the container contents. And if you dismiss the modal dialog the underlying page shows the old container contents, as if nothing was added.

I think we can agree that the solution is sub-optimal. Third-party authors should be able to set a flag themselves that will prevent the modal from popping up. This could be anything from a new class attribute (they already have to add zmi_icon so that's no big deal) or maybe just an added query string item that gets passed with the product's own redirect URL. I'm open for pretty much any solution that allows the product author to decide without asking to have Zope code changed.

@dataflake dataflake added the bug label Apr 4, 2019

@dataflake dataflake added this to the 4.0 final milestone Apr 4, 2019

@dataflake dataflake added this to To do in Zope 4 final release via automation Apr 4, 2019

@drfho

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2019

@dataflake
yes, a class attribute like add_modal=True|False could solve that issue. This could be rendered (Zope\src\App\dtml\manage_navbar.dtml) as an optional data-attribute (e.g. data-dialog="modal") into the selectlist and control the JS function addItem()

<select id="addItemSelect"...>
<option value="manage_addProduct/BTreeFolder2/folderAdd">BTreeFolder2</option>
<option data-dialog="modal"  value="manage_addProduct/Sessions/addIdManager">Browser Id Manager</option>
....
</select>

As far as understand you would prefer a whitelist instead of the blacklitsted classes as the better suboptimum? If you add an add_modal attribute (like the zmi_icon) that is rendered into the addItem-list, I can modify the JS twisting the logic and using that attribute.
Cheers
fh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.