Skip to content
Snippets Groups Projects
Commit 22841431 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Index page

parent 8685fc76
Branches
No related tags found
No related merge requests found
......@@ -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")
......
{% 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 %}
......@@ -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">
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment