Skip to content

Conversation

@paigewilliams
Copy link
Contributor

@paigewilliams paigewilliams commented Nov 12, 2025

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

Screenshot 2025-11-12 at 3 08 33 PM Screenshot 2025-11-12 at 3 14 28 PM

Copy link
Contributor

Copilot AI left a 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 some template 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 = "";
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
filter_categories = "";
let filter_categories = "";

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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"]);
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants