Просмотр исходного кода

Merge pull request #73 from novist/topic-controls

Show topic pagination and controls bottom as well
Peter Justin 10 лет назад
Родитель
Сommit
fa3ffda1e1
2 измененных файлов с 50 добавлено и 44 удалено
  1. 3 44
      flaskbb/templates/forum/topic.html
  2. 47 0
      flaskbb/templates/forum/topic_controls.html

+ 3 - 44
flaskbb/templates/forum/topic.html

@@ -12,50 +12,7 @@
     <li class="active">{{ topic.title }}</li>
 </ol>
 
-<div class="pull-left" style="padding-bottom: 10px">
-    {{ render_pagination(posts, topic.url) }}
-</div> <!-- end span pagination -->
-
-<div class="pull-right" style="padding-bottom: 10px">
-    <div class="btn btn-group">
-    {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
-        <a href="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-danger">
-            <span class="fa fa-trash-o"></span> Delete Topic
-        </a>
-    {% endif %}
-    {% if current_user|can_moderate(topic.forum) %}
-        {% if not topic.locked %}
-            <a href="{{ url_for('forum.lock_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-warning">
-                <span class="fa fa-lock"></span> Lock Topic
-            </a>
-        {% else %}
-            <a href="{{ url_for('forum.unlock_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-warning">
-                <span class="fa fa-unlock"></span> Unlock Topic
-            </a>
-        {% endif %}
-    {% endif %}
-    </div>
-
-    {% if current_user.is_authenticated() %}
-    <div class="btn btn-group">
-        {% if current_user.is_tracking_topic(topic) %}
-        <a href="{{ url_for('forum.untrack_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-default"><span class="fa fa-star">
-            </span> Untrack Topic
-        </a>
-        {% else %}
-        <a href="{{ url_for('forum.track_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-default">
-            <span class="fa fa-star"></span> Track Topic
-        </a>
-        {% endif %}
-
-        {% if current_user|post_reply(topic.forum) and not (topic.locked or topic.forum.locked) %}
-        <a href="{{ url_for('forum.new_post', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-primary">
-            <span class="fa fa-pencil"></span> Reply
-        </a>
-        {% endif %}
-    </div>
-    {% endif %}
-</div>
+{% include 'forum/topic_controls.html' %}
 
 <table class="table table-bordered">
     <tbody>
@@ -184,6 +141,8 @@
     </tbody>
 </table>
 
+{% include 'forum/topic_controls.html' %}
+
 {% if form %}
     {% from "macros.html" import render_field %}
     <form class="form" action="#" method="post">

+ 47 - 0
flaskbb/templates/forum/topic_controls.html

@@ -0,0 +1,47 @@
+
+<div class="pull-left" style="padding-bottom: 10px">
+    {{ render_pagination(posts, topic.url) }}
+</div> <!-- end span pagination -->
+
+<div class="pull-right" style="padding-bottom: 10px">
+    <div class="btn btn-group">
+        {% if current_user|delete_topic(topic.first_post.user_id, topic.forum) %}
+        <a href="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-danger">
+            <span class="fa fa-trash-o"></span> Delete Topic
+        </a>
+        {% endif %}
+        {% if current_user|can_moderate(topic.forum) %}
+        {% if not topic.locked %}
+        <a href="{{ url_for('forum.lock_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-warning">
+            <span class="fa fa-lock"></span> Lock Topic
+        </a>
+        {% else %}
+        <a href="{{ url_for('forum.unlock_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-warning">
+            <span class="fa fa-unlock"></span> Unlock Topic
+        </a>
+        {% endif %}
+        {% endif %}
+    </div>
+
+    {% if current_user.is_authenticated() %}
+    <div class="btn btn-group">
+        {% if current_user.is_tracking_topic(topic) %}
+        <a href="{{ url_for('forum.untrack_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-default"><span class="fa fa-star">
+            </span> Untrack Topic
+        </a>
+        {% else %}
+        <a href="{{ url_for('forum.track_topic', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-default">
+            <span class="fa fa-star"></span> Track Topic
+        </a>
+        {% endif %}
+
+        {% if current_user|post_reply(topic.forum) and not (topic.locked or topic.forum.locked) %}
+        <a href="{{ url_for('forum.new_post', topic_id=topic.id, slug=topic.slug) }}" class="btn btn-primary">
+            <span class="fa fa-pencil"></span> Reply
+        </a>
+        {% endif %}
+    </div>
+    {% endif %}
+</div>
+
+<div class="clearfix"></div>