Skip to content
Snippets Groups Projects
Commit 559389cc authored by Hinrikus Wolf's avatar Hinrikus Wolf
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:redl/redeleitsystem

parents c5901a6a 5b682ddb
No related branches found
No related tags found
No related merge requests found
...@@ -2,5 +2,4 @@ SQLALCHEMY_DATABASE_URI = "sqlite:///example.db" # SQLAlchemy connection data ...@@ -2,5 +2,4 @@ SQLALCHEMY_DATABASE_URI = "sqlite:///example.db" # SQLAlchemy connection data
SECRET_KEY = "abcdef" # SECRET_KEY = "abcdef" #
DEBUG = False # Debug Mode DEBUG = False # Debug Mode
UPDATE_INDEX_INTERVAL = 1 # Time in seconds between requests UPDATE_INDEX_INTERVAL = 1 # Time in seconds between requests
UPDATE_SHOW_INTERVAL = 1 #
UPDATE_TIME_INTERVAL = 10 # UPDATE_TIME_INTERVAL = 10 #
...@@ -23,11 +23,12 @@ class AdminUserForm(Form): ...@@ -23,11 +23,12 @@ class AdminUserForm(Form):
roles = SelectMultipleField("User roles", choices=[(x.lower().strip(), x) for x in shared.roles]) roles = SelectMultipleField("User roles", choices=[(x.lower().strip(), x) for x in shared.roles])
class AddStatementForm(Form): class AddStatementForm(Form):
speaker_name = StringField("Speaker", validators=[InputRequired("Entering the speaker is required.")]) speaker_name = StringField("Speaker", validators=[InputRequired("Entering the speaker name or number is required.")])
topic = HiddenField("Topic") topic = HiddenField("Topic")
class EditSpeakerForm(Form): class EditSpeakerForm(Form):
name = StringField("Speaker", validators=[InputRequired("Entering the speaker is required.")]) name = StringField("Speaker", validators=[InputRequired("Entering the speaker is required.")])
number = IntegerField("Number", validators=[Optional(), NumberRange(min=0)])
topic_id = HiddenField("Topic_id") topic_id = HiddenField("Topic_id")
id = HiddenField("Speaker_id") id = HiddenField("Speaker_id")
......
...@@ -256,6 +256,7 @@ def speaker_edit(): ...@@ -256,6 +256,7 @@ def speaker_edit():
if speaker is not None: if speaker is not None:
if form.validate_on_submit(): if form.validate_on_submit():
speaker.name = form.name.data speaker.name = form.name.data
speaker.number = form.number.data
db.session.commit() db.session.commit()
return redirect(url_for(".topic_show",id=form.topic_id.data)) return redirect(url_for(".topic_show",id=form.topic_id.data))
else: else:
...@@ -330,8 +331,8 @@ def statement_delete(): ...@@ -330,8 +331,8 @@ def statement_delete():
@admin_permission.require() @admin_permission.require()
def statement_undo(): def statement_undo():
topic_id = request.args.get("topic_id", None) topic_id = request.args.get("topic_id", None)
if statement_id is not None: if topic_id is not None:
statement = Statement.query.filter_by(executed=True).order_by(db.desc(Statement.execution_time)).first() statement = Statement.query.filter_by(executed=True, topic_id=topic_id).order_by(db.desc(Statement.execution_time)).first()
statement.undo() statement.undo()
db.session.commit() db.session.commit()
return redirect(url_for(".topic_show", id=topic_id)) return redirect(url_for(".topic_show", id=topic_id))
......
...@@ -137,6 +137,16 @@ th.rede-medium-text { ...@@ -137,6 +137,16 @@ th.rede-medium-text {
background-color: #F44335; background-color: #F44335;
} }
.rede-table-bg-blue {
color: white;
background-color: #448AFF;
font-weight: bold;
}
.rede-table-centered > td {
text-align: center;
}
.rede-paused-title { .rede-paused-title {
margin: 0 auto; margin: 0 auto;
} }
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<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> <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>
</li> </li>
{% endif %} {% endif %}
<li><a href="{{ url_for(".statement_undo") }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li> <li><a href="{{ url_for(".statement_undo", topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li>
<li><a href="{{ url_for(".topic_show", id=topic.get_next_index()) }}"><i class="material-icons">arrow_forward</i> Next Topic</a></li> <li><a href="{{ url_for(".topic_show", id=topic.get_next_index()) }}"><i class="material-icons">arrow_forward</i> Next Topic</a></li>
<li><a href="{{ url_for(".topic_show", id=topic.get_previous_index()) }}"><i class="material-icons">arrow_backward</i>Previous Topic</a></li> <li><a href="{{ url_for(".topic_show", id=topic.get_previous_index()) }}"><i class="material-icons">arrow_backward</i>Previous Topic</a></li>
<li> <li>
......
...@@ -22,6 +22,22 @@ ...@@ -22,6 +22,22 @@
</div> </div>
{%- endmacro %} {%- endmacro %}
{% macro render_integerfield(field) -%}
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="{{ field.id }}" name="{{ field.id }}" class="mdl-textfield__input" type="text" {% if field.data is not none %}value="{{ field.data }}"{% endif %} />
<label class="mdl-textfield__label" for="{{ field.id }}">{{ field.label.text }}</label>
{% if field.errors %}
{% for e in field.errors %}
<div class="mdl-card__supporting-text">
{{ e }}
</div>
{% endfor %}
{% endif %}
</div>
{%- endmacro %}
{% macro render_passwordfield(field) -%} {% macro render_passwordfield(field) -%}
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input id="{{ field.id }}" name="{{ field.id }}" class="mdl-textfield__input" type="password" /> <input id="{{ field.id }}" name="{{ field.id }}" class="mdl-textfield__input" type="password" />
...@@ -116,6 +132,8 @@ ...@@ -116,6 +132,8 @@
{{ render_stringfield(f) }} {{ render_stringfield(f) }}
{% elif f.type == "PasswordField" %} {% elif f.type == "PasswordField" %}
{{ render_passwordfield(f) }} {{ render_passwordfield(f) }}
{% elif f.type == "IntegerField" %}
{{ render_integerfield(f) }}
{% elif f.type == "BooleanField" %} {% elif f.type == "BooleanField" %}
{{ render_booleanfield(f) }} {{ render_booleanfield(f) }}
{% elif f.type == "CSRFTokenField" %} {% elif f.type == "CSRFTokenField" %}
......
{% for event in events %} {% for event in events %}
<div class="mdl-cell mdl-cell--6-col mdl-cell--8-col-tablet mdl-cell--4-col-phone mdl-card mdl-shadow--2dp"> <div class="mdl-cell mdl-cell--6-col mdl-cell--8-col-tablet mdl-cell--4-col-phone mdl-card mdl-shadow--2dp">
{% if not event.paused %} {% if event.paused %}
{% if event.current_topic_id != -1 and event.get_current_topic() %} <div class="mdl-card__title rede-paused-title">
<h4 class="mdl-card__title-text rede-paused-title-text">
Paused until {{ event.paused_until.strftime("%H:%M") }}
</h4>
</div>
{% endif %}
<div class="mdl-card__title"> <div class="mdl-card__title">
{{ event.name }}: {{ event.get_current_topic().name }} {{ event.name }}: {{ event.get_current_topic().name }}
</div> </div>
...@@ -13,25 +18,28 @@ ...@@ -13,25 +18,28 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for topic in event.topics %}
{% if topic.id == event.current_topic_id %}
<tr class="rede-table-bg-blue rede-table-centered">
<td colspan="2">{{ topic.name }}</td>
</tr>
{% for statement in event.get_current_topic().sorted_statements() %} {% for statement in event.get_current_topic().sorted_statements() %}
{% if statement.is_meta %}
<tr class="rede-table-bg-red">
{% else %}
<tr> <tr>
{% endif %}
<td class="mdl-data-table__cell--non-numeric">{{ statement.speaker.identifier() }}</td> <td class="mdl-data-table__cell--non-numeric">{{ statement.speaker.identifier() }}</td>
<td class="mdl-data-table__cell">{{ statement.speaker.count(event.current_topic) }}</td> <td class="mdl-data-table__cell">{{ statement.speaker.count(event.get_current_topic()) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody>
</table>
{% else %}
<div class="mdl-card__title">
{{ event.name }}: No topic set
</div>
{% endif %}
{% else %} {% else %}
<div class="mdl-card__title rede-paused-title"> <tr class="rede-table-centered">
<h4 class="mdl-card__title-text rede-paused-title-text"> <td colspan="2">{{ topic.name }}</td>
{{ event.name}}: Paused until {{ event.paused_until.strftime("%H:%M") }} </tr>
</h4>
</div>
{% endif %} {% endif %}
{% endfor %}
</tbody>
</table>
</div> </div>
{% endfor %} {% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment