{% load navigation_tags %}

{% if link.separator %}
    <li role="separator" class="divider"></li>
{% elif link.text_span %}
    <li class="text-center link-text-span {{ link.html_extra_classes }}" >{{ link.text }}</li>
{% else %}
    {% navigation_link_get_icon link=link as link_icon %}

    {% if link.disabled %}
        <a class="{{ link.html_extra_classes }} {% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %} disabled" disabled='disabled' style="cursor: default;" href="#">{% if link_icon %}{{ link_icon.render }}{% endif %} {{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>
    {% else %}
        <a
            class="{{ link.html_extra_classes }} {% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %}"
            {% for key,value in link.html_data.items %}
                data-{{ key }}={{ value }}
            {% endfor %}

        {% if link.html_extra_attributes %}{{ link.html_extra_attributes }}{% endif %}
        {% if link.url %}href="{{ link.url }}"{% endif %}
        >{% if link_icon and not hide_icon %}{{ link_icon.render }}{% endif %}
        {{ link.text|default:'' }}{% if link.badge_text %}&nbsp;<span class="badge">{{ link.badge_text }}</span>
        {% endif %}{% if link.error %} - {{ link.error }}{% endif %}
        </a>
    {% endif %}
{% endif %}
