diff --git a/models/database.py b/models/database.py index b3cfe076593c61a97d620d23167e719d49e0cd08..d729849bfc090dad6739da7710ff6ae002d5ea35 100644 --- a/models/database.py +++ b/models/database.py @@ -97,6 +97,13 @@ class Topic(db.Model): if i >= len(topics): i = -1 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): __tablename__ = "speakers" diff --git a/templates/admin_topic_show.html b/templates/admin_topic_show.html index f25ede63427efe5b00d17ebcba617eb7428baba8..c18889648d820e7a220545a9822f8e8cf11711b0 100644 --- a/templates/admin_topic_show.html +++ b/templates/admin_topic_show.html @@ -57,6 +57,7 @@ {% 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(".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> </div> </div>