Skip to content

Commit

Permalink
Show all places enclosed by a featured place on the map. (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra authored Dec 27, 2023
1 parent 3c27ff6 commit 547f352
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
</div>

<div class="featured-entity-feature">
{% with entities = [entity], map_hides_list = True, featured = False %}
{% include ['entity/list--place.html.j2', 'entity/list.html.j2'] %}
{% endwith %}
{% set places = entity | walk('encloses') | select('place_entity') | list %}
{% if entity.coordinates %}
{% set places = places + [entity] %}
{% endif %}
{% if places | length > 0 %}
{% with entities = places, hide_list = True, featured = False %}
{% include ['entity/list--place.html.j2', 'entity/list.html.j2'] %}
{% endwith %}
{% endif %}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% if 'betty.extension.Maps' in app.extensions and entities | rejectattr('coordinates', 'none') | list | length > 0 %}
<div class="{% if featured %}featured {% endif %}map"></div>
{% endif %}
<ul class="entities{% if map_hides_list | default(false) %} js-visually-hidden{% endif %}">
<ul class="entities{% if hide_list | default(false) %} visually-hidden{% endif %}{% if map_hides_list | default(false) %} js-visually-hidden{% endif %}">
{% for place in entities | sort_localizeds(localized_attribute='names', sort_attribute='name') %}
<li class="{{ loop.cycle('odd', 'even') }}" data-betty-place="{{ place | url(media_type='application/json') }}">
{% with entity = place %}
Expand Down

0 comments on commit 547f352

Please sign in to comment.