OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Management of a new hide/show field in frontend #8752

Open gdessimoneinvalle opened 5 months ago

gdessimoneinvalle commented 5 months ago

https://github.com/OrchardCMS/Orchard/blob/97648ed5a2a6c43074216786126ff8a207e6ac2f/src/Orchard.Web/Core/Navigation/Views/Admin/Index.cshtml#L117

A customer asked us to be able to manage displaying contents in the menus via a new button visible directly from the navigation list, in order to have an immediate visual impact of what will be visible to the public in frontend this is a proposal for a new feature

giannik commented 5 months ago

Why have a hard coded value to show or hide only ? You may want to show or hide menus based on various rules, example if the user is a member of a specific role, based on the language, based on the current date, whatever . A more flexible approach would be to do what the layers module does to show or hide widgets with a rules defined approach. Example for each menu item you could have a text area input where user defines his rules that evaluate to true or false and this could control the menu rendering or not.

gdessimoneinvalle commented 5 months ago

I know but the solution was implemented at the client's request according to the design made by another team and created with a limited budget, so there was no margin for too generic solutions. Another request from the technical team was specifically to do a PR, which I did.

sebastienros commented 5 months ago

You may want to show or hide menus based on various rules, example if the user is a member of a specific role, based on the language, based on the current date, whatever .

This is accomplished by customizing the MenuPart and changing the view to filter items based on these custom fields.

Theorically this is how this should be done for hide/show too, with a Boolean field named Visible for instance. I had forgotten about it. It would be nice if this could be the option that is chosen, which would require an extra click.

This state could be exposed in the list of menu items by customizing the shapes that render it. All this would then be in the customer's solution.

gdessimoneinvalle commented 5 months ago

Curiously, this was the solution that was initially implemented, and it worked, but the technical team that designed the site then decided to let us proceed in this way, I will point out your criticisms