From 559b23f2055152ad8cb8032c4e272b6bcd42b629 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Tue, 28 Sep 2021 18:17:21 +0200 Subject: [PATCH] =?UTF-8?q?Dokumentace=20p=C5=99esunuta=20do=20samostatn?= =?UTF-8?q?=C3=A9=20=C4=8D=C3=A1sti=20webu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mo/web/__init__.py | 3 ++- mo/web/doc.py | 23 +++++++++++++++++++++++ mo/web/menu.py | 2 ++ mo/web/misc.py | 15 --------------- mo/web/templates/doc_index.html | 31 +++++++++++++++++++++++++++++++ mo/web/templates/org_index.html | 18 +++++------------- 6 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 mo/web/doc.py create mode 100644 mo/web/templates/doc_index.html diff --git a/mo/web/__init__.py b/mo/web/__init__.py index 782dba3e..62e630b9 100644 --- a/mo/web/__init__.py +++ b/mo/web/__init__.py @@ -132,6 +132,7 @@ def need_login(): def init_request(): path = request.path + # XXX: Když celá aplikace běží v adresáři, request.path je relativní ke kořeni aplikace, ne celého webu if path.startswith('/static/') or path.startswith('/assets/'): # Pro statické soubory v development nasazení nepotřebujeme nastavovat # nic dalšího (v ostrém nasazení je servíruje uwsgi) @@ -155,7 +156,6 @@ def init_request(): mo.util.current_log_user = user # K některým podstromům je nutné mít speciální oprávnění - # XXX: Když celá aplikace běží v adresáři, request.path je relativní ke kořeni aplikace, ne celého webu if path.startswith('/org/'): if not user: raise NeedLoginError() @@ -218,6 +218,7 @@ except ImportError: # Většina webu je v samostatných modulech import mo.web.api import mo.web.acct +import mo.web.doc import mo.web.jinja import mo.web.menu import mo.web.misc diff --git a/mo/web/doc.py b/mo/web/doc.py new file mode 100644 index 00000000..c909a6e8 --- /dev/null +++ b/mo/web/doc.py @@ -0,0 +1,23 @@ +from flask import render_template + +from mo.web import app + + +@app.route('/doc/') +def doc_index(): + return render_template('doc_index.html') + + +@app.route('/doc/garant') +def doc_garant(): + return render_template('doc_garant.html') + + +@app.route('/doc/gdpr') +def doc_gdpr(): + return render_template('doc_gdpr.html') + + +@app.route('/doc/about') +def doc_about(): + return render_template('doc_about.html') diff --git a/mo/web/menu.py b/mo/web/menu.py index d4760913..60f19f80 100644 --- a/mo/web/menu.py +++ b/mo/web/menu.py @@ -30,10 +30,12 @@ def get_menu(): MenuItem(url_for('org_users'), "Soutěžící"), MenuItem(url_for('org_orgs'), "Organizátoři"), MenuItem(url_for('org_jobs'), "Dávky"), + MenuItem(url_for('doc_index'), "Návod"), ] else: items = [ MenuItem(url_for('user_index'), "Domů"), + MenuItem(url_for('doc_index'), "Návod"), ] # Login / user settings diff --git a/mo/web/misc.py b/mo/web/misc.py index b58a0fd3..04a0d62e 100644 --- a/mo/web/misc.py +++ b/mo/web/misc.py @@ -3,21 +3,6 @@ from flask import render_template, redirect, url_for, g from mo.web import app -@app.route('/doc/garant') -def doc_garant(): - return render_template('doc_garant.html') - - -@app.route('/doc/gdpr') -def doc_gdpr(): - return render_template('doc_gdpr.html') - - -@app.route('/doc/about') -def doc_about(): - return render_template('doc_about.html') - - @app.route('/') def index(): """Titulní stránka, která přihlášené uživatele přesměruje do jejich sekce.""" diff --git a/mo/web/templates/doc_index.html b/mo/web/templates/doc_index.html new file mode 100644 index 00000000..70463f5e --- /dev/null +++ b/mo/web/templates/doc_index.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% block title %}Dokumentace{% endblock %} +{% block body %} + +<ul> +<li><a href='{{ url_for('doc_about') }}'>O aplikaci</a> +<li><a href='{{ url_for('doc_gdpr') }}'>Zpracování osobních údajů</a> +<li><a href='https://docs.google.com/document/d/1XXk7Od-ZKtfmfNa-9FpFjUqmy0Ekzf2-2q3EpSWyn1w/edit?usp=sharing'>Návod na tvorbu PDF</a> +</ul> + +<h3>Pro organizátory</h3> + +<ul> +<li><a href='{{ url_for('doc_garant') }}'>Návod pro garanty</a> +<li><a href='{{ url_for('static', filename='doc/import-navod.pdf') }}'>Podrobnější návod k importům</a> (PDF) +</ul> + +{% if g.user.is_org %} + +<h3>Exporty</h3> + +<ul> +<li>Export všech škol: + <a href='{{ url_for('org_export_schools', format='en_csv') }}'>CSV s čárkami</a>, + <a href='{{ url_for('org_export_schools', format='cs_csv') }}'>CSV se středníky</a>, + <a href='{{ url_for('org_export_schools', format='tsv') }}'>TSV</a> +</ul> + +{% endif %} + +{% endblock %} diff --git a/mo/web/templates/org_index.html b/mo/web/templates/org_index.html index e4a5b0f5..c09e00d2 100644 --- a/mo/web/templates/org_index.html +++ b/mo/web/templates/org_index.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Organizátorské rozhraní{% endblock %} +{% block title %}Přístup pro organizátory{% endblock %} {% block body %} {% if contests %} @@ -33,19 +33,11 @@ {% endfor %} </table> -{% endif %} +{% else %} + +<p>Momentálně neorganizujete žádnou soutěž. -<h3>Různé</h3> - -<ul> -<li><a href='{{ url_for('doc_garant') }}'>Návod pro garanty</a> (může se hodit i ostatním organizátorům) -<li><a href='{{ url_for('static', filename='doc/import-navod.pdf') }}'>Podrobnější návod k importům</a> (PDF) -<li>Export všech škol: - <a href='{{ url_for('org_export_schools', format='en_csv') }}'>CSV s čárkami</a>, - <a href='{{ url_for('org_export_schools', format='cs_csv') }}'>CSV se středníky</a>, - <a href='{{ url_for('org_export_schools', format='tsv') }}'>TSV</a> -<li><a href='https://docs.google.com/document/d/1XXk7Od-ZKtfmfNa-9FpFjUqmy0Ekzf2-2q3EpSWyn1w/edit?usp=sharing'>Návod na tvorbu PDF</a> -</ul> +{% endif %} <h3>Rychlé hledání</h3> -- GitLab