From cc42428d24e26fbeb6cb13186a31df4ba0129752 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sat, 6 Dec 2025 19:53:20 +0100 Subject: [PATCH] Update routing --- .../leaflet_controller.rb} | 2 +- .../{maps => map}/maplibre_controller.rb | 2 +- app/controllers/maps_controller.rb | 5 ----- app/helpers/application_helper.rb | 4 ++-- .../map/{ => leaflet}/_settings_modals.html.erb | 0 app/views/map/{ => leaflet}/index.html.erb | 2 +- .../maplibre/_area_creation_modal.html.erb | 0 .../maplibre/_settings_panel.html.erb | 0 .../maplibre/_visit_creation_modal.html.erb | 0 app/views/{maps => map}/maplibre/index.html.erb | 6 +++--- app/views/shared/map/_date_navigation_v2.html.erb | 12 ++++++------ config/routes.rb | 15 +++++---------- e2e/setup/auth.setup.js | 4 ++-- e2e/v2/helpers/setup.js | 2 +- e2e/v2/map/area-selection.spec.js | 2 +- e2e/v2/map/core.spec.js | 8 ++++---- e2e/v2/map/interactions.spec.js | 2 +- e2e/v2/map/layers/advanced.spec.js | 4 ++-- e2e/v2/map/layers/heatmap.spec.js | 2 +- e2e/v2/map/layers/points.spec.js | 2 +- e2e/v2/map/layers/routes.spec.js | 2 +- e2e/v2/map/performance.spec.js | 4 ++-- e2e/v2/map/search.spec.js | 2 +- e2e/v2/map/settings.spec.js | 2 +- spec/requests/authentication_spec.rb | 2 +- 25 files changed, 38 insertions(+), 48 deletions(-) rename app/controllers/{map_controller.rb => map/leaflet_controller.rb} (97%) rename app/controllers/{maps => map}/maplibre_controller.rb (98%) delete mode 100644 app/controllers/maps_controller.rb rename app/views/map/{ => leaflet}/_settings_modals.html.erb (100%) rename app/views/map/{ => leaflet}/index.html.erb (96%) rename app/views/{maps => map}/maplibre/_area_creation_modal.html.erb (100%) rename app/views/{maps => map}/maplibre/_settings_panel.html.erb (100%) rename app/views/{maps => map}/maplibre/_visit_creation_modal.html.erb (100%) rename app/views/{maps => map}/maplibre/index.html.erb (91%) diff --git a/app/controllers/map_controller.rb b/app/controllers/map/leaflet_controller.rb similarity index 97% rename from app/controllers/map_controller.rb rename to app/controllers/map/leaflet_controller.rb index 622f8112..2c5e2672 100644 --- a/app/controllers/map_controller.rb +++ b/app/controllers/map/leaflet_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class MapController < ApplicationController +class Map::LeafletController < ApplicationController before_action :authenticate_user! layout 'map', only: :index diff --git a/app/controllers/maps/maplibre_controller.rb b/app/controllers/map/maplibre_controller.rb similarity index 98% rename from app/controllers/maps/maplibre_controller.rb rename to app/controllers/map/maplibre_controller.rb index 302f3a54..506eb733 100644 --- a/app/controllers/maps/maplibre_controller.rb +++ b/app/controllers/map/maplibre_controller.rb @@ -1,4 +1,4 @@ -module Maps +module Map class MaplibreController < ApplicationController before_action :authenticate_user! layout 'map' diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb deleted file mode 100644 index efbb024f..00000000 --- a/app/controllers/maps_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MapsController < ApplicationController - def index - redirect_to maps_v2_path - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 16f117bb..3f5bc50a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -144,9 +144,9 @@ module ApplicationHelper end def preferred_map_path - return map_path unless user_signed_in? + return map_v1_path unless user_signed_in? preferred_version = current_user.safe_settings.maps&.dig('preferred_version') - preferred_version == 'v2' ? maps_v2_path : map_path + preferred_version == 'v2' ? map_v2_path : map_v1_path end end diff --git a/app/views/map/_settings_modals.html.erb b/app/views/map/leaflet/_settings_modals.html.erb similarity index 100% rename from app/views/map/_settings_modals.html.erb rename to app/views/map/leaflet/_settings_modals.html.erb diff --git a/app/views/map/index.html.erb b/app/views/map/leaflet/index.html.erb similarity index 96% rename from app/views/map/index.html.erb rename to app/views/map/leaflet/index.html.erb index 6b506660..1086601b 100644 --- a/app/views/map/index.html.erb +++ b/app/views/map/leaflet/index.html.erb @@ -29,7 +29,7 @@ -<%= render 'map/settings_modals' %> +<%= render 'map/leaflet/settings_modals' %> <%= render 'shared/place_creation_modal' %> diff --git a/app/views/maps/maplibre/_area_creation_modal.html.erb b/app/views/map/maplibre/_area_creation_modal.html.erb similarity index 100% rename from app/views/maps/maplibre/_area_creation_modal.html.erb rename to app/views/map/maplibre/_area_creation_modal.html.erb diff --git a/app/views/maps/maplibre/_settings_panel.html.erb b/app/views/map/maplibre/_settings_panel.html.erb similarity index 100% rename from app/views/maps/maplibre/_settings_panel.html.erb rename to app/views/map/maplibre/_settings_panel.html.erb diff --git a/app/views/maps/maplibre/_visit_creation_modal.html.erb b/app/views/map/maplibre/_visit_creation_modal.html.erb similarity index 100% rename from app/views/maps/maplibre/_visit_creation_modal.html.erb rename to app/views/map/maplibre/_visit_creation_modal.html.erb diff --git a/app/views/maps/maplibre/index.html.erb b/app/views/map/maplibre/index.html.erb similarity index 91% rename from app/views/maps/maplibre/index.html.erb rename to app/views/map/maplibre/index.html.erb index c0e33add..9d6bc8ac 100644 --- a/app/views/maps/maplibre/index.html.erb +++ b/app/views/map/maplibre/index.html.erb @@ -36,13 +36,13 @@ - <%= render 'maps/maplibre/settings_panel' %> + <%= render 'map/maplibre/settings_panel' %> - <%= render 'maps/maplibre/visit_creation_modal' %> + <%= render 'map/maplibre/visit_creation_modal' %> - <%= render 'maps/maplibre/area_creation_modal' %> + <%= render 'map/maplibre/area_creation_modal' %> <%= render 'shared/place_creation_modal' %> diff --git a/app/views/shared/map/_date_navigation_v2.html.erb b/app/views/shared/map/_date_navigation_v2.html.erb index b3262c50..15cf0756 100644 --- a/app/views/shared/map/_date_navigation_v2.html.erb +++ b/app/views/shared/map/_date_navigation_v2.html.erb @@ -17,12 +17,12 @@