Browse Source

Rename generate_post_id to generate_obj_id

To make it universally more usable
Peter Justin 7 years ago
parent
commit
e2848f74bc

+ 2 - 2
flaskbb/templates/forum/topic.html

@@ -3,7 +3,7 @@
 {% set active_forum_nav=True %}
 
 {% block content %}
-{% from theme('macros.html') import render_pagination, form_field, generate_post_id, generate_post_url %}
+{% from theme('macros.html') import render_pagination, form_field, generate_obj_id, generate_post_url %}
 
 <div class="topic-view">
     <ol class="breadcrumb flaskbb-breadcrumb">
@@ -78,7 +78,7 @@
 
                         <!-- Post number -->
                         <div class="pull-right">
-                            <strong>#{{ generate_post_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
+                            <strong>#{{ generate_obj_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
                         </div>
                     </div>
 

+ 2 - 2
flaskbb/templates/forum/topic_horizontal.html

@@ -3,7 +3,7 @@
 {% set active_forum_nav=True %}
 
 {% block content %}
-{% from theme('macros.html') import render_pagination, form_field, generate_post_id, generate_post_url %}
+{% from theme('macros.html') import render_pagination, form_field, generate_obj_id, generate_post_url %}
 
 <div class="topic-view">
     <ol class="breadcrumb flaskbb-breadcrumb">
@@ -79,7 +79,7 @@
 
                         <!-- Post number -->
                         <div class="pull-right">
-                            <strong>#{{ generate_post_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
+                            <strong>#{{ generate_obj_id(posts, loop.index, flaskbb_config["POSTS_PER_PAGE"]) }}</strong>
                         </div>
                     </div>
 

+ 11 - 5
flaskbb/templates/macros.html

@@ -405,7 +405,10 @@
 {%- endmacro -%}
 
 
-{# Generates a topic url with an anchor to the post #}
+{#
+Generates a topic url with an anchor to the post
+XXX: Rename to generate_anchor_url to make it universally useful
+#}
 {%- macro generate_post_url(topic, post, page) -%}
     {%- if page > 1 -%}
         {{ topic.url }}?page={{ page }}#pid{{ post.id }}
@@ -415,11 +418,14 @@
 {%- endmacro -%}
 
 
-{# Generates the post id for the topic. Each topic starts with the post id 1 #}
-{%- macro generate_post_id(posts, page, per_page) -%}
-    {%- if posts.page == 1 -%}
+{#
+Generates the pagination object id in a list.
+For example, on id should continue with 11 on page 2 if per_page is set to 10
+#}
+{%- macro generate_obj_id(obj, page, per_page) -%}
+    {%- if obj.page == 1 -%}
         {{ page }}
     {%- else -%}
-        {{ page + (posts.page - 1) * per_page }}
+        {{ page + (obj.page - 1) * per_page }}
     {%- endif -%}
 {%- endmacro -%}

+ 5 - 1
flaskbb/templates/message/conversation_list.html

@@ -1,3 +1,4 @@
+{% from "macros.html" import generate_obj_id %}
 <div class="panel conversation-panel">
     <div class="panel-heading conversation-head">
         <div class="row">
@@ -7,7 +8,7 @@
                 </div>
 
                 <div class="pull-right">
-                    <span class="label label-info">{{ message_count }}/{{ flaskbb_config["MESSAGE_QUOTA"] }}</span>
+                    <span class="label label-info" title="The amount of all conversations" data-toggle="tooltip" data-placement="top">{{ message_count }}/{{ flaskbb_config["MESSAGE_QUOTA"] }}</span>
                 </div>
             </div>
         </div>
@@ -34,6 +35,9 @@
                             {{ conversation.subject }}
                         {% endif %}
                     </a>
+                    <div class="pull-right">
+                        <strong><small>#{{ generate_obj_id(conversations, loop.index, flaskbb_config["TOPICS_PER_PAGE"]) }}</small></strong>
+                    </div>
                 </div>
                 <!-- meta info (date, user) -->
                 <div class="conversation-meta">