Commit 9ff22054 authored by Robin Sonnabend's avatar Robin Sonnabend

previous topic

parent 58056af3
...@@ -97,6 +97,13 @@ class Topic(db.Model): ...@@ -97,6 +97,13 @@ class Topic(db.Model):
if i >= len(topics): if i >= len(topics):
i = -1 i = -1
return topics[i].id return topics[i].id
def get_previous_index(self):
topics = self.event.sorted_topics()
i = topics.index(self) - 1
if i >= len(topics):
i = 0
return topics[i].id
class Speaker(db.Model): class Speaker(db.Model):
__tablename__ = "speakers" __tablename__ = "speakers"
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
{% 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") }}" 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>
</ul> </ul>
</div> </div>
</div> </div>
......
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