Browse Source

Add docs for some newly added events

sh4nks 8 years ago
parent
commit
c48f63d7dd
1 changed files with 58 additions and 12 deletions
  1. 58 12
      docs/events.rst

+ 58 - 12
docs/events.rst

@@ -12,7 +12,7 @@ events.
     request. The pull request should always contain a entry in this document
     request. The pull request should always contain a entry in this document
     with a small example.
     with a small example.
 
 
-    A event can be created by placing a :func:`~flask.ext.plugins.emit_event`
+    An event can be created by placing a :func:`~flask_plugins.emit_event`
     function at specific places in the code which then can modify the behavior
     function at specific places in the code which then can modify the behavior
     of FlaskBB. The same thing applies for template events.
     of FlaskBB. The same thing applies for template events.
 
 
@@ -32,26 +32,26 @@ events.
         {{ emit_event("your-newly-contributed-template-event") }}
         {{ emit_event("your-newly-contributed-template-event") }}
 
 
 
 
-Available Events
-----------------
-
-
 Python Events
 Python Events
-~~~~~~~~~~~~~
+-------------
 
 
-None at the moment. :(
+None at the moment.
 
 
 
 
 Template Events
 Template Events
-~~~~~~~~~~~~~~~
+---------------
+
+Template events, which are used in forms, are usually rendered after the
+hidden CSRF token field and before an submit field.
+
 
 
 .. data:: before-first-navigation-element
 .. data:: before-first-navigation-element
 
 
+    in ``templates/layout.html``
+
     This event inserts a navigation link **before** the **first** navigation
     This event inserts a navigation link **before** the **first** navigation
     element is rendered.
     element is rendered.
 
 
-    Example:
-
     .. sourcecode:: python
     .. sourcecode:: python
 
 
         def inject_navigation_element():
         def inject_navigation_element():
@@ -62,11 +62,11 @@ Template Events
 
 
 .. data:: after-last-navigation-element
 .. data:: after-last-navigation-element
 
 
+    in ``templates/layout.html``
+
     This event inserts a navigation link **after** the **last** navigation
     This event inserts a navigation link **after** the **last** navigation
     element is rendered.
     element is rendered.
 
 
-    Example:
-
     .. sourcecode:: python
     .. sourcecode:: python
 
 
         def inject_navigation_element():
         def inject_navigation_element():
@@ -75,3 +75,49 @@ Template Events
         connect_event("after-last-navigation-element", inject_navigation_element)
         connect_event("after-last-navigation-element", inject_navigation_element)
 
 
 
 
+.. data:: before-registration-form
+
+    in ``templates/auth/register.html``
+
+    This event is emitted in the Registration form **before** the first
+    input field but after the hidden CSRF token field.
+
+    .. sourcecode:: python
+
+        connect_event("before-registration-form", do_before_register_form)
+
+
+.. data:: after-registration-form
+
+    in ``templates/auth/register.html``
+
+    This event is emitted in the Registration form **after** the last
+    input field but before the submit field.
+
+    .. sourcecode:: python
+
+            connect_event("after-registration-form", do_after_register_form)
+
+
+.. data:: before-update-user-details
+
+    in ``templates/user/change_user_details.html``
+
+    This event is emitted in the Change User Details form **before** an
+    input field is rendered.
+
+    .. sourcecode:: python
+
+        connect_event("before-update-user-details", do_before_update_user_form)
+
+
+.. data:: after-update-user-details
+
+    in ``templates/user/change_user_details.html``
+
+    This event is emitted in the Change User Details form **after** the last
+    input field has been rendered but before the submit field.
+
+    .. sourcecode:: python
+
+        connect_event("after-update-user-details", do_after_update_user_form)