{# Widget A collection of some of Bootstrap components Most of the macros must be called in your template around the content to be wrapped in {% call collapsible('My Title') %} This is the body {% endcall %} #} {# -------------------------------------------------------------------------- #} {# widget.alert(): display alert message widget.alert(message, category, dismissible) - message: The message to display - category: the category (info, success, danger, warning) - Dismissible: When True it will show a close button #} {% macro alert(message, category="info", dismissible=True) %} {% endmacro %} {# -------------------------------------------------------------------------- #} {# widget.flashed_messages(): display message by flask's flash() widget.flashed_messages(dismissible) - dimissible: Boolean When True it will show a close button #} {% macro flashed_messages(dismissible=True) %} {% for category, message in get_flashed_messages(with_categories=True) %} {{ alert(message=message, category=category, dismissible=dismissible) }} {%endfor%} {% endmacro %} {# -------------------------------------------------------------------------- #} {# -------------------------------------------------------------------------- #} {# macros below should be called with call #} {%- macro _format_key(val, def) -%} {{- val | default(def, true) | slug -}} {%- endmacro -%} {# collapsible() {% call collapsible('title', key, collapse, parent) %} content {% endcall %} params: - title: The title of the collapsible - key: a unique to identify this collapsible - collapse: (bool) to collapse or expend the component - parent: when using 'collapsible_accordion', pass the parent id #} {% macro collapsible(title, key=none, collapse=false, parent="accordion") %}
{{ caller() }}
{% endmacro %} {# accordion() Requires the use of collapsable {% call accordion() %} {% call collapsible('My Acc Name') %} ... content {% endcall %} {% endcall %} params: - id: a unique identifier #} {% macro accordion(id="accordion") %}
{{ caller() }}
{% endmacro %} {# -------------------------------------------------------------------------- #} {# widget.panel(title, class, type) - title: The title - class: the class to apply on the panel - type: string: - table: it will make the table responsive #} {% macro panel(title, class="panel-default", type=None) %}

{{ title }}

{% if type == "table" %}
{{ caller() }}
{% else %}
{{ caller() }}
{% endif %}
{% endmacro %} {# -------------------------------------------------------------------------- #} {# widget.modal(title, id, class="") - title: of the modal - id: of the modal - classes By default modal doesn't have footer. - To add a footer, in your caller() add the footer in the