Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ twig:
form_themes: ['bootstrap_4_layout.html.twig']
globals:
mapbox_access_token: '%env(MAPBOX_ACCESS_TOKEN)%'
homebase_lat: '%env(float:HOME_BASE_LAT)%'
homebase_lng: '%env(float:HOME_BASE_LNG)%'
settings: '@App\Service\SettingsService'

date:
Expand Down
2 changes: 1 addition & 1 deletion public/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var streetMap;
var satelliteMap;


var base = L.latLng(51.4511364, -2.6219148);
var base = L.latLng($("#mapid").data("homebaseLat"), $("#mapid").data("homebaseLng"));

function setUpMap(options)
{
Expand Down
4 changes: 4 additions & 0 deletions templates/_mapattributes.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

data-homebase-lat="{{ homebase_lat }}"
data-homebase-lng="{{ homebase_lng }}"
data-mapbox-access-token="{{ mapbox_access_token }}"
2 changes: 1 addition & 1 deletion templates/admin/image/cluster.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% block body %}
<h1>Image Cluster Experiment</h1>
{# TODO Don't hardcode the height #}
<div id="mapid" style="height: 500px; height: 70vh;" data-mapbox-access-token="{{ mapbox_access_token }}" ></div>
<div id="mapid" style="height: 500px; height: 70vh;" {{ include('/_mapattributes.html.twig') }}" ></div>
<div id="debug"></div>
{% endblock %}
{% block javascripts %}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/wander/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

<hr/>
<h2 class="mt-2">Map</h2>
<div id="mapid" style="height: 500px" data-mapbox-access-token="{{ mapbox_access_token }}" ></div>
<div id="mapid" style="height: 500px" {{ include('/_mapattributes.html.twig') }} ></div>
<hr/>
<h2 class="mt-2">Wander Images</h2>
{{ include('admin/wander/_delete_images_form.html.twig') }}
Expand Down
2 changes: 1 addition & 1 deletion templates/experimental/imagecluster.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% block body %}
<h1>Image Cluster Experiment</h1>
{# TODO Don't hardcode the height #}
<div id="mapid" style="height: 500px; height: 70vh;" data-mapbox-access-token="{{ mapbox_access_token }}" ></div>
<div id="mapid" style="height: 500px; height: 70vh;" {{ include('/_mapattributes.html.twig') }} ></div>
<div id="debug"></div>
{% endblock %}
{% block javascripts %}
Expand Down
6 changes: 5 additions & 1 deletion templates/home/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
</div>
<div class="row flex-fill d-flex">
<div class="col-sm">
<div class="h-100" id="mapid" data-mapbox-access-token="{{ mapbox_access_token }}" ></div>
<div
class="h-100"
id="mapid"
{{ include('/_mapattributes.html.twig') }}
</div>
</div>
</div>
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion templates/wander/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</div>
{# TODO: Move this hardcoded style into the CSS. It's a 80% viewport height
with a fallback of a hardcoded pixel value for older browsers #}
<div id="mapid" style="height: 500px; height: 70vh;" data-mapbox-access-token="{{ mapbox_access_token }}" ></div>
<div id="mapid" style="height: 500px; height: 70vh;" {{ include('/_mapattributes.html.twig') }} ></div>
<div class="row mt-3 align-items-center gallery">
{% for image in image_pagination %}
<div class="col-lg-3 col-md-4 col-6 gallery-image-wrapper">
Expand Down