base.jinja 16.2 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>
Soldat's avatar
Soldat committed
152
              <div class="dropdown">
Soldat's avatar
Soldat committed
153
                <button class="dropbtn">{% trans %}Associations & Clubs{% endtrans %} 
Soldat's avatar
Soldat committed
154 155 156
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content">
Soldat's avatar
Soldat committed
157 158 159 160 161 162 163 164 165 166 167 168
                    <a href="/page/ae/">{% trans %}The AE{% endtrans %}</a>
                    <a href="{{ url('core:page', page_name='clubs') }}">{% trans %}The AE's clubs{% endtrans %}</a>
                    <a href="/page/bdf/">{% trans %}The BDF{% endtrans %}</a>
                    <a href="/page/bds/">{% trans %}The BDS{% endtrans %}</a>
                    <a href="/page/cetu/">{% trans %}The CETU{% endtrans %}</a>
                </div>
              </div> 
              <div class="dropdown">
                <button class="dropbtn">{% trans %}Events{% endtrans %} 
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content">
Soldat's avatar
Soldat committed
169
                    <a href="/page/Index/calendrier_evenements/">{% trans %}Calendar{% endtrans %}</a>
Soldat's avatar
Soldat committed
170
                    <a href="/page/GA">{% trans %}Big event{% endtrans %}</a>
Soldat's avatar
Soldat committed
171 172
                </div>
              </div> 
Skia's avatar
Skia committed
173
              <a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
Soldat's avatar
Soldat committed
174
              <a href="{{ url('sas:main') }}">{% trans %}Gallery{% endtrans %}</a>
Soldat's avatar
Soldat committed
175
              <a href="{{ url('eboutic:main') }}">{% trans %}Eboutic{% endtrans %}</a>
Soldat's avatar
Soldat committed
176 177 178 179 180
              <div class="dropdown">
                <button class="dropbtn">{% trans %}Services{% endtrans %} 
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content">
Soldat's avatar
Soldat committed
181
                    <a href="{{ url('matmat:search_clear') }}">{% trans %}Matmatronch{% endtrans %}</a>
Soldat's avatar
Soldat committed
182 183 184 185 186
                    <a href="/launderette">{% trans %}Launderette{% endtrans %}</a>
                    <a href="{{ url('core:file_list') }}">{% trans %}Files{% endtrans %}</a>
                    <a href="https://ae2.utbm.fr/uvs/">{% trans %}Pedagogy{% endtrans %}</a>
                </div>
              </div> 
Skia's avatar
Skia committed
187
              <a href="{{ url('core:page', page_name="partenaires")}}">{% trans %}Sponsors{% endtrans %}</a>
Soldat's avatar
Soldat committed
188 189 190 191 192
              <div class="dropdown">
                <button class="dropbtn">{% trans %}Help{% endtrans %} 
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content">
Soldat's avatar
Soldat committed
193
                    <a href="/page/FAQ/">{% trans %}FAQ{% endtrans %}</a>
Soldat's avatar
Soldat committed
194
                    <a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
Soldat's avatar
Soldat committed
195
                    <a href="{{ url('core:page', page_name="Index") }}">{% trans %}Wiki{% endtrans %}</a>
Soldat's avatar
Soldat committed
196 197
                </div>
              </div> 
Skia's avatar
Skia committed
198 199 200
          </nav>
          {% endif %}
          {% endblock %}
Skia's avatar
Skia committed
201

Skia's avatar
Skia committed
202 203 204 205 206
          <ul id="quick_notif">
              {% for n in quick_notifs %}
              <li>{{ n }}</li>
              {% endfor %}
          </ul>
Skia's avatar
Skia committed
207

Skia's avatar
Skia committed
208 209
          <div id="content">
              {% if list_of_tabs %}
210
              <div class="tool_bar">
Skia's avatar
Skia committed
211 212
                  <div>{{ tabs_title }}</div>
                  <div class="tools">
213
                      {% for t in list_of_tabs -%}
Skia's avatar
Skia committed
214 215 216 217 218
                      <a href="{{ t.url }}"
                          {%- if current_tab == t.slug %}
                              class="selected_tab"
                          {%- endif -%}
                      >{{ t.name }}</a>
219
                      {%- endfor %}
Skia's avatar
Skia committed
220 221 222
                  </div>
              </div>
              {% endif %}
223

Skia's avatar
Skia committed
224 225 226 227 228 229
              {% if error %}
              {{ error }}
              {% endif %}
              {% block content %}
              {% endblock %}
          </div>
Skia's avatar
Skia committed
230
        </div>
Skia's avatar
Skia committed
231

Skia's avatar
Skia committed
232
        {% if not popup %}
Skia's avatar
Skia committed
233 234
        <footer>
            {% block footer %}
Skia's avatar
Skia committed
235
            <div>
236 237
                <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
238
                <a href="https://ae2.utbm.fr/copyright_agent.php">{% trans %}Intellectual property{% endtrans %}</a>
239 240
                <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
241
                <a href="https://ae2.utbm.fr/">{% trans %}Former website{% endtrans %}</a>
Skia's avatar
Skia committed
242
            </div>
Skia's avatar
Skia committed
243 244 245
            {% trans %}Site made by good people{% endtrans %}
            {% endblock %}
        </footer>
Skia's avatar
Skia committed
246
        {% endif %}
Skia's avatar
Skia committed
247 248 249 250 251
        <!--
            {% block tests %}
            {{ tests }}
            {% endblock %}
        -->
252
        {% block script %}
Skia's avatar
Skia committed
253 254
        <script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
        <script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
255
        <script src="{{ static('core/js/ui/i18n/datepicker-fr.js') }}"></script>
Skia's avatar
Skia committed
256
        <script src="{{ static('core/js/jquery.datetimepicker.full.min.js') }}"></script>
Skia's avatar
Skia committed
257
        <script src="{{ static('core/js/multiple-select.js') }}"></script>
258
        <script src="{{ static('ajax_select/js/ajax_select.js') }}"></script>
Skia's avatar
Skia committed
259
        <script src="{{ url('javascript-catalog') }}"></script>
Skia's avatar
Skia committed
260 261
        <script src="{{ static('core/js/script.js') }}"></script>
        <script>
262 263 264 265 266 267 268 269 270 271 272 273
$('.select_single').multipleSelect({
    single: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
$('.select_multiple').multipleSelect({
    filter: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
274 275 276 277 278 279 280 281
$('.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 }}"] );
282 283
$(document).keydown(function (e) {
    if ($(e.target).is('input')) { return }
284
    if ($(e.target).is('textarea')) { return }
Skia's avatar
Skia committed
285
    if ($(e.target).is('select')) { return }
286 287 288 289 290
    if (e.keyCode == 83) {
        $("#search").focus();
        return false;
    }
});
Skia's avatar
Skia committed
291 292 293 294
jQuery.datetimepicker.setLocale('{{ request.LANGUAGE_CODE|lower }}');
$('.select_datetime').datetimepicker({
        format: 'Y-m-d H:i:s',
        });
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321

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":
322 323
            ta.value = before + "<sub>" + between + "</sub>" + after;
            ta.selectionEnd = end + 5;
324 325
            break;
        case "sup":
326 327
            ta.value = before + "<sup>" + between + "</sup>" + after;
            ta.selectionEnd = end + 5;
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
            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() {
351
    editor = $('.markdown_editor');
352 353 354 355 356 357 358 359 360
    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
361
        </script>
362
        {% endblock %}
Skia's avatar
Skia committed
363
    </body>
Skia's avatar
Skia committed
364
</html>