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

Add option to disable particle items #2509

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

thexmanxyz
Copy link
Contributor

@thexmanxyz thexmanxyz commented Jun 25, 2019

I added an additional field to all relevant particles which contain a collection.list to allow that a user can selectively disable certain front-end items. The idea for this adaption comes from @yellowwebmonkey. The particles which I found and come into question are:

  • Social
  • Sample (Hydrogen)
  • Content Cubes
  • Horizontal Menu
  • Content Tabs

Please also see the PR #2286 which contains the same functionality for the Owl Carousel.

Edit:
This might however not be the final solution because the best way to solve this would be to have a default field which is always present on collection.list items to disable items. But I'm lacking project knowledge to implement this in a slick way. Also there are quite some considerations (this is clearly not needed everywhere and the disable functionality has to be either additionally implemented in the corresponding twig files everywhere where it is missing or the elements have to be already auto-filtered on the disable boolean before they are passed over to twig) and a lot of other elements are effected by such a change.

In the long term I'm with the solution of auto-apply a disable field and auto-filtering items on the fields value and only then passing them over to twig. I would consider it to work like it does on Atoms and Particles but only this time applied to a list of items instead. Because this would be a solution every RT template would benefit from too. Because the current state of deleting items instead of hiding them is kind of annoying.

@thexmanxyz
Copy link
Contributor Author

Tagging people @JoomFX @w00fz @N8Solutions @yellowwebmonkey

@JoomFX
Copy link
Contributor

JoomFX commented Jun 26, 2019

@thexmanxyz This is a great feature but in my opinion it should be implemented on the framework level somehow.
I'm simply not interested in modifying 70+ particles to add this feature :)

@thexmanxyz
Copy link
Contributor Author

@JoomFX Yeah that is also what I pointed out ;). A ideal solution would apply this automatically and handle the filtering of disabled ones.

@mahagr
Copy link
Member

mahagr commented Jul 1, 2019

@thexmanxyz I just have a single major wish: Please change the option to be positive instead of negative. This is for usability as it is better to keep enabled (green) state on left and disabled (red) on the right. :)

Also look at how the other buttons are labelled etc. :)

@thexmanxyz
Copy link
Contributor Author

thexmanxyz commented Jul 1, 2019

@mahagr Their is an issue with collection.list items because they would not reconfigure automatically to default state of new controls and their values. What that means is, that already existing items would be disabled until each list item is saved again. But I missed that we can force |default(value) I will recheck the PR.

@thexmanxyz
Copy link
Contributor Author

thexmanxyz commented Jul 1, 2019

@mahagr I updated the particles. I changed the description, the type is now enable.enable as you requested. I also changed the label to Enabled and trueby default. However the issue from above is still there as new controls don't hold the default state until re-saved. But I now simply forced |default(true) on the control value which solves it for me. Now everything should be as requested.

@mahagr
Copy link
Member

mahagr commented Jul 1, 2019

Yes, you need to enter a default value in order to make it work before saving. That is fully expected as otherwise the default is null (not set).

@mahagr mahagr self-requested a review July 1, 2019 12:02
@thexmanxyz
Copy link
Contributor Author

thexmanxyz commented Jul 1, 2019

@mahagr I'm not sure if we are talking about the same. If I set up the following control:

        .enabled:
          type: enable.enable
          label: Enabled
          description: Enables the item on the front end.
          default: true

in a collection.list. The default state for .enabled (true) is only set if I open each already existing item and save it. Otherwise the state would be null (not set). That is what I experienced. Just reiterating the issue to be sure we have the same understanding.

@mahagr
Copy link
Member

mahagr commented Jul 1, 2019

Yes, we are. What you're talking about is the default behaviour for configuration. If the value is not set, Gantry thinks it is null even if you had the default set in the blueprints. Blueprints are only used for displaying the form and saving it.

@thexmanxyz
Copy link
Contributor Author

@mahagr Alright, I'm glad that we talking about the same thing. Ok I now understand how the default values work! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants