Skip to content
Snippets Groups Projects
Commit 9fd10fe7 authored by Martin Mareš's avatar Martin Mareš
Browse files

Částečná reorganizace hlavních stránek

Přehled práv přihlášeného uživatele přesunut do /user/settings
(zatím tam není nic jiného).

Orgovská hlavní stránka zatím obsahuje nesetříděné odkazy.

Hlavní stránka celého webu říká, že tam zatím nic není :)
parent 13c1e0e5
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,14 @@ def logout():
@app.route('/user/settings')
def user_settings():
return render_template('not_implemented.html')
sess = db.get_session()
roles = []
if g.user:
roles = (sess.query(db.UserRole)
.filter_by(user_id=g.user.user_id)
.options(joinedload(db.UserRole.place))
.all())
return render_template('settings.html', roles=roles, roles_by_type=mo.rights.roles_by_type)
@app.errorhandler(NeedLoginError)
......
......@@ -2,6 +2,7 @@ from flask import render_template, g, redirect, url_for, request
from sqlalchemy.orm import aliased
import mo.db as db
import mo.rights
from mo.web.table import Table, Column
from mo.web import app
......
......@@ -2,35 +2,10 @@
{% block body %}
<h2>Vítejte</h2>
{% if g.user.is_org or g.user.is_admin %}
<p><a href='{{ url_for('org_place_root') }}'>Hierarchie míst</a>
<p>Export všech škol: <a href='{{ url_for('org_export_skoly', format='csv') }}'>CSV</a>,
<a href='{{ url_for('org_export_skoly', format='tsv') }}'>TSV</a>
{% if g.user %}
<p>Rozhraní na odevzdávání úloh se zde brzy objeví.
{% else %}
<p>Nejprve se prosím přihlašte.
{% endif %}
<h3>Práva</h3>
{% if g.user.is_admin %}
<p>Správce systému
{% endif %}
{% if g.user.is_org %}
<table class=data>
<tr>
<th>Role
<th>Oblast
<th>Roč.
<th>Kat.
<th>Kolo
{% for role in roles %}
<tr>
<td>{{ roles_by_type[role.role].name }}
<td><a href='{{ url_for('org_place', id=role.place_id) }}'>{{ role.place.name }}</a>
<td>{{ role.year or '–' }}
<td>{{ role.category or '–' }}
<td>{{ role.seq or '–' }}
{% endfor %}
</table>
{% endif %}
{% if not g.user.is_admin and not g.user.is_org %}
<p>Běžný uživatel
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% block body %}
Vítejte v organizátorském rozhraní.
<h2>Organizátorské rozhraní</h2>
<h3>Různé</h3>
<ul>
<li>Export všech škol: <a href='{{ url_for('org_export_skoly', format='csv') }}'>CSV</a>,
<a href='{{ url_for('org_export_skoly', format='tsv') }}'>TSV</a>
</ul>
{% endblock %}
{% extends "base.html" %}
{% block body %}
<h2>Uživatel {{ g.user.first_name }} {{ g.user.last_name }}</h2>
<h3>Práva</h3>
{% if g.user.is_admin %}
<p>Správce systému
{% endif %}
{% if g.user.is_org %}
<table class=data>
<tr>
<th>Role
<th>Oblast
<th>Roč.
<th>Kat.
<th>Kolo
{% for role in roles %}
<tr>
<td>{{ roles_by_type[role.role].name }}
<td><a href='{{ url_for('org_place', id=role.place_id) }}'>{{ role.place.name }}</a>
<td>{{ role.year or '–' }}
<td>{{ role.category or '–' }}
<td>{{ role.seq or '–' }}
{% endfor %}
</table>
{% endif %}
{% if not g.user.is_admin and not g.user.is_org %}
<p>Běžný uživatel
{% endif %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment