Preserve order of project tags list
Overview
The edit project form template sorts the values automatically, so you can save tags in a specific order, but the next time you edit it, it will be sorted alphanumerically.
Details
The edit template adds a .sort
which will mess up any ordering of tags the next time you edit project tags.
Furthermore, we use acts_as_taggable
for our project model, which does not preserve the order of project tags. We need to use acts_as_ordered_taggable
in order to preserve the order.
For example:
Given that we only show the first three tags, a user may want to set the tags in such an order that it displays the three most important tags:
- User sets tags "e, b, a, z, k"
- User hits save
- User is redirected once changes have been applied
- User sees project tags form input again, this time sorted, e.g., "a, b, e, k, z"
The user would have to re-edit the tags if they wanted to order it correctly.
Context
A user inquired whether or not we sort this, and we do. That said, the sort was only added in order to fix a failing test which seems a bit backwards, especially as it's not fulfilling any actual product requirement or other need that the tags be sorted in some way.
Given that we recently updated the project overview page to include the first three project tags, there is a valid case for a user to want to prioritize the first three tags to be the most relevant to a given project.