""" Pylot's macro """ {#:: oauth_login_buttons Turn a list of with buttons name into a social login button ::#} {% macro oauth_login_buttons(buttons, size="md", text="Signin with #provider") %} {% for button in buttons %} {% set name = button %} {% if button == "google" %} {% set button = "google-plus" %} {% endif %} {% set text = text.replace("#provider", name) %} {{ oauth_login_button(button, text, size) }} {% endfor %} {% endmacro %} {#:: oauth_login_button Create a social login button ::#} {% macro oauth_login_button(button, text, size="") %} {{ text | title }} {% endmacro %} {#:: static(url) ::#} {#:: Include static assets ::#} {%- macro static(url) -%} {%- if not url.startswith('http') and not url.startswith('//') -%} {%- set url = url_for('static', filename=url) -%} {%- endif -%} {{- url | safe -}} {%- endmacro -%} {#:: css(file) ::#} {#:: include css files ::#} {%- macro css(file) -%} {%- endmacro -%} {#:: js(file) ::#} {#:: include js file ::#} {%- macro js(file) -%} {%- endmacro -%} {#:: img(file, attributes) ::#} {#:: Insert img tag ::#} {% macro img(file, attributes={}) %} {% endmacro %} {#:: google_analytics ::#} {#:: include google analytics tags ::#} {% macro google_analytics(code) %} {% endmacro %} #---- flashed_messages() ------------------------------------------------------- # Render the flashed messages set {% macro flashed_messages(dismissible=True) %} {% for category, message in get_flashed_messages(with_categories=True) %} {%endfor%} {% endmacro %} #---- alert() ---------------------------------------------------------- {% macro alert(message, category="info", dismissible=True) %} {% endmacro %} #---- pagination() -------------------------------------------------------- {% macro pagination(paginator, endpoint=None) %} {% if not endpoint %} {% set endpoint = request.endpoint %} {% endif %} {% if "page" in kwargs %} {% set _ = kwargs.pop("page") %} {% endif %} {% endmacro %}