[openstreetmap/openstreetmap-website] Refactor notes to use resourceful routing (PR #3911)
Andy Allan
notifications at github.com
Thu Jan 26 11:56:02 UTC 2023
This PR refactors the two notes routes, namely:
* browse#new_note -> notes#new
* browse#note -> notes#show
This brings them into line with resourceful routing naming conventions.
The PR is slightly more complex than I anticipated, since the api methods for notes was already hogging the `notes` resourceful routing (e.g. `note_path` was used for /api/0.6/notes/123), so I renamed that to `api_notes` which is a convention already used for other models that have both api and non-api paths. Secondly, the i18n needed a little bit of unpicking, since the views were using fully qualified instead of relative translation strings. And finally, a surprising number of other tests use notes as examples (e.g. for reporting users) and so they needed updating too (e.g. to use `note_path` instead of `browse_note_path`).
Refs #3831
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/3911
-- Commit Summary --
* Rename api_notes resource to avoid conflict with non-API resource
* Move browse#new_note to notes#new
* Move browse#note to notes#show
* Refactor translation strings for notes
-- File Changes --
M app/abilities/ability.rb (3)
M app/controllers/browse_controller.rb (14)
M app/controllers/notes_controller.rb (22)
M app/controllers/site_controller.rb (2)
M app/helpers/issues_helper.rb (2)
M app/helpers/note_helper.rb (4)
M app/mailers/user_mailer.rb (2)
M app/views/api/notes/_note.gpx.builder (12)
M app/views/api/notes/_note.json.jbuilder (8)
M app/views/api/notes/_note.rss.builder (4)
M app/views/api/notes/_note.xml.builder (8)
M app/views/api/notes/feed.rss.builder (4)
D app/views/browse/new_note.html.erb (17)
M app/views/notes/index.html.erb (2)
A app/views/notes/new.html.erb (17)
R app/views/notes/show.html.erb (20)
M config/locales/en.yml (66)
M config/routes.rb (6)
M test/controllers/api/notes_controller_test.rb (244)
M test/controllers/browse_controller_test.rb (86)
M test/controllers/notes_controller_test.rb (124)
M test/controllers/site_controller_test.rb (2)
M test/system/index_test.rb (6)
M test/system/report_note_test.rb (12)
M test/system/report_user_test.rb (2)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/3911.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3911.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3911
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3911 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230126/3359d31c/attachment-0001.htm>
More information about the rails-dev
mailing list