This is a big issue with more implications than I probably see, but I would like to humbly suggest to rethink and update the URLs for collections and document sets (and maybe other resources too). The current situation appears to cause issues for users and it makes understanding and developing the application harder.
I know that FromThePage has a long history and understand that Rails has evolved too. This issue comes from me finding it hard to understand why some issues exist or even seem to return. I don't expect that I have time to help implement (all) the suggestions below or that you will prioritise this.
Some observations about routing:
There is no link between a document set's URL and its parent collection's URL
This makes it easy to have a public document set within a private collection appear as a collection
But they are not, e.g. #3411
Having the same URL structure for collections and document sets requires that slugs are unique for more or less the whole FromThePage installation:
2932
2837
4067
4278
It makes looking up items more complicated
3117
3047
There is no strict link between a document set's URL and its owner's profile URL
1763
indirectly related: #4402
(Some) URLs should look friendlier
4292
Some of these issues were already addressed. But not having a clear structure may require increasingly complex logic to maintain integrity (force unique slugs, force slugs to not be numbers only, make routes.rb longer, etc.) when adding features.
The Rails guide on routing makes it all look easy, if your controller actions match the Rails defaults.
Let me provide some suggestions for discussion:
if an object is always part of some other object, nest the URLs (e.g. articles should always be POSTed within a collection)
include the type of (nested) resource in the URL, to prevent potential conflicts when IDs for collections, works and pages overlap and to allow easier (mental) construction of URLs. For example, the /iiif/ path can be followed by collection, work or page IDs, or by fixed strings; while I don't think any of the IIIF routes could 'clash' currently, updating or adding routes requires carefully analysing whether that action introduces potential clashes. For collections and document sets, URLs did collide, but a different solution, unique slugs, was chosen.
refactor routes with verbs to resources with HTTP methods, e.g. POST document_sets/remove_set_collaborator with query params for the IDs of the document set and the collaborator could become DELETE document_sets/:document_set_id/collaborators/:collaborator_id.
This is a big issue with more implications than I probably see, but I would like to humbly suggest to rethink and update the URLs for collections and document sets (and maybe other resources too). The current situation appears to cause issues for users and it makes understanding and developing the application harder.
I know that FromThePage has a long history and understand that Rails has evolved too. This issue comes from me finding it hard to understand why some issues exist or even seem to return. I don't expect that I have time to help implement (all) the suggestions below or that you will prioritise this.
Some observations about routing:
2932
2837
4067
4278
3117
3047
1763
4292
Some of these issues were already addressed. But not having a clear structure may require increasingly complex logic to maintain integrity (force unique slugs, force slugs to not be numbers only, make routes.rb longer, etc.) when adding features.
The Rails guide on routing makes it all look easy, if your controller actions match the Rails defaults.
Let me provide some suggestions for discussion:
POST
ed within a collection)/iiif/
path can be followed by collection, work or page IDs, or by fixed strings; while I don't think any of the IIIF routes could 'clash' currently, updating or adding routes requires carefully analysing whether that action introduces potential clashes. For collections and document sets, URLs did collide, but a different solution, unique slugs, was chosen.POST document_sets/remove_set_collaborator
with query params for the IDs of the document set and the collaborator could becomeDELETE document_sets/:document_set_id/collaborators/:collaborator_id
.Thanks!