{% macro icon(cat,name, extra_classes) -%}
<i class="fa-{{cat}} fa-{{name}} {{extra_classes}}"></i>
{%- endmacro -%}

{% macro btn_share(href,content,class='primary') -%}
<div class="btn-group">
    <a href="{{href}}" class="btn btn-{{class}} share-link">{{content}}</a>
</div>
{%- endmacro -%}

{% macro modal(id,title,content,footer="",show=False) -%}

<div class="modal fade " id="{{id}}" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLongTitle">{{title}}</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>

            </div>
            <div class="modal-body">
                {{content|safe}}
            </div>
            <div class="modal-footer">
                {{footer|safe}}
                {% if not footer %}
                <button type="button" class="btn btn-secondary" data-dismiss="modal">{{_('close')}}</button>
                {% endif %}
            </div>
        </div>
    </div>
</div>

{% if show %}
<script>
    $("#{{id}}").modal()
</script>
{% endif %}
{%- endmacro -%}


{% macro menu_post(href,text, extra_classes) -%}
<form method="post" action="{{href}}">
    <button type="submit" class="nav-item {{extra_classes}}">
        {{text}}
    </button>
</form>
{%- endmacro -%}



{% macro render_nav_item(endpoint, text, _badge='', _use_li=False,extra_class="") %}
{% set active = True if request.endpoint and request.endpoint == endpoint else False %}
{% set url = endpoint if "://" in endpoint else hurl_for(endpoint, **kwargs) %}
{% if _use_li %}<li class="nav-item">{% endif %}
    <a class="{{extra_class}} {% if not _use_li %}nav-item {% endif %}nav-link{% if active %} active" aria-current="page{% endif %}" href="{{ url }}">
        {{ text }} {% if _badge %}<span class="badge badge-light">{{ _badge }}</span>{% endif %}
    </a>
    {% if _use_li %}
</li>{% endif %}
{% endmacro %}










{% extends 'base/utils.html' %}

{# This macro was part of Flask-Bootstrap and was modified under the terms of
its BSD License. Copyright (c) 2013, Marc Brinkmann. All rights reserved. #}

{# versionadded: New in 1.2.0 #}

{% macro render_toast(messages=None, container=False, transform={
'critical': 'danger',
'error': 'danger',
'info': 'info',
'warning': 'warning',
'debug': 'primary',
'notset': 'primary',
'message': 'primary',
}, default_category=config.BOOTSTRAP_MSG_CATEGORY, dismissible=False, dismiss_animate=False) -%}

{% with messages = messages or get_flashed_messages(with_categories=True) -%}
{% if messages -%} {# don't output anything if there are no messages #}

<div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-autohide="false">
    <!-- Position it -->
    <div style="position: absolute; top: 0; right: 0; z-index: 9999;">

        {% for cat, msg in messages %}
        <div role="alert" aria-live="assertive" aria-atomic="true" class="toast" data-autohide="false">

            <div class="toast-header">
                <img src="..." class="rounded mr-2" alt="...">
                <strong class="mr-auto">Bootstrap</strong>
                <small>11 mins ago</small>
                <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="toast bg-{{ transform.get(cat.lower(), cat or default_category) }}{% if dismissible %} alert-dismissible {% if dismiss_animate %}fade show{% endif %}{% endif %}" role="alert" aria-live="assertive"
                aria-atomic="true">
                {% if dismissible %}
                <button type="button" class="close" data-dismiss="toast" aria-label="Close"><span aria-hidden="true">&times;</span></button>{% endif %}
                {{ msg }}
            </div>
            {%- endfor -%}
        </div>
    </div>
</div>
{% endif -%}
{% endwith -%}
{% endmacro -%}