Browse Source

Add more template hooks

Peter Justin 7 years ago
parent
commit
8eaba849ca

+ 3 - 0
docs/hooks.rst

@@ -92,4 +92,7 @@ Template Hooks
 .. autofunction:: flaskbb_tpl_profile_sidebar_stats
 .. autofunction:: flaskbb_tpl_profile_sidebar_stats
 .. autofunction:: flaskbb_tpl_post_author_info_before
 .. autofunction:: flaskbb_tpl_post_author_info_before
 .. autofunction:: flaskbb_tpl_post_author_info_after
 .. autofunction:: flaskbb_tpl_post_author_info_after
+.. autofunction:: flaskbb_tpl_post_menu_before
+.. autofunction:: flaskbb_tpl_post_menu_after
+.. autofunction:: flaskbb_tpl_topic_controls
 .. autofunction:: flaskbb_tpl_admin_settings_menu
 .. autofunction:: flaskbb_tpl_admin_settings_menu

+ 24 - 0
flaskbb/plugins/spec.py

@@ -297,6 +297,30 @@ def flaskbb_tpl_post_author_info_after(user, post):
 
 
 
 
 @spec
 @spec
+def flaskbb_tpl_post_menu_before(post):
+    """Hook for inserting a new item at the beginning of the post menu.
+
+    :param post: The current post object.
+    """
+
+
+@spec
+def flaskbb_tpl_post_menu_after(post):
+    """Hook for inserting a new item at the end of the post menu.
+
+    :param post: The current post object.
+    """
+
+
+@spec
+def flaskbb_tpl_topic_controls(topic):
+    """Hook for inserting additional topic moderation controls.
+
+    :param topic: The current topic object.
+    """
+
+
+@spec
 def flaskbb_tpl_form_new_post_before(form):
 def flaskbb_tpl_form_new_post_before(form):
     """Hook for inserting a new form field before the first field is
     """Hook for inserting a new form field before the first field is
     rendered.
     rendered.

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

@@ -106,6 +106,7 @@
 
 
                             <!-- Report/Edit/Delete/Quote Post-->
                             <!-- Report/Edit/Delete/Quote Post-->
                             <div class="post-menu pull-right">
                             <div class="post-menu pull-right">
+                            {{ run_hook("flaskbb_tpl_post_menu_before", post=post) }}
 
 
                             {% if current_user|post_reply(topic) %}
                             {% if current_user|post_reply(topic) %}
                             <!-- Quick quote -->
                             <!-- Quick quote -->
@@ -169,6 +170,7 @@
                                 {% endif %}
                                 {% endif %}
                             {% endif %}
                             {% endif %}
 
 
+                            {{ run_hook("flaskbb_tpl_post_menu_after", post=post) }}
                             </div> <!-- end post-menu -->
                             </div> <!-- end post-menu -->
                         </div> <!-- end footer -->
                         </div> <!-- end footer -->
 
 

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

@@ -115,6 +115,8 @@
             {% else %}
             {% else %}
             <div class="btn btn-primary"><span class="fa fa-lock fa-fw"></span> {% trans %}Locked{% endtrans %}</div>
             <div class="btn btn-primary"><span class="fa fa-lock fa-fw"></span> {% trans %}Locked{% endtrans %}</div>
             {% endif %}
             {% endif %}
+
+            {{ run_hook("flaskbb_tpl_topic_controls") }}
         </div>
         </div>
     </div>
     </div>
 {% endif %} {# end current_user.is_authenticated #}
 {% endif %} {# end current_user.is_authenticated #}

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

@@ -101,6 +101,7 @@
 
 
                             <!-- Report/Edit/Delete/Quote Post-->
                             <!-- Report/Edit/Delete/Quote Post-->
                             <div class="post-menu pull-right">
                             <div class="post-menu pull-right">
+                            {{ run_hook("flaskbb_tpl_post_menu_before", post=post) }}
 
 
                             {% if current_user|post_reply(topic) %}
                             {% if current_user|post_reply(topic) %}
                             <!-- Quick quote -->
                             <!-- Quick quote -->
@@ -164,6 +165,7 @@
                                 {% endif %}
                                 {% endif %}
                             {% endif %}
                             {% endif %}
 
 
+                            {{ run_hook("flaskbb_tpl_post_menu_after", post=post) }}
                             </div> <!-- end post-menu -->
                             </div> <!-- end post-menu -->
                         </div> <!-- end footer -->
                         </div> <!-- end footer -->