base.jinja 14.3 KB
Newer Older
Skia's avatar
Skia committed
1 2
<!DOCTYPE html>
<html lang="fr">
Skia's avatar
Skia committed
3 4
    <head>
        {% block head %}
Krophil's avatar
Krophil committed
5
        <title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %} - Association des Étudiants UTBM</title>
Krophil's avatar
Krophil committed
6
        <link rel="shortcut icon" href="{{ static('core/img/favicon.ico') }}">
Skia's avatar
Skia committed
7
        <link rel="stylesheet" href="{{ static('core/base.css') }}">
Skia's avatar
Skia committed
8
        <link rel="stylesheet" href="{{ static('core/multiple-select.css') }}">
Skia's avatar
Skia committed
9
        <link rel="stylesheet" href="{{ static('core/jquery.datetimepicker.min.css') }}">
10
        <link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
Krophil's avatar
Krophil committed
11
        <link rel="stylesheet" href="{{ scss('core/style.scss') }}">
Krophil's avatar
Krophil committed
12
        <link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
Krophil's avatar
Krophil committed
13
        {% if settings.EXTERNAL_RES %}
Krophil's avatar
Krophil committed
14 15
          <noscript><link rel="stylesheet" href="https://use.fontawesome.com/775817bb35.css"></noscript>
          <script src="https://use.fontawesome.com/c06c9c6980.js"></script>
Krophil's avatar
Krophil committed
16 17
        {% else %}
          <link rel="stylesheet" href="{{ static('core/font-awesome/css/font-awesome.min.css') }}">
Krophil's avatar
Krophil committed
18
        {% endif %}
Skia's avatar
Skia committed
19 20
        {% endblock %}
    </head>
Skia's avatar
Skia committed
21

Skia's avatar
Skia committed
22
    <body>
Skia's avatar
Skia committed
23 24

        <!-- BEGIN HEADER -->
Skia's avatar
Skia committed
25
        {% block header %}
Skia's avatar
Skia committed
26
        {% if not popup %}
Skia's avatar
Skia committed
27 28 29 30 31 32 33 34
        <div id="header_language_chooser">
            {% for language in LANGUAGES %}
            <form action="{{ url('set_language') }}" method="post">{% csrf_token %}
                <input name="next" value="{{ request.path }}" type="hidden" />
                <input name="language" value="{{ language[0] }}" type="hidden" />
                <input type="submit" value="{{ language[0]|upper }}" />
            </form>
            {% endfor %}
35
        </div>
Skia's avatar
Skia committed
36

Skia's avatar
Skia committed
37 38
        <header>
            {% if not user.is_authenticated() %}
Skia's avatar
Skia committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
            <div id="header_logo" style="background-image: url('{{
                static('core/img/logo.png') }}'); width: 185px; height: 100px;">
                <a href="{{ url('core:index') }}"></a>
            </div>
            <div id="header_connect_links">
                <form method="post" action="{{ url('core:login') }}">
                {% csrf_token %}
                <label for="id_username">{% trans %}Username{% endtrans %}</label>
                    <input id="id_username" maxlength="254" name="username" type="text">
                <label for="id_password">{% trans %}Password{% endtrans %}</label>
                    <input type="password" name="password" id="id_password">
                <input type="submit" value="{% trans %}Login{% endtrans %}">
                </form>
                <a href="{{ url('core:register') }}"><button type="button">{% trans %}Register{% endtrans %}</button></a>
            </div>
Skia's avatar
Skia committed
54
            {% else %}
Skia's avatar
Skia committed
55
            <div id="header_logo" style="background-image: url('{{
Soldat's avatar
Soldat committed
56
                static('core/img/logo.png') }}'); width: 92px; height: 52px;">
Skia's avatar
Skia committed
57 58 59 60 61 62 63 64
                <a href="{{ url('core:index') }}"></a>
            </div>
            <div id="header_bar">
                <ul id="header_bars_infos">
                {% for bar in Counter.objects.filter(type="BAR").all() %}
                    <li>
                    <a href="{{ url('counter:activity', counter_id=bar.id) }}" style="padding: 0px">
                    {% if bar.is_inactive(): %}
