Page MenuHomeSealhub

Create a Sealgen template for drag-and-drop sorting view
Open, NormalPublic1 Points

Description

It's sometimes useful to give the users ability to put elements of a collection in a specific arbitrary order. It's implemented by adding a number-type field to the collection, making it editable, and then sorting by the value of that field. In order to make editing the fields across many collection items easier, it's good to have a list of all the elements in the collection where the user can just drag-and-drop elements and not worry about numbers.

Here's a view that implements this in Aspazja:

https://hub.sealcode.org/source/aspazja/browse/master/src/back/routes/dowodzenie/zabiegi/sort.post.tsx

The task is to implement this view as a Sealgen template that can be added to your app with npx sealgen add-route. It should ask about the collection and the field. It should only propose fields of type number in the TUI.