Skip to content

Commit 34ff882

Browse files
committed
Enables zoom-to-all and gazetteer on more maps
1 parent 3cf9ca0 commit 34ff882

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3939
- Dashed line styling for clear visual distinction
4040
- Click to view region details and navigate to regional feeds
4141
- Integrated with feed landing pages showing region outlines
42+
- **Zoom-to-all features control** - Quick navigation button on all maps:
43+
- Expands view to fit all publications in the current context
44+
- Available on main map, feed landing pages, and work landing pages
45+
- Accessible button with screen reader support
46+
- Uses FontAwesome expand icon for visual clarity
4247
- **Geocoding/gazetteer search** - Map search functionality allowing users to search for locations by name:
4348
- Nominatim geocoder integration (default)
4449
- Optional GeoNames support (requires username configuration)
4550
- Search results displayed on map with zoom to location
4651
- Accessible via search box in map interface
52+
- Available on feed landing pages and work landing pages for consistent navigation
4753
- **Works list with pagination** - Browse all works page at `/works/list/` with:
4854
- Configurable pagination (default 50 items per page)
4955
- User-selectable page size with min/max limits

works/templates/feed_page.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<!-- Leaflet -->
99
<link rel="stylesheet" href="{% static 'css/leaflet.css' %}" />
1010
<script src="{% static 'js/leaflet.js' %}"></script>
11+
12+
<!-- Leaflet Control Geocoder (Gazetteer) -->
13+
<link rel="stylesheet" href="{% static 'css/leaflet.control.geocoder.css' %}" />
14+
<script src="{% static 'js/leaflet.control.geocoder.js' %}"></script>
1115
{% endblock head %}
1216

1317
{% block content %}
@@ -129,6 +133,8 @@ <h3>About this feed</h3>
129133
{{ block.super }}
130134
<script src="{% static 'js/map-popup.js' %}"></script>
131135
<script src="{% static 'js/map-interaction.js' %}"></script>
136+
<script src="{% static 'js/map-gazetteer.js' %}"></script>
137+
<script src="{% static 'js/map-zoom-to-all.js' %}"></script>
132138
<script type="text/javascript">
133139
// Initialize map with publications
134140
$(document).ready(function() {
@@ -183,6 +189,21 @@ <h3>About this feed</h3>
183189
// Default view if no geometries
184190
map.setView([0, 0], 2);
185191
}
192+
193+
// Add zoom to all features control
194+
if (typeof MapZoomToAllControl !== 'undefined') {
195+
const zoomToAllControl = new MapZoomToAllControl(map, publicationsLayer);
196+
console.log('Zoom to all features control enabled on feed page');
197+
}
198+
199+
// Add gazetteer (location search) control
200+
if (typeof MapGazetteerManager !== 'undefined') {
201+
const gazetteerManager = new MapGazetteerManager(map, {
202+
provider: '{{ gazetteer_provider|default:"nominatim" }}',
203+
placeholder: 'Search for a location...'
204+
});
205+
console.log('Gazetteer search enabled on feed page');
206+
}
186207
});
187208
</script>
188209
{% endblock scripts %}

works/templates/work_landing_page.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ <h6 class="font-weight-bold mb-3">Wikidata Export History</h6>
152152
{% endif %}
153153
<!-- Leaflet Fullscreen plugin -->
154154
<link rel="stylesheet" href="{% static 'css/leaflet.fullscreen.css' %}">
155+
<!-- Leaflet Control Geocoder (Gazetteer) -->
156+
<link rel="stylesheet" href="{% static 'css/leaflet.control.geocoder.css' %}" />
155157

156158
{% if can_contribute %}
157159
<div class="alert alert-warning">
@@ -242,7 +244,10 @@ <h6 class="font-weight-bold"><i class="fas fa-calendar"></i> Temporal extent (ti
242244
{% endif %}
243245
<!-- Leaflet Fullscreen plugin -->
244246
<script src="{% static 'js/leaflet.fullscreen.js' %}"></script>
245-
<!-- Zoom to all features control -->
247+
<!-- Leaflet Control Geocoder (Gazetteer) -->
248+
<script src="{% static 'js/leaflet.control.geocoder.js' %}"></script>
249+
<!-- Map controls -->
250+
<script src="{% static 'js/map-gazetteer.js' %}"></script>
246251
<script src="{% static 'js/map-zoom-to-all.js' %}"></script>
247252
<script>
248253
const publicationFeature = {{ feature_json|default:"null"|safe }};
@@ -544,6 +549,15 @@ <h6 class="font-weight-bold"><i class="fas fa-calendar"></i> Temporal extent (ti
544549
const zoomToAllControl = new MapZoomToAllControl(map, featureGroup);
545550
console.log('Zoom to all features control enabled on mini-map');
546551
}
552+
553+
// Add gazetteer (location search) control
554+
if (typeof MapGazetteerManager !== 'undefined') {
555+
const gazetteerManager = new MapGazetteerManager(map, {
556+
provider: '{{ gazetteer_provider|default:"nominatim" }}',
557+
placeholder: 'Search for a location...'
558+
});
559+
console.log('Gazetteer search enabled on work landing page');
560+
}
547561
</script>
548562

549563
<p class="muted">

0 commit comments

Comments
 (0)