Allow users to reorder document files
Feature description
Currently the UI will order files for documents in the order that they were uploaded (database row order). It would be beneficial if the order can be customised.
Use cases
If a document contains .pdf and .tex files, uploading the .tex file first will make that the default tab that gets shown first. But it is almost always desirable to keep the PDF as the first file, which can only be done by deleting the file and making sure to upload .pdf first properly. This can get annoying when you forget (it's like once every 6 months or once a year to upload a document).
Benefits
It's frustrating to remember to upload the files in the correct order. Arbitrary ordering will be helpful.
Requirements
Just an idea.
- Backend: Add a new Integer field in
DocumentFilefororder(1 = first file, 2 = second file).- When adding files, use number of files + 1 as the new order.
- When deleting files, run something like (pseudo-sql)
UPDATE SET order = order - 1 WHERE order > deleted_row.order, to shift the orders to be consecutive
- Frontend: Make the file list in the document settings page orderable -- either drag-and-drop or arrows to move up/down. On save, send the new ordering to the backend.