From de9569116aa1847107ece1b0fe36c061d79db229 Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Sat, 7 Nov 2015 20:30:49 +0100
Subject: [PATCH] Added topic header to statement table

---
 modules/admin.py                | 10 ++++++----
 static/css/style.css            | 14 ++++++++++++++
 templates/admin_topic_show.html | 13 ++++++++-----
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/modules/admin.py b/modules/admin.py
index f5792e6..5399805 100644
--- a/modules/admin.py
+++ b/modules/admin.py
@@ -286,7 +286,9 @@ def statement_delete():
 @login_required
 @admin_permission.require()
 def statement_undo():
-    statement = Statement.query.filter_by(executed=True).order_by(db.desc(Statement.execution_time)).first()
-    statement.undo()
-    db.session.commit()
-    return redirect(url_for(".topic_show", id=statement.topic.id))
+    topic_id = request.args.get("topic_id", None)
+    if statement_id is not None:
+        statement = Statement.query.filter_by(executed=True).order_by(db.desc(Statement.execution_time)).first()
+        statement.undo()
+        db.session.commit()
+    return redirect(url_for(".topic_show", id=topic_id))
diff --git a/static/css/style.css b/static/css/style.css
index 488019b..8cf65d4 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -109,3 +109,17 @@
     text-decoration: none;
     vertical-align: text-top;
 }
+
+th.rede-large-text {
+    font-size: 18pt;
+}
+
+th.rede-medium-text {
+    font-size: 18pt;
+    color: darkred;
+}
+
+.rede-list-no-bullet {
+    list-style-type: none;
+    padding-left: 1pc;
+}
diff --git a/templates/admin_topic_show.html b/templates/admin_topic_show.html
index 566ad10..fa8b501 100644
--- a/templates/admin_topic_show.html
+++ b/templates/admin_topic_show.html
@@ -6,10 +6,14 @@
     <div class="mdl-cell mdl-cell--6-col mdl-cell--5-col-tablet mdl-cell--4-col-phone mdl-grid mdl-grid--no-spacing">
         <table class="mdl-data-table mdl-js-table mdl-shadow--2dp mdl-cell mdl-cell--12-col">
             <thead>
+                <tr>
+                    <th class="mdl-data-table__cell-non-numeric rede-large-text">{{ topic.name }}</th>
+                    <th class="mdl-data-table__cell-non-numeric rede-medium-text" colspan=2>{{ topic.mode }}</th>
+                    <th class="mdl-data-table__cell-non-numeric rede-medium-text"><a href="{{ url_for(".topic_edit", id=topic.id) }}"><i class="material-icons">edit</i></a></th>
+                </tr>
                 <tr>
                     <th class="mdl-data-table__cell--non-numeric">Speaker</th>
-                    <th class="mdl-data-table__cell--non-numeric">Topic</th>
-                    <th class="mdl-data-table__cell--non-numeric">Count</th>
+                    <th class="mdl-data-table__cell">Count</th>
                     <th class="mdl-data-table__cell--non-numeric">Done</th>
                     <th class="mdl-data-table__cell--non-numeric">Edit</th>
                     <th class="mdl-data-table__cell--non-numeric">Remove</th>
@@ -19,8 +23,7 @@
             {% for statement in topic.sorted_statements() %}
                 <tr>
                     <td class="mdl-data-table__cell--non-numeric">{{ statement.speaker.identifier() }}</td>
-                    <td class="mdl-data-table__cell--non-numeric">{{ statement.topic.name }}</td>
-                    <td class="mdl-data-table__cell--non-numeric">{{ statement.speaker.count(statement.topic) }}</td>
+                    <td class="mdl-data-table__cell">{{ statement.speaker.count(statement.topic) }}</td>
                     <td class="mdl-data-table__cell--non-numeric">
                         <a href="{{ url_for(".statement_done", id=statement.id, topic_id=topic.id) }}">
                             <i class="material-icons">done</i>
@@ -46,7 +49,7 @@
     <div class="mdl-cell mdl-cell--3-col mdl-cell--3-col-tablet mdl-cell--4-col-phone mdl-grid mdl-grid--no-spacing">
         {{ render_form(form, action_url=url_for(".statement_new"), action_text="Add", title="Add Statement", class_="mdl-card mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone") }}
         <div class="mdl-cell mdl-card mdl-shadow--2dp mdl-cell--12-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">
-            <ul>
+            <ul class="rede-list-no-bullet">
                 {% if topic.sorted_statements()|length() > 0 %}
                 <li>
                     <a href="{{ url_for(".statement_done", id=topic.sorted_statements()[0].id, topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">redo</i> Next</a>
-- 
GitLab