From 4dcfcbdc45f57d0e89e5fa76e409f32c027291be Mon Sep 17 00:00:00 2001 From: serversdown Date: Fri, 15 May 2026 06:36:55 +0000 Subject: [PATCH] feat(projects): reusable location-map partial + add map to Vibration tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The map sidebar that replaced Upcoming Actions on the project overview is now also on the deeper Vibration tab — operators get the same spatial context when they drill into vibration monitoring locations. Refactor - New partial templates/partials/projects/location_map.html. Self-contained: includes the map div + a self-fetch script that pulls coords from /api/projects/{p}/locations-json on load. Accepts: - project_id (required) - map_height (default "320px") - location_type ('vibration' | 'sound' | none = all) - project_dashboard.html: ~150 lines of inline map JS deleted, replaced with {% include 'partials/projects/location_map.html' %}. Identical behavior, less duplication. - projects/detail.html Vibration tab: locations list converted to a 2/3 + 1/3 grid; right column hosts the same map partial filtered to location_type=vibration with a taller 450px viewport. Bidirectional hover-highlight (card ↔ pin) works on both surfaces since the partial registers its own document-level mouseover/mouseout handlers. Co-Authored-By: Claude Opus 4.7 --- templates/partials/projects/location_map.html | 159 +++++++++++++++ .../partials/projects/project_dashboard.html | 182 ++---------------- templates/projects/detail.html | 41 ++-- 3 files changed, 199 insertions(+), 183 deletions(-) create mode 100644 templates/partials/projects/location_map.html diff --git a/templates/partials/projects/location_map.html b/templates/partials/projects/location_map.html new file mode 100644 index 0000000..d9c9fde --- /dev/null +++ b/templates/partials/projects/location_map.html @@ -0,0 +1,159 @@ + +
+
+

Location Map

+ +
+
+
+ + +
+ + diff --git a/templates/partials/projects/project_dashboard.html b/templates/partials/projects/project_dashboard.html index d8daf49..c4ff551 100644 --- a/templates/partials/projects/project_dashboard.html +++ b/templates/partials/projects/project_dashboard.html @@ -78,173 +78,19 @@ - -
- - -
- - -
+ {# Location map — uses the reusable partial that fetches from + /api/projects/{p}/locations-json. Same render is reused on the + deeper Vibration tab so both surfaces stay in sync. #} + {% with project_id=project.id %} + {% include 'partials/projects/location_map.html' %} + {% endwith %} - +{% if upcoming_actions %} + +{% endif %} diff --git a/templates/projects/detail.html b/templates/projects/detail.html index 4f75550..ba971f3 100644 --- a/templates/projects/detail.html +++ b/templates/projects/detail.html @@ -101,22 +101,33 @@ -
-
-

Monitoring Locations

- +
+
+
+

Monitoring Locations

+ +
+
+
Loading locations...
+
-
-
Loading locations...
+ + {# Reusable location map — fetches from /locations-json + on its own. Hovering any of the location cards on the + left highlights the matching pin on this map. #} +
+ {% with project_id=project_id, location_type='vibration', map_height='450px' %} + {% include 'partials/projects/location_map.html' %} + {% endwith %}