base.jinja 16.1 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() %}
Sli's avatar
Sli committed
39
            <div id="header_logo" style="background-image: url('{{ static('core/img/logo.png') }}'); width: 185px; height: 100px;">
Skia's avatar
Skia committed
40 41 42 43 44 45 46 47 48 49 50 51 52
                <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
53
            {% else %}
Sli's avatar
Sli committed
54
            <div id="header_logo" style="background-image: url('{{ static('core/img/logo.png') }}'); width: 92px; height: 52px;">
Skia's avatar
Skia committed
55 56 57 58 59 60 61 62
                <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
63
                        <i class="fa fa-question" style="color: #f39c12"></i>
Skia's avatar
Skia committed
64
                    {% elif bar.is_open(): %}
Soldat's avatar
Soldat committed
65
                        <i class="fa fa-check" style="color: #2ecc71"></i>
Skia's avatar
Skia committed
66
                    {% else %}
Soldat's avatar
Soldat committed
67
                        <i class="fa fa-times" style="color: #eb2f06"></i>
Skia's avatar
Skia committed
68 69 70 71
                    {% endif %}
                        {{ bar }}
                    </a>
                    </li>
Skia's avatar
Skia committed
72
                {% endfor %}
Skia's avatar
Skia committed
73 74 75 76 77 78
                </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
79 80 81 82
                    <div>
                      <a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a>
                    </div>
                    <div>
Krophil's avatar
Krophil committed
83
                      <a href="#" onclick="display_notif()"><i class="fa fa-bell-o"></i> ({{ user.notifications.filter(viewed=False).count() }})</a>
Skia's avatar
Skia committed
84
                      <ul id="header_notif">
Skia's avatar
Skia committed
85
                          {% for n in user.notifications.filter(viewed=False).order_by('-date') %}
Skia's avatar
Skia committed
86 87 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
                          <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
118 119
                </div>
            </div>
Skia's avatar
Skia committed
120 121
            {% endif %}
        </header>
Skia's avatar
Skia committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137

        <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
138 139
        <div id="popupheader">{{ user.get_display_name() }}</div>
        {% endif %}
Skia's avatar
Skia committed
140

Skia's avatar
Skia committed
141 142 143

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

Skia's avatar
Skia committed
145 146 147 148
        <div id="page">
          {% block nav %}
          {% if not popup %}
          <nav>
149
              <a href="{{ url('core:index') }}">{% trans %}Main{% endtrans %}</a>
Soldat's avatar
Soldat committed
150
              <div class="dropdown">
Soldat's avatar
Soldat committed
151
                <button class="dropbtn">{% trans %}Associations & Clubs{% endtrans %} 
Soldat's avatar
Soldat committed
152 153 154
                <i class="fa fa-caret-down"></i>
                </button>
                <div class="dropdown-content">
Sli's avatar
Sli committed
155 156 157 158 159
                    <a href="/page/ae/">{% trans %}AE{% endtrans %}</a>
                    <a href="{{ url('core:page', page_name='clubs') }}">{% trans %}AE's clubs{% endtrans %}</a>
                    <a href="/page/bdf/">{% trans %}BdF{% endtrans %}</a>
                    <a href="/page/bds/">{% trans %}BDS{% endtrans %}</a>
                    <a href="/page/cetu/">{% trans %}CETU{% endtrans %}</a>
Soldat's avatar
Soldat committed
160 161 162 163 164 165 166
                </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
167
                    <a href="/page/Index/calendrier_evenements/">{% trans %}Calendar{% endtrans %}</a>
Soldat's avatar
Soldat committed
168
                    <a href="/page/GA">{% trans %}Big event{% endtrans %}</a>
Soldat's avatar
Soldat committed
169 170
                </div>
              </div> 
Skia's avatar
Skia committed
171
              <a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
Soldat's avatar
Soldat committed
172
              <a href="{{ url('sas:main') }}">{% trans %}Gallery{% endtrans %}</a>
Soldat's avatar
Soldat committed
173
              <a href="{{ url('eboutic:main') }}">{% trans %}Eboutic{% endtrans %}</a>
Soldat's avatar
Soldat committed
174 175 176 177 178
              <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
179
                    <a href="{{ url('matmat:search_clear') }}">{% trans %}Matmatronch{% endtrans %}</a>
Soldat's avatar
Soldat committed
180 181 182 183 184
                    <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
185
              <a href="{{ url('core:page', page_name="partenaires")}}">{% trans %}Sponsors{% endtrans %}</a>
Soldat's avatar
Soldat committed
186 187 188 189 190
              <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
191
                    <a href="/page/FAQ/">{% trans %}FAQ{% endtrans %}</a>
Soldat's avatar
Soldat committed
192
                    <a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
Soldat's avatar
Soldat committed
193
                    <a href="{{ url('core:page', page_name="Index") }}">{% trans %}Wiki{% endtrans %}</a>
Soldat's avatar
Soldat committed
194 195
                </div>
              </div> 
Skia's avatar
Skia committed
196 197 198
          </nav>
          {% endif %}
          {% endblock %}
Skia's avatar
Skia committed
199

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

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

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

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

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