Commit d067165e authored by YSelf Tool's avatar YSelf Tool

Deduplication

parent 3ec31735
......@@ -67,7 +67,7 @@ def update():
else:
for event in Event.query.all():
meta.append((query_statements(mode, event.id), event))
return render_template("speech_update_show.html", mode=mode, meta=meta)
return render_template("speech_content_show.html", mode=mode, meta=meta)
@speech.route("/add", methods=["GET", "POST"])
......
......@@ -52,7 +52,7 @@ def update():
no_speaker = Speaker("No Speaker", event)
no_statement = Statement(no_speaker, event)
meta.append((ls[0] if len(ls) > 0 else (no_statement, no_speaker, ()), event))
return render_template("update_index.html", meta=meta)
return render_template("content_index.html", meta=meta)
@app.route("/update.js")
def update_js():
......
......@@ -5,35 +5,5 @@
{% endblock %}
{% block content %}
{% for (statement, speaker, count), event in meta %}
<div class="mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--4-col-phone mdl-card">
<div class="mdl-card__title">
<h3 class="mdl-card__title-text">{{ event.name }}: {{ speaker.name }}</h3>
</div>
<div class="mdl-card__actions">
{% if current_user.is_authenticated() and "user" in current_user.roles %}
<a href="{{ url_for("speech.index", event=event.id, mode="pending") }}">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
<i class="material-icons" role="presentation">build</i>
</button>
</a>
{% endif %}
<a href="{{ url_for("speech.show", event=event.id, mode="pending") }}">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
<i class="material-icons" role="presentation">announcement</i>
</button>
</a>
<a href="{{ url_for("speech.show", event=event.id, mode="all") }}">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
<i class="material-icons" role="presentation">list</i>
</button>
</a>
<a href="{{ url_for("speech.show", event=event.id, mode="past") }}">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored">
<i class="material-icons" role="presentation">schedule</i>
</button>
</a>
</div>
</div>
{% endfor %}
{% include "content_index.html" %}
{% endblock %}
......@@ -6,46 +6,5 @@
{% endblock %}
{% block content %}
{% for statements, event in meta %}
<table class="mdl-data-table mdl-js-table mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">
<thead>
<tr>
<th class="mdl-data-table__cell--non-numeric">Speaker for {{ event.name }}</th>
{% if mode == "all" or mode == "past" %}
<th class="mdl-data-table__cell--non-numeric">Time</th>
{% endif %}
</tr>
</thead>
<tbody>
{% if mode == "all" or mode == "past" %}
{% for statement, speaker in statements %}
<tr>
<td class="mdl-data-table__cell--non-numeric">
{{ speaker.name }}
</td>
{% if mode == "all" %}
<td class="mdl-data-table__cell--non-numeric">
{{ statement.insertion_time.strftime("%d. %B %Y, %H:%M") }}
</td>
{% elif mode == "past" %}
<td class="mdl-data-table__cell--non-numeric">
{{ statement.execution_time.strftime("%d. %B %Y, %H:%M") }}
</td>
{% endif %}
</tr>
{% endfor %}
{% elif mode == "pending" %}
{% for statement, speaker, count in statements %}
{% if not statement.executed %}
<tr>
<td class="mdl-data-table__cell--non-numeric">
<h5>{{ speaker.name }}</h5>
</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}
</tbody>
</table>
{% endfor %}
{% include "speech_content_show.html" %}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment