-
Notifications
You must be signed in to change notification settings - Fork 2
Add map resources #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add map resources #215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds map visualization functionality for place-resource events on resource pages. When a resource has associated place-resource events with geographic data, a map is rendered showing all the relevant locations. The PR also includes a significant refactoring of the JavaScript map code to make it more modular and reusable.
- Adds map rendering for place-resource events on resource pages
- Refactors map.js into reusable functions with better organization
- Adds new
sometemplate filter to check for keys in lists - Extends PlacesResourceEvents model to include place geometry in query results
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| TEKDB/explore/views.py | Added logic to detect place-resource relationships with maps and load map context variables |
| TEKDB/explore/templatetags/explore_tags.py | Added some filter to check if any item in a list has a specified key |
| TEKDB/explore/templates/results.html | Removed unused tile_view.js script reference |
| TEKDB/explore/templates/record.html | Added map rendering for place-resource events when viewing resources |
| TEKDB/explore/templates/places-resources-map.html | New template for rendering place-resource event maps |
| TEKDB/explore/templates/js/map.js | Major refactoring into reusable functions; added place-resource map functionality |
| TEKDB/explore/static/explore/js/tile_view.js | Deleted unused commented-out code |
| TEKDB/explore/static/explore/js/results.js | Code formatting improvements (quotes, spacing consistency) |
| TEKDB/explore/static/explore/css/map.css | Added styles for place-resource-map element |
| TEKDB/TEKDB/tests/test_models.py | Added tests for PlacesResourceEvents map inclusion logic |
| TEKDB/TEKDB/models.py | Extended PlacesResourceEvents.get_query_json() to include place geometry |
Comments suppressed due to low confidence (1)
TEKDB/explore/templates/js/map.js:149
- [nitpick] Missing spaces around operators for consistency. Add spaces around
*,-, and+operators:
let lat_buffer = lat_total * buffer;
let lon_buffer = lon_total * buffer;
return [
extent[0] - lat_buffer,
extent[1] - lon_buffer,
extent[2] + lat_buffer,
extent[3] + lon_buffer,
]; let lat_buffer = lat_total*buffer;
let lon_buffer = lon_total*buffer;
return [
extent[0]-lat_buffer,
extent[1]-lon_buffer,
extent[2]+lat_buffer,
extent[3]+lon_buffer,
];
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| filter_categories = "" | ||
| for (var i=0; i < this.categories().length; i++) { | ||
| this.loadResults = function (result) { | ||
| filter_categories = ""; |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable filter_categories is used like a local variable, but is missing a declaration.
| filter_categories = ""; | |
| let filter_categories = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to ignore any issues in this file as all of the changes are from prettier.
| this.paginated_results = ko.observableArray([]); | ||
| this.categories = ko.observableArray(['all']); | ||
| this.db_query = ko.observable('*'); | ||
| this.categories = ko.observableArray(["all"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are all prettier changes and can be ignored!
asana task
Description
Adds a map above all place-resource events that shows all place-resources events. This means that if there are multiple places for a resource, the map shows all of them. The map extent is set to contain all of the places. A map for place-resource events does not appear on a place page, only resource pages.
I also took the opportunity to clean up and organize
TEKDB/explore/templates/js/map.js. I tried to make more reusable functions for the map that appears on a place page and the map for place-resource events on the resource pages.Curious if folks have feedback on having a single map for all place-resource events? Also, any feedback on the maps location on the page?
Screenshots