mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 17:31:34 -05:00
Currently templates are ordered by the newest created first. This made sense when, after creating a new template, you were landed on the page that listed all the templates. In other words, you needed to see confirmation of the thing that you’ve just done. Now (since https://github.com/alphagov/notifications-admin/pull/1195) you get landed on the page for just that template. So you always see the template you’ve just created, no matter how the list of templates is ordered. So we are free to change the order of the templates. Ordering by time created is not great, because it gives users no control over which templates appear first. For example, our research reported this from one team: > One frustration they have is that when you add a new template it > automatically goes to the top of the list. To get round this, whenever > they add a new template they delete all of the existing ones and start > again because they want to keep their templates in numerical order. > They'd like to be able to control the order of templates in the list. We _could_ give people some sort of drag-and-drop template ordering thing. But this feels like overkill. I think that alphabetical order is better because: - it’s easily discoverable – anyone who wants to know how a list is ordered can quickly tell just by looking at it - it’s universal – everyone knows how alphabetical ordering works - it’s familiar – this is how people documents on their computer are ordered; there’s no new UI to learn - it’s what users are doing already – from the same service as above: > They number their templates 1,2a, 2b, 3a etc So this commit changes the ordering from newest created first to alphabetical. Previous changes to template order and navigation: - https://github.com/alphagov/notifications-admin/pull/1163 - https://github.com/alphagov/notifications-admin/pull/1195 - https://github.com/alphagov/notifications-admin/pull/1330 Implementation notes --- I refactored some of the tests here. I still don’t think they’re great tests, but they’re a little more Pythonic now at least. I also added a sort by template type, so that the order is deterministic when you have, for example, an email template and a text message template with the same name. If you have two text message templates with the same name you’re on your own.