base.jinja 11.4 KB
Newer Older
Skia's avatar
Skia committed
1
2
<!DOCTYPE html>
<html lang="fr">
Skia's avatar
Skia committed
3
4
5
    <head>
        {% block head %}
        <title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %}</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') }}">
Skia's avatar
Skia committed
10
        <link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
11
        <link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
Sli's avatar
Sli committed
12
        <link href="{{ scss('core/style.scss') }}" rel="stylesheet" type="text/css" />
Skia's avatar
Skia committed
13
14
        {% endblock %}
    </head>
Skia's avatar
Skia committed
15

Skia's avatar
Skia committed
16
    <body>
Skia's avatar
Skia committed
17
        {% block header %}
Skia's avatar
Skia committed
18
        {% if not popup %}
Skia's avatar
Skia committed
19
        <div id="logo" style="background-image: url('{{ static('core/img/logo.png') }}');"><a href="{{ url('core:index') }}"></a></div>
Skia's avatar
Skia committed
20
21
22
23
24
25
26
27
28
29
30
        {% 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 %}
Skia's avatar
Skia committed
31
32
        <header>
            {% if not user.is_authenticated() %}
Krophil's avatar
Merging    
Krophil committed
33
            <a href="{{ url('core:login') }}">{% trans %}Login{% endtrans %}</a>
Skia's avatar
Skia committed
34
35
            <a href="{{ url('core:register') }}">{% trans %}Register{% endtrans %}</a>
            {% else %}
Skia's avatar
Skia committed
36
37
38
            <ul>
            {% for bar in Counter.objects.filter(type="BAR").all() %}
                <li>
Skia's avatar
Skia committed
39
                <a href="{{ url('counter:activity', counter_id=bar.id) }}" style="padding: 0px">
Lo-J's avatar
Lo-J committed
40
41
42
                {% if bar.is_inactive(): %}
                    <span style="color: orange">&#x3f;</span>
                {% elif bar.is_open(): %}
Skia's avatar
Skia committed
43
44
45
46
47
                    <span style="color: green">&#x2713;</span>
                {% else %}
                    <span style="color: red">&#10007;</span>
                {% endif %}
                    {{ bar }}
Skia's avatar
Skia committed
48
                </a>
Skia's avatar
Skia committed
49
50
51
                </li>
            {% endfor %}
            </ul>
Krophil's avatar
Merging    
Krophil committed
52
            <a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a>
Skia's avatar
Skia committed
53
            <a href="#" onclick="display_notif()">&#x1f514; ({{ user.notifications.filter(viewed=False).count() }})</a>
Skia's avatar
Skia committed
54
            <ul id="notif">
Skia's avatar
Skia committed
55
                {% for n in user.notifications.filter(viewed=False).order_by('-id') %}
Skia's avatar
Skia committed
56
                <li><a href="{{ url("core:notification", notif_id=n.id) }}">
Skia's avatar
Skia committed
57
58
                        <span style="font-size: small; ">{{ n.date|localtime|date(DATE_FORMAT) }} {{
                            n.date|localtime|time(DATETIME_FORMAT) }}</span><br>
Skia's avatar
Skia committed
59
                        {{ n }}</a></li>
Skia's avatar
Skia committed
60
                {% endfor %}
Skia's avatar
Skia committed
61
62
                <li><a href="{{ url('core:notification_list') }}">{% trans %}View more{% endtrans %}</a>
                    <a href="{{ url('core:notification_list') }}?see_all">{% trans %}Mark all as read{% endtrans %}</a></li>
Skia's avatar
Skia committed
63
            </ul>
Krophil's avatar
Merging    
Krophil committed
64
            <a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a>
Skia's avatar
Skia committed
65
            <a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
Skia's avatar
Skia committed
66
            <form action="{{ url('core:search') }}" method="GET">
67
                <input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" />
Skia's avatar
Skia committed
68
69
                <input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" />
            </form>
Skia's avatar
Skia committed
70
71
            {% endif %}
        </header>
Skia's avatar
Skia committed
72
73
74
        {% else %}
        <div id="popupheader">{{ user.get_display_name() }}</div>
        {% endif %}
Skia's avatar
Skia committed
75
        {% endblock %}
Skia's avatar
Skia committed
76
77
78
79

        <div id="language_chooser">
            {% for language in LANGUAGES %}
            <form action="{{ url('set_language') }}" method="post">{% csrf_token %}
Skia's avatar
Skia committed
80
                <input name="next" value="{{ request.path }}" type="hidden" />
Skia's avatar
Skia committed
81
                <input name="language" value="{{ language[0] }}" type="hidden" />
Skia's avatar
Skia committed
82
                <input type="submit" value="{{ language[0]|upper }}" />
Skia's avatar
Skia committed
83
84
85
86
            </form>
            {% endfor %}
        </div>

Skia's avatar
Skia committed
87
        {% block nav %}
Skia's avatar
Skia committed
88
        {% if not popup %}
Skia's avatar
Skia committed
89
        <nav>
Skia's avatar
Skia committed
90
            <a href="https://ae.utbm.fr/">{% trans %}Main{% endtrans %}</a>
91
            <a href="https://ae.utbm.fr/matmatronch/">{% trans %}Matmatronch{% endtrans %}</a>
Skia's avatar
Skia committed
92
            <a href="{{ url('core:page', page_name="Index") }}">{% trans %}Wiki{% endtrans %}</a>
Skia's avatar
Skia committed
93
            <a href="{{ url('sas:main') }}">{% trans %}SAS{% endtrans %}</a>
