Create improved sortable many relationship widget in Admin UI
See original GitHub issue@morenoh149 based on our conversation on IRC I have created this issue (I’m d4rklit3 on freenode)
The Issue
The current UI does not allow for any kind of context based sorting of these relationships. The only place to sort an enumerable amount of models is this:
This issue with this is that its a global sort. If you ever need to to have these items in a different order somewhere else there is no way to actually do this.
Currently this is what we have for a one-to-many relationship in Keystone:
tickers: {type:Types.Relationship, ref:"Ticker", many:true}
I would like to propose something a bit more functional for providing contextual sorting for many:true
relationships:
Some Background
In my experience with working on some custom CMS platforms (mostly built in YII over php) we would use MySQL and we would need to create join tables for this kind of thing. The join tables would allow for intermediary records to hold a context based sort order for an object relationship between 2 tables. I think the way Mongo handles “relationships” (in that it doesn’t) makes this problem almost non-existent outside of just using the proper UI.
All relationships in Mongo are just an array of ObjectIDs stored inside of an array. The index of that array can reliably used as the sort order.
Working Examples
I would like to propose that we move to a more functional interface for the many:true
relationships within the schemas.
These are some successful UIs that I like or have used.
Wordpress ACF Relationship Field
This is from a more recent project I was working on where we had many different posts that would need to be in many different orders depending on what page they appeared on. This widget was really helpful.
JQuery UI Draggable
https://jqueryui.com/sortable/#default
I have used this many times. It’s pretty self explanitory.
React Flavored
http://webcloud.se/truly-reactive-sortable-component/
This may be helpful if you are using react.
One More For Good Measure
http://rubaxa.github.io/Sortable/
Proposed Solution
This is something I mocked up for what I was thinking.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:14 (5 by maintainers)
Top GitHub Comments
I also think this should be improved. My main trouble is that only a few elements of the collection are availbale when you have more than 100 items in your rederenced collection. In my case, it makes the admin quite useless.
is this related? #3282