{% load compress %}
{% load datepicker_locale from horizon %}

{% datepicker_locale as DATEPICKER_LOCALE %}

{% compress js %}
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.js' type='text/javascript' charset="utf-8"></script>
<script src='{{ STATIC_URL }}horizon/lib/jquery/jquery-migrate.js' type='text/javascript' charset="utf-8"></script>
<script src="{{ STATIC_URL }}horizon/lib/angular/angular.js" type="text/javascript" charset="utf-8"></script>
<script src="{{ STATIC_URL }}horizon/lib/angular/angular-bootstrap.js" type="text/javascript" charset="utf-8"></script>

<script src='{{ STATIC_URL }}horizon/js/horizon.js' type='text/javascript' charset='utf-8'></script>
{% endcompress %}

<script type='text/javascript' charset='utf-8'>
    // make translation info available on client
    horizon.languageCode = '{{ LANGUAGE_CODE }}';
    horizon.languageBidi = '{{ LANGUAGE_BIDI }}';
    horizon.datepickerLocale = '{{ DATEPICKER_LOCALE }}';
    /* Load angular modules extensions list before we include angular/horizon.js */
    var angularModuleExtension = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};
</script>

{% compress js %}
<script src='{{ STATIC_URL }}horizon/js/angular/horizon.js' type='text/javascript' charset='utf-8'></script>
{% endcompress %}

<script type='text/javascript' charset='utf-8'>
/* Storage for backend configuration variables which the frontend
 * should be aware of.
 */
angular.module('hz')
  .config(['hzConfig', function (hzConfig) {
    hzConfig.debug = {{ debug|yesno:"true,false" }};
    hzConfig.static_url = "{{ STATIC_URL }}";
    hzConfig.ajax = {
      queue_limit: {{ HORIZON_CONFIG.ajax_queue_limit|default:"null" }}
    };
    hzConfig.auto_fade_alerts = {
      delay: {{ HORIZON_CONFIG.auto_fade_alerts.delay|default:"3000" }},
      fade_duration: {{ HORIZON_CONFIG.auto_fade_alerts.fade_duration|default:"1500" }},
      types: {{ HORIZON_CONFIG.auto_fade_alerts.types|default:"[]"|safe }}
    };
    hzConfig.disable_password_reveal = {{ HORIZON_CONFIG.disable_password_reveal|yesno:"true,false" }};
}]);

/* fix standard carousel */
angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
.controller('CarouselController', ['$scope', '$timeout', '$transition', '$q', function ($scope, $timeout, $transition, $q) {
}]).directive('carousel', [function() { 
    return { }
}]);

</script>