Skia's avatar
Skia committed
94
            <a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
Skia's avatar
Skia committed
95
            <a href="{{ url('core:page', "services") }}">{% trans %}Services{% endtrans %}</a>
Skia's avatar
Skia committed
96
97
98
            <a href="{{ url('core:file_list') }}">{% trans %}Files{% endtrans %}</a>
            <a href="https://ae.utbm.fr/article.php?name=liens">{% trans %}Sponsors{% endtrans %}</a>
            <a href="https://ae.utbm.fr/article.php?name=docs:index">{% trans %}Help{% endtrans %}</a>
Skia's avatar
Skia committed
99
        </nav>
Skia's avatar
Skia committed
100
        {% endif %}
Skia's avatar
Skia committed
101
        {% endblock %}
Skia's avatar
Skia committed
102

Skia's avatar
Skia committed
103
104
        <ul id="quick_notif">
            {% for n in quick_notifs %}
Skia's avatar
Skia committed
105
            <li>{{ n }}</li>
Skia's avatar
Skia committed
106
107
108
            {% endfor %}
        </ul>

Skia's avatar
Skia committed
109
        <div id="content">
110
111
112
113
114
115
            {% if list_of_tabs %}
            <div class="tool-bar">
                <div>{{ tabs_title }}</div>
                <div class="tools">
                    {% for t in list_of_tabs %}
                    <a href="{{ t.url }}"
Skia's avatar
Skia committed
116
                        {%- if current_tab == t.slug %}
117
118
119
120
121
122
123
124
125
                            class="selected_tab"
                        {%- endif -%}
                    >{{ t.name }}</a>
                    {% endfor %}
                </div>
                <hr>
            </div>
            {% endif %}

Skia's avatar
Skia committed
126
            {% if error %}
Skia's avatar
Skia committed
127
            {{ error }}
Skia's avatar
Skia committed
128
129
130
131
            {% endif %}
            {% block content %}
            {% endblock %}
        </div>
Skia's avatar
Skia committed
132

Skia's avatar
Skia committed
133
        {% if not popup %}
Skia's avatar
Skia committed
134
135
        <footer>
            {% block footer %}
Skia's avatar
Skia committed
136
            <div>
Sli's avatar
Sli committed
137
138
                <a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
                <a href="{{ url('core:page', 'legals') }}">{% trans %}Legal notices{% endtrans %}</a>
Skia's avatar
Skia committed
139
                <a href="https://ae.utbm.fr/copyright_agent.php">{% trans %}Intellectual property{% endtrans %}</a>
Sli's avatar
Sli committed
140
141
                <a href="{{ url('core:page', 'docs') }}">{% trans %}Help & Documentation{% endtrans %}</a>
                <a href="{{ url('core:page', 'rd') }}">{% trans %}R&D{% endtrans %}</a>
Skia's avatar
Skia committed
142
            </div>
Skia's avatar
Skia committed
143
144
145
            {% trans %}Site made by good people{% endtrans %}
            {% endblock %}
        </footer>
Skia's avatar
Skia committed
146
        {% endif %}
Skia's avatar
Skia committed
147
148
149
150
151
        <!--
            {% block tests %}
            {{ tests }}
            {% endblock %}
        -->
152
        {% block script %}
Skia's avatar
Skia committed
153
154
        <script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
        <script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
155
        <script src="{{ static('core/js/ui/i18n/datepicker-fr.js') }}"></script>
Skia's avatar
Skia committed
156
        <script src="{{ static('core/js/jquery.datetimepicker.full.min.js') }}"></script>
Skia's avatar
Skia committed
157
        <script src="{{ static('core/js/multiple-select.js') }}"></script>
158
        <script src="{{ static('ajax_select/js/ajax_select.js') }}"></script>
Skia's avatar
Skia committed
159
        <script src="{{ url('javascript-catalog') }}"></script>
Skia's avatar
Skia committed
160
161
        <script src="{{ static('core/js/script.js') }}"></script>
        <script>
162
163
164
165
166
167
168
169
170
171
172
173
$('.select_single').multipleSelect({
    single: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
$('.select_multiple').multipleSelect({
    filter: true,
    {% if not popup %}
    position: 'top',
    {% endif %}
});
174
175
176
177
178
179
180
181
$('.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 }}"] );
182
183
$(document).keydown(function (e) {
    if ($(e.target).is('input')) { return }
184
    if ($(e.target).is('textarea')) { return }
Skia's avatar
Skia committed
185
    if ($(e.target).is('select')) { return }
186
187
188
189
190
    if (e.keyCode == 83) {
        $("#search").focus();
        return false;
    }
});
Skia's avatar
Skia committed
191
192
193
194
jQuery.datetimepicker.setLocale('{{ request.LANGUAGE_CODE|lower }}');
$('.select_datetime').datetimepicker({
        format: 'Y-m-d H:i:s',
        });
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

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":
222
223
            ta.value = before + "<sub>" + between + "</sub>" + after;
            ta.selectionEnd = end + 5;
224
225
            break;
        case "sup":
226
227
            ta.value = before + "<sup>" + between + "</sup>" + after;
            ta.selectionEnd = end + 5;
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
            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() {
251
    editor = $('.markdown_editor');
252
253
254
255
256
257
258
259
260
    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
261
        </script>
262
        {% endblock %}
Skia's avatar
Skia committed
263
    </body>
Skia's avatar
Skia committed
264
</html>