2018-07-15 12:41:42 +00:00
{% extends 'base.html' %}
2018-07-22 15:15:29 +00:00
{% block prehead %}
2018-07-22 20:57:11 +00:00
{% if wiki_page %}
< meta name = "author" content = "{{ wiki_log.editor.username }}" >
< meta name = "description" content = "{{ wiki_page.content[:97] }}..." >
{% endif %}
2018-09-12 23:41:29 +00:00
< script >
2018-11-03 17:42:56 +00:00
let edits = false;
2018-09-12 23:41:29 +00:00
function newEdit() {
edits = true;
}
2018-11-03 17:42:56 +00:00
function onEnter() {
2018-09-14 22:49:47 +00:00
edits = false;
}
2018-11-03 17:42:56 +00:00
function onExit() {
edits = true;
}
2018-09-12 23:41:29 +00:00
window.onbeforeunload = function() {
return edits ? "Modifiche non salvate" : null;
}
< / script >
2018-07-22 15:15:29 +00:00
{% endblock %}
2018-07-15 12:41:42 +00:00
{% block pagetitle %}
{{ key }}
{% endblock %}
{% block body %}
< div class = "wiki" >
< h1 >
{{ key }}
< / h1 >
{% if wiki_page %}
< div class = "wiki-content" >
{{ converted_md }}
< / div >
< div class = "wiki-log" >
2018-07-21 17:26:57 +00:00
Ultima modifica di < span class = "last-author" > < a href = "/profile/{{ wiki_log.editor.username }}" > {{ wiki_log.editor.username }}< / a > < / span > alle < span class = "last-timestamp" > {{ wiki_log.timestamp.strftime('%Y-%m-%d %H:%M:%S %Z') }}< / span > {% if wiki_log.reason %}, motivo: < span class = "last-reason" > {{ wiki_log.reason }}< / span > {% endif %}
2018-07-15 12:41:42 +00:00
< / div >
{% endif %}
2019-02-03 19:34:58 +00:00
{% if wiki_page is none %}
< div class = "wiki-edit" >
< h4 > Crea< / h4 >
< form action = "{{ url_for('page_wiki_edit', key=key) }}" method = "POST" >
< textarea oninput = "newEdit()" class = "content" name = "content" placeholder = "Inserisci il Markdown per la pagina qui." > {% if wiki_page %}{{ wiki_page.content }}{% endif %}< / textarea > < br >
< input class = "reason" name = "reason" type = "text" placeholder = "Motivo per la creazione (facoltativo)" > < br >
< input class = "submit" type = "submit" onmouseenter = "onEnter()" onmouseleave = "onExit()" value = "Crea" >
< / form >
< / div >
{% elif wiki_page.locked %}
2019-02-06 15:34:25 +00:00
< div class = "wiki-locked" >
< span > 🔒 Pagina bloccata: non possono essere effettuate ulteriori modifiche.< / span >
< / div >
{% else %}
2019-02-03 16:57:46 +00:00
{% if g.user %}
< div class = "wiki-edit" >
< h4 > Modifica< / h4 >
2019-02-03 18:34:17 +00:00
< form action = "{{ url_for('page_wiki_edit', key=key) }}" method = "POST" >
2019-02-03 19:34:58 +00:00
< textarea oninput = "newEdit()" class = "content" name = "content" placeholder = "Non eliminare pagine altrui. Steffo non la prenderà bene." > {% if wiki_page %}{{ wiki_page.content }}{% endif %}< / textarea > < br >
< input class = "reason" name = "reason" type = "text" placeholder = "Motivo per la modifica (facoltativo)" > < br >
< input class = "submit" type = "submit" onmouseenter = "onEnter()" onmouseleave = "onExit()" value = "Salva" >
2019-02-03 16:57:46 +00:00
< / form >
< / div >
{% endif %}
2018-07-15 12:41:42 +00:00
{% endif %}
2019-02-03 19:37:47 +00:00
{% if wiki_page is not none %}
{% if g.user.role == "Admin" %}
< form action = "{{ url_for('page_wiki_lock', key=key) }}" method = "POST" >
< input class = "submit" type = "submit" value = "Blocca/Sblocca pagina" >
< / form >
{% endif %}
2019-02-03 18:34:17 +00:00
{% endif %}
2018-07-15 12:41:42 +00:00
< / div >
{% endblock %}