Closed Andi-Lo closed 8 years ago
I like the idea.
There are two different approches i could take. I would love to have some input on this.
I would use the already available subpage max
setting.
title: Modules
pages:
max: 2
template:
- module.text
- module.gallery
The "core" implementation would be to hide the add button when you hit the max number of subpages / modules. With this appraoch it would be possible to also reach the limit with only invisible modules present.
I would prefer something like a maximum of visible modules and a unlimited number of invisible modules. So you could also prebuild a module and switch it on the fly when you have to edit or replace a module. Perhaps a duplicate button would be nice too.
I'm also thinking about limiting the number of times you could use a module. Something like this.
label: Modules
type: modules
limit:
'module.gallery': 1
'module.text': 1
or
label: Modules
type: modules
limit:
- template: module.gallery
max: 1
- template: module.text
max: 1
Not sure about the syntax yet.
Very well thought out there! Exactly how I imagined it. :+1:
Especially that you can have more invisible modules then visible is very handy for the author. Maybe someone has regularly switching content that changes like every quarter, then you can just switch them in and out. Otherwise you would be forced to first delete 1 module before you could add another one.
The "core" implementation would be to hide the add button when you hit the max number of subpages / modules.
Maybe the button should stay visible but has some status like "disabled" with maybe a toast indication that states that the max number is reached or something. I could imagine that some "non-technical-people" get confused when they are restricted but can not relate why that is.
I wasn't able to finish this over the weekend and now i am on vacation. I'll try to get this done as soon as i come back.
You can checkout the dev branch.
I changed the blueprint syntax a bit.
style: items #or table
options:
redirect: false
preview: true
delete: true
limit: null
edit: true
modules:
'module.text':
redirect: true
'module.gallery':
limit: 1
edit: false
You can now define default options for the modules and overwrite these for specific templates if needed.
And of course you can set the max
value.
pages:
template:
- module.text
- module.gallery
hide: true
max: 10
But I still need some feedback for the user if max
or limit
is reached I think.
Very nice work! Thanks for providing
I will update the plugin as soon as I'm back to developing. Currently on vacation too ;) so not before next week.
It would be a great feature if you could be able to limit the number of modules that you can create in some way.
Then you can have a field like this:
With a small indication of the amount of modules you got and if you have reached the limit. This would be very handy if you build something like a two column layout where you just want 2 elements to fill the left and the right column and don't want to worry of a 3rd module getting mistakenly created that crashes the layout.
Cheers Andreas