Macros ====== These macros will help you to generate Rings codes quickly and easily. render_field() -------------- Render a field of a form created with Flask-WTF/WTForms. Example ^^^^^^^ .. code:: jinja {% from 'rings/wtf.html' import render_field %}
{{ form.hidden_tag() }} {{ render_field(form.username) }} {{ render_field(form.password) }} {{ render_field(form.submit) }}
Args ^^^^ .. py:function:: render_field(field, button_type="blue", class="") :param field: The field to render :param button_type: The style of the submit button, defaults to "blue" :param class: The extra classes to be added to the field render_form() ------------- Render a form created with Flask-WTF/WTForms. Example ^^^^^^^ .. code:: jinja {% from 'rings/wtf.html' import render_form %}

Form title

{{ render_form(form) }} Args ^^^^ .. py:function:: render_form(form, action="", method="POST", class="", role="form", id="", submit_button_type="blue") :param form: The form (generated by wtforms) to render :param action: The URL to receive form data, defaults to current URL :param method: The HTTP Method to send form data, only supports GET and POST :param class:
class attribute. :param role: role attribute. :param id: id attribute. :param submit_button_type: The style of the submit button render_nav_item() ----------------- Render a navigation item in a navigation bar. Example ^^^^^^^ .. code:: jinja {% from 'rings/nav.html' import render_nav_item %} Args ^^^^ .. py:function:: render_nav_item(endpoint, label, label_style="white", tag="", tag_style="blue") :param endpoint: The endpoint used to generate URL. :param label: The label of the navigation item. :param label_style: Custom text style for ``label`` :param tag: The tag to display :param tag_style: Custom text style for ``tag`` render_flashed_message() ------------------------ Render a flashed message. Example ^^^^^^^ .. code:: jinja {% from 'rings/utils.html' import render_flashed_message %} {% for message in get_flashed_messages(with_categories=True) %} {% if message[0] %} {% set category = message[0] %} {% else %} {% set category = 'info' %} {% endif %} {{ render_flashed_message(message[1], category) }} {% endfor %} .. py:function:: render_flashed_message(message, category="info") :param message: The message to render. :param category: The category of the message, defaults to ``info``