Soldat's avatar
Soldat committed
65
                        <i class="fa fa-question" style="color: #f39c12"></i>
Skia's avatar
Skia committed
66
                    {% elif bar.is_open(): %}
Soldat's avatar
Soldat committed
67
                        <i class="fa fa-check" style="color: #2ecc71"></i>
Skia's avatar
Skia committed
68
                    {% else %}
Soldat's avatar
Soldat committed
69
                        <i class="fa fa-times" style="color: #eb2f06"></i>
Skia's avatar
Skia committed
70 71 72 73
                    {% endif %}
                        {{ bar }}
                    </a>
                    </li>
Skia's avatar
Skia committed
74
                {% endfor %}
Skia's avatar
Skia committed
75 76 77 78 79 80
                </ul>
                <form action="{{ url('core:search') }}" method="GET" id="header_search">
                    <input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" />
                    <input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" />
                </form>
                <div id="header_user_links">
Skia's avatar
Skia committed
81 82 83 84
                    <div>
                      <a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a>
                    </div>
                    <div>
Krophil's avatar
Krophil committed
85
                      <a href="#" onclick="display_notif()"><i class="fa fa-bell-o"></i> ({{ user.notifications.filter(viewed=False).count() }})</a>
Skia's avatar
Skia committed
86
                      <ul id="header_notif">
Skia's avatar
Skia committed
87
                          {% for n in user.notifications.filter(viewed=False).order_by('-date') %}
Skia's avatar
Skia committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
                          <li>
                              <a href="{{ url("core:notification", notif_id=n.id) }}">
                                  <span class="header_notif_date">
                                      {{ n.date|localtime|date(DATE_FORMAT) }}
                                  </span>
                                  <span class="header_notif_time">
                                      {{ n.date|localtime|time(DATETIME_FORMAT) }}
                                  </span>
                                  <br>
                                  {{ n }}
                              </a>
                          </li>
                          {% endfor %}
                          <li>
                              <strong>
                              <a href="{{ url('core:notification_list') }}">
                                  {% trans %}View more{% endtrans %}
                              </a>
                              <br />
                              <a href="{{ url('core:notification_list') }}?see_all">
                                  {% trans %}Mark all as read{% endtrans %}
                              </a>
                              </strong>
                          </li>
                      </ul>
                    </div>
                    <div>
                      <a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a>
                    </div>
                    <div>
                      <a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
                    </div>
Skia's avatar
Skia committed
120 121
                </div>
            </div>
Skia's avatar
Skia committed
122 123
            {% endif %}
        </header>
