""" Pilot's macr """ {#: social_login_buttons Turn a list of with buttons name into a social login button #} {% macro social_login_buttons(buttons, size) %} {% for button in buttons %} {% set name = button %} {% if button == "google" %} {% set button = "google-plus" %} {% endif %} {% set text = "Sign in with %s " % name %} {{ social_login_button(button, text, size) }} {% endfor %} {% endmacro %} {#: social_login_button Create a social login button #} {% macro social_login_button(button, text, size="") %} {{ text | title }} {% endmacro %} # ---- include_css_file() ------------------------------------------------------ {%- macro include_css_file(file) -%} {%- if file.startswith('http') or file.startswith('//') -%} {%- set src = file -%} {%- else -%} {% set src = url_for('static', filename=file) %} {%- endif -%} {%- endmacro -%} # ---- include_js_file() ------------------------------------------------------ {%- macro include_js_file(file) -%} {%- if file.startswith('http') or file.startswith('//') -%} {%- set src = file -%} {%- else -%} {%- set src = url_for('static', filename=file) -%} {%- endif -%} {%- endmacro -%} # ---- img_src() ------------------------------------------------------ {% macro img_src(file, attributes={}) %} {%- if file.startswith('http') or file.startswith('//') %} {% set src = file %} {% else %} {% set src = url_for('static', filename=file) %} {% endif -%} {% endmacro %} # ---- static_url() ------------------------------------------------------ {% macro static_url(url) %} {%- if not file.startswith('http') and not file.startswith('//') %} {% set url = url_for('static', filename=file) %} {% endif -%} {{ url | safe }} {% endmacro %} # ---- google_analytics() ------------------------------------------------------ {% macro google_analytics(code) %} {% endmacro %} #---- show_flashed_messages() ------------------------------------------------------- # Render the flashed messages set {% macro show_flashed_messages(dismissible=True) %} {% for category, message in get_flashed_messages(with_categories=True) %} {%endfor%} {% endmacro %} #---- alert_message() ---------------------------------------------------------- {% macro alert_message(message, category="info", dismissible=False) %} {% endmacro %} #---- show_pagination() -------------------------------------------------------- {% macro show_pagination(paginator, endpoint, kwargs={}) %} {% endmacro %}