{% if DEBUG_STATIC %}
<script src="{{ STATIC_URL }}lib/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}lib/js/angular.js"></script>
<script src="{{ STATIC_URL }}lib/js/angular-leaflet-directive.min.js"></script>
{% endif %}

{% if include_spatial == 'true' %}
<style>
  .filter-map-container {  /* filter map */
    height: 300px;
  }
</style>

{% include 'search/_spatial_tags.html' %}

{% endif %}
<script src="{{ STATIC_URL }}geonode/js/search/explore.js"></script>
<script src="{{ STATIC_URL }}geonode/js/search/search.js"></script>
<script type="text/javascript">
  $("body").attr('ng-controller', 'geonode_search_controller');
  CATEGORIES_ENDPOINT = '{% url 'api_dispatch_list' api_name='api' resource_name='categories' %}';
  KEYWORDS_ENDPOINT = '{% url 'api_dispatch_list' api_name='api' resource_name='keywords' %}';
  REGIONS_ENDPOINT = '{% url 'api_dispatch_list' api_name='api' resource_name='regions' %}';
  HAYSTACK_SEARCH = "{{ HAYSTACK_SEARCH }}".toLowerCase() === "true";
  HAYSTACK_FACET_COUNTS = "{{ HAYSTACK_FACET_COUNTS }}".toLowerCase() === "true";
  CLIENT_RESULTS_LIMIT = {{ CLIENT_RESULTS_LIMIT }};
  AUTOCOMPLETE_URL_RESOURCEBASE = '{% url "autocomplete_light_autocomplete" "ResourceBaseAutocomplete" %}';
  AUTOCOMPLETE_URL_REGION = '{% url "autocomplete_light_autocomplete" "RegionAutocomplete" %}';

  var module = angular.module('search', ['geonode_main_search']);
  module.constant('Configs', {
    url: SEARCH_URL
  });

  var deps = ['search'];
  {% if include_spatial == 'true' %}
  deps.push('leaflet-directive');
  {% endif %}
  angular.bootstrap(document, deps);
</script>
