{% extends "admin/change_form.html" %}
{% load static %}
{# Overriding default template for the Venue change form, so we can include
the below CSS and JS. #}

{% block extrastyle %}
  {{ block.super }}

  {% if SPECTATOR_MAPS and SPECTATOR_MAPS.enable and SPECTATOR_MAPS.library == "mapbox" %}
    <style type="text/css">
      .spectator-marker {
        background-image: url("{% static "img/map-marker.png" %}");
        background-size: cover;
        width: 58px;
        height: 41px;
        cursor: pointer;
      }
    </style>
  {% endif %}
{% endblock extrastyle %}


{% block footer %}
  {{ block.super }}

  {% if SPECTATOR_MAPS and SPECTATOR_MAPS.enable %}
    {# Best way of putting the config dict into a JS variable. #}
    {{ SPECTATOR_MAPS|json_script:"spectator-maps-config" }}
    <script>
      var spectator_map_config = JSON.parse(
        document.getElementById("spectator-maps-config").textContent
      );
    </script>

    {% if SPECTATOR_MAPS.library == "mapbox" %}
      <script>
        mapboxgl.accessToken = "{{ SPECTATOR_MAPS.api_key|escapejs }}";
      </script>
    {% endif %}
  {% endif %}
{% endblock footer %}
