summaryrefslogtreecommitdiff
path: root/horizon/test/templates/base.html
blob: d3379035ebc98c64fc0800df29a938792d8fba94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!--
  This is the base html used by Python unit tests which are
  just testing Django templating - no Javascript.
-->
<html>
<head>
  <script>
    window.STATIC_URL = '{{ STATIC_URL }}';
    window.WEBROOT = '{{ WEBROOT }}';
  </script>
    <script src='{{ STATIC_URL }}horizon/lib/jquery/jquery.js' type='text/javascript' charset="utf-8"></script>
    <script src='{{ STATIC_URL }}horizon/lib/jquery-ui/ui/jquery-ui.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/jquery/jquery.tablesorter.js"></script>
    <script src="{{ STATIC_URL }}horizon/lib/angular/angular.js" type="text/javascript" charset="utf-8"></script>

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

    <script type='text/javascript' charset='utf-8'>
      (function (global) {
        'use strict';

        // 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 */
        global.horizonPlugInModules = {{ HORIZON_CONFIG.angular_modules|default:"[]"|safe }};

        /* Storage for backend configuration variables which the frontend
         * should be aware of.
         */
        var conf = horizon.conf;
        conf.static_url = "{{ STATIC_URL }}";
        conf.ajax = {
          queue_limit: {{ HORIZON_CONFIG.ajax_queue_limit|default:"null" }}
        };
        conf.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 }}
        };
        conf.disable_password_reveal =
          {{ HORIZON_CONFIG.disable_password_reveal|yesno:"true,false" }};

        // minimal cookie store implementation for testing
        horizon.test_cookies = {};
        horizon.cookies = {
          put: function (key, value) { horizon.test_cookies[key] = value; },
          getRaw: function (key) { return horizon.test_cookies[key]; },
          get: function (key) { return horizon.test_cookies[key]; }
        };

        // Call init on DOM ready.
        $(document).ready(horizon.init);
      })(this);
    </script>

    {% include "horizon/_script_i18n.html" %}

    <script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script>
    <script src="{{ STATIC_URL }}horizon/lib/spin.js"></script>
    <script src="{{ STATIC_URL }}horizon/lib/spin.jquery.js"></script>

    <script src='{{ STATIC_URL }}horizon/js/horizon.modals.js'></script>
    <script src='{{ STATIC_URL }}horizon/js/horizon.tables.js'></script>
    <script src='{{ STATIC_URL }}horizon/js/horizon.tabs.js'></script>

    <script>
        angular.module('test_app', []).run(updateHorizon);
        updateHorizon.$inject = ['$rootScope', '$compile'];
        function updateHorizon($rootScope, $compile) {
            horizon.utils = {loadAngular: loadAngular};
            function loadAngular(element) {
              $compile(element)($rootScope);
              $rootScope.$apply();
            }
        }
    </script>
</head>



<body ng-app="test_app">

{% block sidebar %}
  {% include 'horizon/common/_sidebar.html' %}
{% endblock %}

{% block content %}
  {% block main %}{% endblock %}
{% endblock %}

</body>
</html>