Commit 79cc7cfc authored by Robin Sonnabend's avatar Robin Sonnabend

Added index page

parent 5b682ddb
......@@ -11,7 +11,7 @@ import config
from shared import db, login_manager
from utils import render_layout
from models.forms import LoginForm, NewUserForm
from models.database import User, Statement, Speaker, Topic
from models.database import User, Statement, Speaker, Topic, Event
app = Flask(__name__)
app.config.from_object(config)
......@@ -62,20 +62,14 @@ def adduser():
@app.route("/")
def index():
meta = []
return render_layout("index.html", meta=meta)
events = Event.query.all()
return render_layout("index.html", events=events)
@app.route("/update")
def update():
topics = Topic.query.all()
meta = []
for topic in topics:
ls = speech.query_statements(topic.mode, topic.id)
no_speaker = Speaker("No Speaker", topic)
no_statement = Statement(no_speaker, topic)
meta.append((ls[0] if len(ls) > 0 else (no_statement, no_speaker, ()), topic))
return render_layout("content_index.html", meta=meta)
events = Event.query.all()
return render_layout("content_index.html", events=events)
@app.route("/update.js")
def update_js():
update_interval = config.UPDATE_INDEX_INTERVAL or 1
......
......@@ -163,3 +163,7 @@ div.rede-paused-supporting {
.mdl-card {
min-height: 0px;
}
.rede-title-no-decoration {
text-decoration: none;
}
{% for event in events %}
<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">
{% if event.current_topic_id != -1 %}
<div class="mdl-card__title">
<h3 class="mdl-card__title-text">{{ event.current_topic.name }}: {{ event.current_topic.sorted_statements()[0].speaker.name }}</h3>
<h4 class="mdl-card__title-text">
<a href="{{ url_for("speech.index", event=event.id) }}" class="rede-title-no-decoration">
{{ event.name }}
</a>
{% if event.paused %}
(Paused)
{% endif %}
</h4>
</div>
{% if event.get_current_topic() %}
<table class="mdl-data-table mdl-js-table">
{% for statement in event.get_current_topic().sorted_statements() %}
<tr>
<td>statement.speaker.name</td>
</tr>
{% for topic in event.topics %}
<div class="mdl-card__supporting-text {% if topic.id == event.current_topic_id %}rede-list-point-big{% endif %}">
{{ topic.name }}
</div>
{% endfor %}
</table>
{% endif %}
{% else %}
No topic selected
{% endif %}
</div>
{% endfor %}
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