Skip to content
Snippets Groups Projects
Commit 9ff22054 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

previous topic

parent 58056af3
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,13 @@ class Topic(db.Model): ...@@ -98,6 +98,13 @@ class Topic(db.Model):
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"
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
......
...@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment