It would be great to have some more triggers in core module views. I tried something here and added a few possible triggers for custom tabs and options in collection view.
With some simple code it would be possible to extend the layout and to add a lot more options to collections like grouping or adding categories and changing default script options etc.
With more triggers it would be easier for addon development to adjust minor changes to core modules instead of adding extra links to the menu with configuration pages.
I would add triggers everywhere, before and after every menu, over and under important text blocks… but it could become messy if I would decide such things…
I also committed a pull request that would add more triggers to collections because I liked to extend collection functionality https://github.com/agentejo/cockpit/pull/824 but that request is waiting since the 22th of July. Don’t think it will ever be merged.
It would really be awesome if we had some more triggers allowing us to extend native collection functionality
having more triggers will bring more flexibility, but believe that should be managed very carefully, to avoid impacting the performance and code complexity.
The groups seems an interesting idea, @raffaelj, what you are exactly trying to achieve with them? Is something like spaces?
Yes, “spaces” is a good name. I wanted to name it “groups” first, which could be confusing with acl groups.
I like the concept of storing everything in collections, but if I think about more complex projects, I would like to have a better overview over my collections.
A possible use case:
10+ collections with pages, dates, products…
10+ collections with meta data like product types, categories…
50+ collections with image galleries
maybe collections with comments or some logging data…
100+ custom collections for users
They all are linked together with collection-links and module-links (not written yet).
Searching/Filtering for the right collection would be a mess.
I would build dashboard widgets and views to see only the collections/spaces, I’m interested in, like galleries, pages and products. Multiple galleries could be grouped by categories etc.
Ok, I see, not sure if is exactly the same, I was viewing Spaces as isolated areas that can share the same structure of collections but not the contents, so you can build n consumers (websites, mobile app, etc…). Your scenario seems more like a better way to filter contents (and that makes also sense).
Ah, you found exaxtly the same places. I didn’t realize your pull request before.
But I found other triggers, that could be used to achieve the goal: app.{$controller}.init and app.layout.contentbefore
Custom configuration could be included in app.layout.contentbefore and app.layout.contentafter, which will only be triggered, when the Admin Controller for collections gets called on app.collections.controller.admin.init
My thoughts were just about an easy way to add more options to collections, like Corporate Design colours or things like categories, tags, types/groups/spaces, custom addon options…
In short:
With Cockpit I have a great tool to store any structured data in collections. But my collections aren’t structured very well.
But your idea sounds interesting, too. I already have another project in mind, where I could use this functionality, if I understand it the same way like you.
Do you mean, copying the database schema for new users? Something in this direction?
collections:
collection1 # acl: admin
collection2 # acl: admin
spaces:
default:
collection1 # copy only schema
collection2 # copy schema and create first entry with default contents
And creating new users/groups triggers to generate new collections with the same schema?