Skia's avatar
Skia committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139

        <div id="info_boxes">
            {% set sith = get_sith() %}
            {% if sith.alert_msg %}
            <div id="alert_box">
                {{ sith.alert_msg|markdown }}
            </div>
            {% endif %}
            {% if sith.info_msg %}
            <div id="info_box">
                {{ sith.info_msg|markdown }}
            </div>
            {% endif %}
        </div>

        {% else %}{# if not popup #}
Skia's avatar
Skia committed
140 141
        <div id="popupheader">{{ user.get_display_name() }}</div>
        {% endif %}
Skia's avatar
Skia committed
142

Skia's avatar
Skia committed
143 144 145

        {% endblock %}
        <!-- END HEADER -->
Skia's avatar
Skia committed
146

Skia's avatar
Skia committed
147 148 149 150
        <div id="page">
          {% block nav %}
          {% if not popup %}
          <nav>
151
              <a href="{{ url('core:index') }}">{% trans %}Main{% endtrans %}</a>
Sli's avatar
Sli committed
152
              <a href="{{ url('core:page', page_name='clubs') }}">{% trans %}Clubs{% endtrans %}</a>
Skia's avatar
Skia committed
153 154 155 156 157 158 159 160 161 162 163
              <a href="{{ url('matmat:search_clear') }}">{% trans %}Matmatronch{% endtrans %}</a>
              <a href="{{ url('core:page', page_name="Index") }}">{% trans %}Wiki{% endtrans %}</a>
              <a href="{{ url('sas:main') }}">{% trans %}SAS{% endtrans %}</a>
              <a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
              <a href="{{ url('core:page', "services") }}">{% trans %}Services{% endtrans %}</a>
              <a href="{{ url('core:file_list') }}">{% trans %}Files{% endtrans %}</a>
              <a href="{{ url('core:page', page_name="partenaires")}}">{% trans %}Sponsors{% endtrans %}</a>
              <a href="https://ae2.utbm.fr/article.php?name=docs:index">{% trans %}Help{% endtrans %}</a>
          </nav>
          {% endif %}
          {% endblock %}
Skia's avatar
Skia committed
164

Skia's avatar
Skia committed
165 166 167 168 169
          <ul id="quick_notif">
              {% for n in quick_notifs %}
              <li>{{ n }}</li>
              {% endfor %}
          </ul>
Skia's avatar
Skia committed
170

Skia's avatar
Skia committed
171 172
          <div id="content">
              {% if list_of_tabs %}
173
              <div class="tool_bar">
Skia's avatar
Skia committed
174 175
                  <div>{{ tabs_title }}</div>
                  <div class="tools">
176
                      {% for t in list_of_tabs -%}
Skia's avatar
Skia committed
177 178 179 180 181
                      <a href="{{ t.url }}"
                          {%- if current_tab == t.slug %}
                              class="selected_tab"
                          {%- endif -%}
                      >{{ t.name }}</a>
182
                      {%- endfor %}
Skia's avatar
Skia committed
183 184 185
                  </div>
              </div>
              {% endif %}
186

Skia's avatar
Skia committed
187 188 189 190 191 192
              {% if error %}
              {{ error }}
              {% endif %}
              {% block content %}
              {% endblock %}
          </div>
Skia's avatar
Skia committed
193
        </div>
Skia's avatar
Skia committed
194

Skia's avatar
Skia committed
195
        {% if not popup %}
Skia's avatar
Skia committed
196 197
        <footer>
            {% block footer %}
Skia's avatar
Skia committed
198
            <div>
199 200
                <a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
                <a href="{{ url('core:page', 'legals') }}">{% trans %}Legal notices{% endtrans %}</a>
Krophil's avatar
Krophil committed
201
                <a href="https://ae2.utbm.fr/copyright_agent.php">{% trans %}Intellectual property{% endtrans %}</a>
202 203
                <a href="{{ url('core:page', 'docs') }}">{% trans %}Help & Documentation{% endtrans %}</a>
                <a href="{{ url('core:page', 'rd') }}">{% trans %}R&D{% endtrans %}</a>
Krophil's avatar
Krophil committed
204
                <a href="https://ae2.utbm.fr/">{% trans %}Former website{% endtrans %}</a>
Skia's avatar
Skia committed
205
            </div>
Skia's avatar
Skia committed
206 207 208
            {% trans %}Site made by good people{% endtrans %}
            {% endblock %}
        </footer>
Skia's avatar
Skia committed
209
        {% endif %}
Skia's avatar
Skia committed
210 211 212 213 214
        <!--
            {% block tests %}
            {{ tests }}
            {% endblock %}
        -->
215
        {% block script %}
Skia's avatar
Skia committed
216 217
        <script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
        <script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
218
        <script src="{{ static('core/js/ui/i18n/datepicker-fr.js') }}"></script>
Skia's avatar
Skia committed
219
        <script src="{{ static('core/js/jquery.datetimepicker.full.min.js') }}"></script>
Skia's avatar
Skia committed
220
        <script src="{{ static('core/js/multiple-select.js') }}"></script>
221
        <script src="{{ static('ajax_select/js/ajax_select.js') }}"></script>
Skia's avatar
Skia committed
222
        <script src="{{ url('javascript-catalog') }}"></script>
Skia's avatar
Skia committed
223 224
        <script src="{{ static('core/js/script.js') }}"></script>
        <script>
225 226 227 228 229 230 231 232 233 234 235 236
$('.select_single').multipleSelect({
    single: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
$('.select_multiple').multipleSelect({
    filter: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
237 238 239 240 241 242 243 244
$('.select_date').datepicker({
    changeMonth: true,
    changeYear: true,
    dayNamesShort: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"  ].dayNamesShort,
    dayNames: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"  ].dayNames,
    monthNamesShort: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"  ].monthNamesShort,
    monthNames: $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"  ].monthNames,
}).datepicker( $.datepicker.regional[ "{{ request.LANGUAGE_CODE }}"] );
245 246
$(document).keydown(function (e) {
    if ($(e.target).is('input')) { return }
247
    if ($(e.target).is('textarea')) { return }
Skia's avatar
Skia committed
248
    if ($(e.target).is('select')) { return }
249 250 251 252 253
    if (e.keyCode == 83) {
        $("#search").focus();
        return false;
    }
});
Skia's avatar
Skia committed
254 255 256 257
jQuery.datetimepicker.setLocale('{{ request.LANGUAGE_CODE|lower }}');
$('.select_datetime').datetimepicker({
        format: 'Y-m-d H:i:s',
        });
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284

function add_syntax(e, choice) {
    ta = $(e).parent().children('textarea')[0];
    ta.focus();
    var start = ta.selectionStart;
    var end = ta.selectionEnd;
    var before = ta.value.substring(0, start);
    var after = ta.value.substring(end);
    var between = ta.value.substring(start, end);
    switch (choice) {
        case "bold":
            ta.value = before + "**" + between + "**" + after;
            ta.selectionEnd = end + 2;
            break;
        case "italic":
            ta.value = before + "*" + between + "*" + after;
            ta.selectionEnd = end + 1;
            break;
        case "underline":
            ta.value = before + "__" + between + "__" + after;
            ta.selectionEnd = end + 2;
            break;
        case "strike":
            ta.value = before + "~~" + between + "~~" + after;
            ta.selectionEnd = end + 2;
            break;
        case "sub":
285 286
            ta.value = before + "<sub>" + between + "</sub>" + after;
            ta.selectionEnd = end + 5;
287 288
            break;
        case "sup":
289 290
            ta.value = before + "<sup>" + between + "</sup>" + after;
            ta.selectionEnd = end + 5;
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
            break;
        case "link":
            if (between === "") {
                between = "https://";
            }
            name = "{% trans %}name{% endtrans %}";
            ta.value = before + "[" + name + "](" + between + ")" + after;
            ta.selectionStart = start + 1;
            ta.selectionEnd = start + 1 + name.length;
            break;
        case "image":
            if (between === "") {
                between = "{% trans %}https://path/to/image.gif{% endtrans %}";
            }
            alt = "{% trans %}alternative text{% endtrans %}";
            ta.value = before + "![" + alt + "](" + between + "?42% \"{% trans %}Title{% endtrans %}\")" + after;
            ta.selectionStart = start + 2;
            ta.selectionEnd = start + 2 + alt.length;
            break;
    }
}

$(document).ready(function() {
314
    editor = $('.markdown_editor');
315 316 317 318 319 320 321 322 323
    editor.prepend('<a onclick="javascript:add_syntax(this, \'image\')">{% trans %}Image{% endtrans %}</a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'link\')">{% trans %}Link{% endtrans %}</a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'sup\')"><sup>{% trans %}sup{% endtrans %}</sup></a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'sub\')"><sub>{% trans %}sub{% endtrans %}</sub></a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'strike\')"><del>{% trans %}S{% endtrans %}</del></a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'underline\')"><u>{% trans %}U{% endtrans %}</u></a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'italic\')"><i>{% trans %}I{% endtrans %}</i></a>');
    editor.prepend('<a onclick="javascript:add_syntax(this, \'bold\')"><b>{% trans %}B{% endtrans %}</b></a>');
});
Skia's avatar
Skia committed
324
        </script>
325
        {% endblock %}
Skia's avatar
Skia committed
326
    </body>
Skia's avatar
Skia committed
327
</html>