diff --git a/server.py b/server.py index 798fc9e80a18fda8117e16fea87a825d3b2b7d48..2caa76e28cd24903f903aff17c11ee56e22f6d7c 100755 --- a/server.py +++ b/server.py @@ -77,7 +77,32 @@ app.jinja_env.globals.update(dir=dir) @app.route("/") def index(): - return render_template("index.html") + user = current_user() + protocols = [ + protocol for protocol in Protocol.query.all() + if protocol.protocoltype.has_public_view_right(user) + ] + def _sort_key(protocol): + if protocol.date is not None: + return protocol.date + return datetime.now().date() + open_protocols = sorted( + [protocol for protocol in protocols if not protocol.done], + key=_sort_key + ) + finished_protocols = sorted( + [protocol for protocol in protocols if protocol.done], + key=_sort_key + ) + protocol = finished_protocols[0] if len(finished_protocols) > 0 else None + todos = None + if check_login(): + todos = [ + todo for todo in Todo.query.filter(Todo.done == False).all() + if todo.protocoltype.has_public_view_right(user) + ] + todos_table = TodosTable(todos) if todos is not None else None + return render_template("index.html", open_protocols=open_protocols, protocol=protocol, todos=todos, todos_table=todos_table) @login_required @app.route("/types/list") diff --git a/templates/index.html b/templates/index.html index edf0aa3a6d7dcfd4bb283866974baea0496d1b4d..17a8c516d10137d3a607626070b51b267456b56a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,6 +1,83 @@ {% extends "layout.html" %} -{% block title %}Hauptseite{% endblock %} +{% from "macros.html" import render_table %} +{% block title %}Startseite{% endblock %} {% block content %} - Dies ist die Startseite +{% if protocol is not none %} +<div class="row"> + <div id="left-column" class="col-lg-6"> +{% endif %} + <h3>Anstehende Sitzungen + {% if check_login() %} + <a href="{{url_for("new_protocol")}}">Neu</a> + {% endif %} + </h3> + <ul> + {% if open_protocols|length > 0 %} + {% for protocol in open_protocols %} + <li><a href="{{url_for("show_protocol", protocol_id=protocol.id)}}">{{protocol.protocoltype.name}}</a> am {{protocol.date|datify}}</li> + {% endfor %} + {% else %} + <li>Keine anstehenden Sitzungen</li> + {% endif %} + </ul> + {% if check_login() %} + <h3>Offene Todos <a href="{{url_for("list_todos")}}">Alle</a></h3> + <ul> + {% if todos|length > 0 %} + {% for todo in todos %} + <li>{{todo.render_html()|safe}}</li> + {% endfor %} + {% else %} + <li>Keine Todos</li> + {% endif %} + </ul> + {% endif %} +{% if protocol is not none %} + </div> + <div id="right-column" class="col-lg-6"> + <h3>Letztes Protokoll</h3> + <div class="well"> + <div class="btn-group"> + <a class="btn btn-primary" href="{{url_for("show_protocol", protocol_id=protocol.id)}}">Details anzeigen</a> + {% if protocol.protocoltype.has_modify_right(current_user()) %} + <a class="btn btn-default" href="{{url_for("update_protocol", protocol_id=protocol.id)}}">Protokoll editieren</a> + {% endif %} + {% if protocol.has_compiled_document() %} + <a class="btn btn-success" href="{{url_for("download_document", document_id=protocol.get_compiled_document().id)}}">Download</a> + {% endif %} + </div> + <h2>Protokoll: {{protocol.protocoltype.name}} {% if protocol.date is not none %}vom {{protocol.date|datify}}{% endif %}</h2> + {% if protocol.date is not none %} + <p><strong>Datum:</strong> {{protocol.date|datify_long}}</p> + {% endif %} + {% if protocol.start_time is not none and protocol.end_time is not none %} + <p><strong>Zeit:</strong> von {{protocol.start_time|timify}} bis {{protocol.end_time|timify}}</p> + {% endif %} + {% if protocol.location is not none %} + <p><strong>Ort:</strong> {{protocol.location}}</p> + {% endif %} + {% if protocol.author is not none %} + <p><strong>Protokollant:</strong> {{protocol.author}}</p> + {% endif %} + {% if protocol.participants is not none %} + <p><strong>Anwesende:</strong> {{protocol.participants}}</p> + {% endif %} + <h3>Tagesordnung{% if has_modify_right and not protocol.has_nonplanned_tops() %} <a href="{{url_for("new_top", protocol_id=protocol.id)}}">Top hinzufügen</a>{% endif %}</h3> + {% include "protocol-tops-include.html" %} + + <h3>Beschlüsse</h3> + <ul> + {% if protocol.decisions|length > 0 %} + {% for decision in protocol.decisions %} + <li>{{decision.content}}</li> + {% endfor %} + {% else %} + <li>Keine Beschlüsse</li> + {% endif %} + </ul> + </div> + </div> +</div> +{% endif %} {% endblock %} diff --git a/templates/protocol-new.html b/templates/protocol-new.html index 9b761a8ce56d3acbc5e3e4613e63b145acb111e6..d6cd23b08a523c527f35c0f25206594cf55d4d59 100644 --- a/templates/protocol-new.html +++ b/templates/protocol-new.html @@ -6,7 +6,7 @@ <div class="container"> <div class="row"> <div id="left-column" class="col-lg-6"> - <h3>Neues Protokoll</h3> + <h3>Neue Sitzung</h3> {{render_form(form, action_url=url_for("new_protocol"), action_text="Anlegen")}} </div> <div id="left-column" class="col-lg-6"> diff --git a/templates/protocol-show.html b/templates/protocol-show.html index 965ed6202292144edb8c35d701ed0e38f9a52c7c..79da04135f1aa22c2a5a832d5fbf3bd26d56d3f1 100644 --- a/templates/protocol-show.html +++ b/templates/protocol-show.html @@ -41,7 +41,11 @@ </div> <div class="row"> <div id="left-column" class="col-lg-6"> - <h2>Protokoll: {{protocol.protocoltype.name}} {% if protocol.date is not none %}vom {{protocol.date|datify}}{% endif %}</h2> + {% if protocol.is_done() %} + <h2>Protokoll: {{protocol.protocoltype.name}} {% if protocol.date is not none %}vom {{protocol.date|datify}}{% endif %}</h2> + {% else %} + <h2>{{protocol.protocoltype.name}} {% if protocol.date is not none %}am {{protocol.date|datify}}{% endif %}</h2> + {% endif %} {% if protocol.is_done() %} {% if protocol.date is not none %} <p><strong>Datum:</strong> {{protocol.date|datify_long}}</p>