{% import "Harambe/components/html.html" as html with context %} {%- macro _format_key(val, def) -%} {{- val | default(def, true) | slug -}} {%- endmacro -%} {# 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 collapse('My Title') %} This is the body {% endcall %} #} #---- ALERT -------------------------------------------------------------------- {# 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(category="info", dismissible=False) %} {% endmacro %} #---- FLASHED_MESSAGES --------------------------------------------------------- {# 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) %} {% call alert(category=category, dismissible=dismissible) %} {{ message | safe }} {% endcall %} {%endfor%} {% endmacro %} #---- COLLAPSE ----------------------------------------------------------------- {# collapse() {% call collapse('title', key, collapse, parent) %} content {% endcall %} params: - title: The title of the collapse - key: a unique to identify this collapse - collapse: (bool) to collapse or expend the component - parent: when using 'accordion', pass the parent id #} {% macro collapse(class="panel-default") %}
{{ caller() | safe }}
{% endmacro %} {% macro collapse_header(body_id, accordion_id="") %} {% endmacro %} {% macro collapse_content(id, open=false) %}
{{ caller() | safe }}
{% endmacro %} {% macro collapse_body(id, open=false) %}
{{ caller() | safe }}
{% endmacro %} #---- ACCORDION ---------------------------------------------------------------- {# accordion() Requires the use of collapse {% call accordion() %} {% call collapse('My Acc Name') %} ... content {% endcall %} {% endcall %} params: - id: a unique identifier #} {% macro accordion(id="accordion") %}
{{ caller() | safe }}
{% endmacro %} {% macro accordion_style() %} {% endmacro %} #---- PANEL -------------------------------------------------------------------- {# 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=None, class="panel-default") %}
{% if title %} {% call panel_header() %}

{{ title | safe }}

{% endcall %} {% endif %} {{ caller() | safe }}
{% endmacro %} {% macro panel_header() %}
{{ caller() | safe }}
{% endmacro %} {% macro panel_body() %}
{{ caller() | safe }}
{% endmacro %} {% macro panel_footer() %} {% endmacro %} {% macro panel_table() %}
{{ caller() | safe }}
{% endmacro %} {% macro panel_header_title_link(href="#", class="", id="") %} {% endmacro %} #---- MODAL -------------------------------------------------------------------- {# widget.modal(id, title="", class="") - id: the id of the modal, required - title: of the modal - class: of the modal You will need to include {% call modal_header() %}

This is my header

{% endcall %} {% call modal_body() %} body {% endcall %} {% call modal_footer() %} footer {% endcall %} #} {% macro modal(id, title=None, class="") %} {% endmacro %} {% macro modal_header(title=None, tag="h4", close_button=true) %} {% endmacro %} {% macro modal_body() %} {% endmacro %} {% macro modal_footer() %} {% endmacro %} {% macro modal_link(modal_id, title, href="#", class="", id="", data={} ) %} {{ title | safe }} {% endmacro %} #---- PAGINATE --------------------------------------------------------------- {# paginate :paginator: iterator :endpoint: :prev: Text for previous button :next: Text for Next button :class: A class name for pagination if customed. If you are extending the class best to add the original class and your custom class ie: 'pagination my_custom_pagination' or 'pager my_custom_page' :pager: If true it will show a pager instead of numbered pagination :mobile: if True, if will show the pagination into a 'pager' #} {% macro paginate(paginator, endpoint=None, prev="Prev", next="Next", class=None, pager=False, mobile=True) %} {% if mobile %} {% else %} {{ _pagination(paginator, endpoint, prev, next, class, pager, **kwargs) }} {% endif %} {% endmacro %} {% macro _pagination(paginator, endpoint=None, prev="", next="", class=None, pager=False) %} {% if not endpoint %} {% set endpoint = request.endpoint %} {% endif %} {% if "page" in kwargs %} {% set _ = kwargs.pop("page") %} {% endif %} {% if not class %} {% set class = "pagination" %} {% if pager %} {% set class = "pager" %} {% endif %} {% endif %} {% set _prev_btn = " %s" % prev %} {% set _next_btn = "%s " % next %} {% endmacro %} #--- DROPDOWN ------------------------------------------------------------------ {% macro dropdown(title="", id="dropdown1", class="btn btn-default", dropup=false, group=false) %}
{% endmacro %} #--- GROUP --------------------------------------------------------------------- {% macro group(class='btn-group') %}
{{ caller() | safe }}
{% endmacro %} #---- NAVBAR ------------------------------------------------------------------- {# Create Navbar. This is the parent element. Include all the sub elements in there :params - fluid: container fluid - static_top: Create a full-width navbar that scrolls away - fixed_top: stick the nav to the top - fixed_bottom: stick the nav to the bottom - fixed_padding: the padding that will be added #} {% macro navbar(fluid=true, static_top=true, fixed_top=false, fixed_bottom=false, fixed_padding="70px") %} {% if fixed_top or fixed_bottom %} {% endif %} {% endmacro %} {# Create a header that contains the brand and the hamburger #} {% macro navbar_header(href="#", class="", id="1", style_toggle=true) %} {% if style_toggle %} {{ navbar_style_toggle() }} {% endif %} {% endmacro %} {% macro navbar_body(id="1") %} {% endmacro %} {% macro navbar_nav(position="left") %} {% endmacro %} {% macro navbar_dropdown(title="", href="#", id="dropdown1", class="btn btn-default") %} {% endmacro %} {% macro navbar_form(action="", method="GET", id="", class="", position="") %} {% endmacro %} {# Create a button in the navbar that's not in a FORM params: class: class name id: id data_toggle: the type of toggle, ie: modal, dropdown data_target: the toggle target, ie: the #id of the modal #} {% macro navbar_button(class="btn-default", id="", data_toggle="", data_target="") %} {% endmacro %} {% macro navbar_text(class="", id="", position="") %} {% endmacro %} {% macro navbar_link(href="#", class="", id="", data_toggle="", data_target="" ) %} {{ caller() | safe }} {% endmacro %} {% macro navbar_style_toggle() %} {% endmacro %} #------------------------------------------------------------------------------- {% macro share_buttons(text=None, url=None, show_count=False, show_label=True, buttons=["facebook", "twitter", "googleplus"]) %}
{% endmacro %}