mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-16 11:13:23 +00:00
5504142efa
Signed-off-by: Skia <skia@libskia.so>
267 lines
12 KiB
Django/Jinja
267 lines
12 KiB
Django/Jinja
<!DOCTYPE html>
|
||
<html lang="fr">
|
||
<head>
|
||
{% block head %}
|
||
<title>{% block title %}{% trans %}Welcome!{% endtrans %}{% endblock %}</title>
|
||
<link rel="shortcut icon" href="{{ static('core/img/favicon.ico') }}">
|
||
<link rel="stylesheet" href="{{ static('core/base.css') }}">
|
||
<link rel="stylesheet" href="{{ static('core/multiple-select.css') }}">
|
||
<link rel="stylesheet" href="{{ static('core/jquery.datetimepicker.min.css') }}">
|
||
<link rel="stylesheet" href="{{ static('core/js/ui/jquery-ui.min.css') }}">
|
||
<link rel="stylesheet" href="{{ static('ajax_select/css/ajax_select.css') }}">
|
||
<link href="{{ scss('core/style.scss') }}" rel="stylesheet" type="text/css" />
|
||
{% endblock %}
|
||
</head>
|
||
|
||
<body>
|
||
{% block header %}
|
||
{% if not popup %}
|
||
<div id="logo" style="background-image: url('{{ static('core/img/logo.png') }}');">
|
||
<a style="display: inline-block; width: 100%; height: 100%;" href="{{ url('core:index') }}"></a>
|
||
</div>
|
||
{% 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 %}
|
||
<header>
|
||
{% if not user.is_authenticated() %}
|
||
<a href="{{ url('core:login') }}">{% trans %}Login{% endtrans %}</a>
|
||
<a href="{{ url('core:register') }}">{% trans %}Register{% endtrans %}</a>
|
||
{% else %}
|
||
<ul>
|
||
{% 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(): %}
|
||
<span style="color: orange">?</span>
|
||
{% elif bar.is_open(): %}
|
||
<span style="color: green">✓</span>
|
||
{% else %}
|
||
<span style="color: red">✗</span>
|
||
{% endif %}
|
||
{{ bar }}
|
||
</a>
|
||
</li>
|
||
{% endfor %}
|
||
</ul>
|
||
<a href="{{ url('core:user_profile', user_id=user.id) }}">{{ user.get_display_name() }}</a>
|
||
<a href="#" onclick="display_notif()">🔔 ({{ user.notifications.filter(viewed=False).count() }})</a>
|
||
<ul id="notif">
|
||
{% for n in user.notifications.filter(viewed=False).order_by('-id') %}
|
||
<li><a href="{{ url("core:notification", notif_id=n.id) }}">
|
||
<span style="font-size: small; ">{{ n.date|localtime|date(DATE_FORMAT) }} {{
|
||
n.date|localtime|time(DATETIME_FORMAT) }}</span><br>
|
||
{{ n }}</a></li>
|
||
{% endfor %}
|
||
<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>
|
||
</ul>
|
||
<a href="{{ url('core:user_tools') }}">{% trans %}Tools{% endtrans %}</a>
|
||
<a href="{{ url('core:logout') }}">{% trans %}Logout{% endtrans %}</a>
|
||
<form action="{{ url('core:search') }}" method="GET">
|
||
<input type="text" placeholder="{% trans %}Search{% endtrans %}" name="query" id="search" />
|
||
<input type="submit" value="{% trans %}Search{% endtrans %}" style="display: none;" />
|
||
</form>
|
||
{% endif %}
|
||
</header>
|
||
{% else %}
|
||
<div id="popupheader">{{ user.get_display_name() }}</div>
|
||
{% endif %}
|
||
{% endblock %}
|
||
|
||
<div id="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 %}
|
||
</div>
|
||
|
||
{% block nav %}
|
||
{% if not popup %}
|
||
<nav>
|
||
<a href="https://ae2.utbm.fr/">{% trans %}Main{% endtrans %}</a>
|
||
<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="https://ae2.utbm.fr/article.php?name=liens">{% trans %}Sponsors{% endtrans %}</a>
|
||
<a href="https://ae2.utbm.fr/article.php?name=docs:index">{% trans %}Help{% endtrans %}</a>
|
||
</nav>
|
||
{% endif %}
|
||
{% endblock %}
|
||
|
||
<ul id="quick_notif">
|
||
{% for n in quick_notifs %}
|
||
<li>{{ n }}</li>
|
||
{% endfor %}
|
||
</ul>
|
||
|
||
<div id="content">
|
||
{% 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 }}"
|
||
{%- if current_tab == t.slug %}
|
||
class="selected_tab"
|
||
{%- endif -%}
|
||
>{{ t.name }}</a>
|
||
{% endfor %}
|
||
</div>
|
||
<hr>
|
||
</div>
|
||
{% endif %}
|
||
|
||
{% if error %}
|
||
{{ error }}
|
||
{% endif %}
|
||
{% block content %}
|
||
{% endblock %}
|
||
</div>
|
||
|
||
{% if not popup %}
|
||
<footer>
|
||
{% block footer %}
|
||
<div>
|
||
<a href="{{ url('core:page', 'contacts') }}">{% trans %}Contacts{% endtrans %}</a>
|
||
<a href="{{ url('core:page', 'legals') }}">{% trans %}Legal notices{% endtrans %}</a>
|
||
<a href="https://ae2.utbm.fr/copyright_agent.php">{% trans %}Intellectual property{% endtrans %}</a>
|
||
<a href="{{ url('core:page', 'docs') }}">{% trans %}Help & Documentation{% endtrans %}</a>
|
||
<a href="{{ url('core:page', 'rd') }}">{% trans %}R&D{% endtrans %}</a>
|
||
</div>
|
||
{% trans %}Site made by good people{% endtrans %}
|
||
{% endblock %}
|
||
</footer>
|
||
{% endif %}
|
||
<!--
|
||
{% block tests %}
|
||
{{ tests }}
|
||
{% endblock %}
|
||
-->
|
||
{% block script %}
|
||
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
|
||
<script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
|
||
<script src="{{ static('core/js/ui/i18n/datepicker-fr.js') }}"></script>
|
||
<script src="{{ static('core/js/jquery.datetimepicker.full.min.js') }}"></script>
|
||
<script src="{{ static('core/js/multiple-select.js') }}"></script>
|
||
<script src="{{ static('ajax_select/js/ajax_select.js') }}"></script>
|
||
<script src="{{ url('javascript-catalog') }}"></script>
|
||
<script src="{{ static('core/js/script.js') }}"></script>
|
||
<script>
|
||
$('.select_single').multipleSelect({
|
||
single: true,
|
||
{% if not popup %}
|
||
position: 'top',
|
||
{% endif %}
|
||
});
|
||
$('.select_multiple').multipleSelect({
|
||
filter: true,
|
||
{% if not popup %}
|
||
position: 'top',
|
||
{% endif %}
|
||
});
|
||
$('.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 }}"] );
|
||
$(document).keydown(function (e) {
|
||
if ($(e.target).is('input')) { return }
|
||
if ($(e.target).is('textarea')) { return }
|
||
if ($(e.target).is('select')) { return }
|
||
if (e.keyCode == 83) {
|
||
$("#search").focus();
|
||
return false;
|
||
}
|
||
});
|
||
jQuery.datetimepicker.setLocale('{{ request.LANGUAGE_CODE|lower }}');
|
||
$('.select_datetime').datetimepicker({
|
||
format: 'Y-m-d H:i:s',
|
||
});
|
||
|
||
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":
|
||
ta.value = before + "<sub>" + between + "</sub>" + after;
|
||
ta.selectionEnd = end + 5;
|
||
break;
|
||
case "sup":
|
||
ta.value = before + "<sup>" + between + "</sup>" + after;
|
||
ta.selectionEnd = end + 5;
|
||
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() {
|
||
editor = $('.markdown_editor');
|
||
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>');
|
||
});
|
||
</script>
|
||
{% endblock %}
|
||
</body>
|
||
</html>
|