[openstreetmap/openstreetmap-website] Microcosms microcosms (PR #3683)
Brian DeRocher
notifications at github.com
Sat Sep 10 20:29:59 UTC 2022
Since the first PR (#2390) was too large, this is "take two".
This is the first of four PRs. Here we focus on just the microcosm resource.
To see the partitioning of the entire feature, see https://wiki.openstreetmap.org/wiki/Microcosms. Feedback welcome on both this PR and the wiki page.
Mostly standard Rails stuff, but here are some highlights:
* micrososms have a friendly url (aka slug) /microcosm/greater_dc_area based on the name of the microcosm
* microcosms have 1 organizer at this time
* access control for updating your microcosm is controlled by cancancan
* area of influence is established by zooming in on a map
* some code is already factored out because later stages will also use the same functions
* spammy microcosms may be reported
This PR does not yet have the UI for creating links to external resources.
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/openstreetmap-website/pull/3683
-- Commit Summary --
* Add microcosm model and controller (show, show_by_key) and tests.
* Create the edit handler, but it doesn't do anything yet. Guests may not edit.
* Guest can also show_by_key.
* Remove trailing space.
* Add a list of all miccrocosms.
* bundle install friendly_id for slugs.
* Replace show_by_key with using friendly_id slugs.
* Convert Facebook and Twitter links into has_many links.
* Add location to microcosms.
* Admins can create and edit microcosms.
* Move the "new" microcosm link to the header.
* Microcosm row layout
* Remove empty files.
* Removed disabled code.
* When the creation save fails, send the user back to the form.
* StrongMigrations is a module.
* erblint
* Forgot to commit this file.
* Set not null on microcosm.{description,slug} and link attributes.
* Move styles to stylesheets.
* Remove disabled code.
* Replace link to geofabrik with TODO item.
* rubocop
* Use save not save!.
* find_or_initialize! should be find_or_initialize.
* Add missing NOT NULL constraints FK constraints.
* Translate all the things.
* Correcting a mistake. This table should have been created with min/max lat/lon as integer.
* Change lat and lon from decimal to integer.
* Replace hardcoded image of map with a leaflet map.
* Replace .flex_row with bootsrap row which is also flex-based.
* erblint fix
* Header should contain the name of the microcosm.
* Rename lat to latitude, lon to longitude, convert all coords to floats.
* Replace hard coded changesets with real ones.
* Add some validation and model testing for microcosms.
* Rename microcosm_valid() to validate() in order to bring out the similarity of this method.
* whitespace
* Add validation and model test for microcosm_link.
* Add validation for microcosm locations.
* Microcosm descriptions are not allowed to be nil/empty.
* Add missing entry for microcosms in compact-secondary-nav
* allow anyone to create a microcosm. For now?
* rubocop got pissy about indentation
* Move microcosm :new, :create to non-admin.
* Add instruction, all fields are required.
* add hint for location
* Order microcosms by longitude.
* Remove inline javascript to comply with CSP. Move that logic to microcosms.js.
* Add a bunch of tests for microcosm_controller.
* test microcosm update
* Add more tests. I prefer @title so templates don't need to call functions like t().
* This test can now run as plain user not administrator.
* Make the forms look like the rest of the website.
* Make microcosm index look better. Move edit link
* Factor out showMap code which will be used on multiple pages.
* Modify UI for mobile.
* Factor out formMapInput.
* Display if the changeset has review_requested.
* Sort by longitude and time of day
* Rubocop said replace content_tag with tag.
* Use tag (in place of content_tag) correctly.
* Don't pollute the global namespace.
* Subject: [PATCH 208/280] Improve error messages for microcosm controller and
* Add tests for controller when failures happen.
* Adapt to rubocop. In tests factor out some WET code into helper methods.
* Format these coords better.
* Rubocop cleanups
* Subject: [PATCH 237/280] Normalize longitude input before using it.
* Add an organizer to the microcosm.
* Allow users to report a microcosm.
* Get tests working by not using :controller/:action in tests.
* Should hav added organizer_id a while ago.
* Show the microcosms a user is an organizer of.
* Merge remote-tracking branch 'upstream/master' into microcosms-microcosms
* Non-admins can create and edit their own microcosms.
-- File Changes --
M Gemfile (4)
M Gemfile.lock (7)
M app/abilities/ability.rb (3)
M app/assets/javascripts/application.js (74)
A app/assets/javascripts/microcosms.js (18)
A app/assets/stylesheets/microcosms.scss (22)
M app/controllers/issues_controller.rb (2)
A app/controllers/microcosms_controller.rb (93)
M app/controllers/reports_controller.rb (2)
M app/helpers/issues_helper.rb (4)
M app/models/client_application.rb (1)
M app/models/issue.rb (2)
A app/models/microcosm.rb (50)
A app/models/microcosm_link.rb (21)
M app/models/report.rb (1)
M app/models/user.rb (2)
M app/views/layouts/_header.html.erb (4)
A app/views/microcosms/_empty_list.html.erb (1)
A app/views/microcosms/_form.html.erb (33)
A app/views/microcosms/_index_list.html.erb (25)
A app/views/microcosms/edit.html.erb (3)
A app/views/microcosms/index.html.erb (16)
A app/views/microcosms/new.html.erb (5)
A app/views/microcosms/of_user.html.erb (7)
A app/views/microcosms/show.html.erb (69)
M app/views/users/show.html.erb (6)
A config/initializers/friendly_id.rb (107)
M config/locales/en.yml (64)
M config/routes.rb (4)
A db/migrate/20210517030520_create_microcosms.rb (14)
A db/migrate/20220820220545_create_friendly_id_slugs.rb (14)
A db/migrate/20220820220849_add_slug_to_microcosms.rb (16)
A db/migrate/20220820221326_remove_key_from_microcosms.rb (5)
A db/migrate/20220821143545_create_microcosm_links.rb (11)
A db/migrate/20220821144427_remove_facebook_and_twitter_from_microcosms.rb (6)
A db/migrate/20220821154547_add_location_to_microcosms.rb (17)
M db/structure.sql (217)
M test/abilities/abilities_test.rb (21)
A test/controllers/microcosms_controller_test.rb (269)
A test/factories/microcosm_links.rb (7)
A test/factories/microcosms.rb (14)
M test/models/issue_test.rb (5)
A test/models/microcosm_link_test.rb (21)
A test/models/microcosm_test.rb (84)
A test/system/report_microcosm_test.rb (33)
M test/test_helper.rb (13)
-- Patch Links --
https://github.com/openstreetmap/openstreetmap-website/pull/3683.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3683.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3683
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3683 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220910/fd421a6d/attachment-0001.htm>
More information about the rails-dev
mailing list