{% extends 'allianceauth/base-bs5.html' %}

{% load i18n %}
{% load static %}
{% load custom_filters %}
{% load navactive %}

{% block page_title %}Wiki{% endblock %}

{% block header_nav_collapse_right %}
<li class="nav-item">
    <a class="{% if current_path == '/wiki/search/' %}active{% endif %} nav-link" href="{% url 'simplewiki:search' %}">
        <i class="fas fa-search"></i>
        Search
    </a>
</li>
{% if is_editor is True %}
<li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle {% if '/wiki/editor/' in current_path or '/wiki/guides/' in current_path %}active{% endif %}" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
        <i class="fas fa-user-cog"></i>
        Editor
        <span class="caret"></span>
    </a>
    <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
        <li>
            <a class="dropdown-item {% navactive request 'simplewiki:editor_menus' %}" href="{% url 'simplewiki:editor_menus' %}">
                Edit Menus
            </a>
        </li>
        <li>
            <a class="dropdown-item {% navactive request 'simplewiki:editor_sections' %}" href="{% url 'simplewiki:editor_sections' %}">
                Edit Sections
            </a>
        </li>
        <li><hr class="dropdown-divider"></li>
        <li>
            <a class="dropdown-item {% navactive request 'simplewiki:editor_sort' %}" href="{% url 'simplewiki:editor_sort' %}">
                Edit Menu Layout
            </a>
        </li>
        <li><hr class="dropdown-divider"></li>
        <li>
            <a class="dropdown-item" target="_blank" href="https://github.com/meowosaurus/aa-simplewiki/wiki">
                Documentation
            </a>
        </li>
        <li>
            <a class="dropdown-item {% navactive request 'simplewiki:editor_markdown_guide' %}" target="_blank" href="{% url 'simplewiki:editor_markdown_guide' %}">
                Markdown Guide
            </a>
        </li>
    </ul>
</li>
{% endif %}
{% endblock header_nav_collapse_right %}

{% block header_nav_collapse_left %}
{% for item in navbar %}
    {% if item.submenus %}
        {% with submenu_paths=item.path|get_submenu_paths %}
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle {% if current_path|any_paths_current:submenu_paths %}active{% endif %}" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                {% if item.icon|length > 0 %}
                    <i class="{{ item.icon }}" style="display: inline-block;"></i>
                {% endif %}
                {{ item.title }}
                <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                {% for submenu in item.submenus %}
                <li>
                    <a class="{% if submenu.path in current_path %}active{% endif %} dropdown-item" href="{% url 'simplewiki:dynamic_menu' menu_path=submenu.path %}">
                        {% if item.icon|length > 0 %}
                        <i class="{{ submenu.icon }}" style="display: inline-block;"></i>
                        {% endif %}
                        {{ submenu.title }}
                    </a>
                </li>
                {% endfor %}
            </ul>
        </li>
        {% endwith %}
    {% else %}
    <li class="nav-item">
        <a class="nav-link {% if item.path in current_path %}active{% endif %}" aria-current="page" href="{% url 'simplewiki:dynamic_menu' menu_path=item.path %}">
            {% if item.icon|length > 0 %}
                <i class="{{ item.icon }}" style="display: inline-block;"></i>
            {% endif %}
            {{ item.title }}
        </a>
    </li>
    {% endif %}
{% endfor %}
{% endblock header_nav_collapse_left %}

{% block content %}

{% block details %}{% endblock %}

{% endblock %}

{% block extra_css %}
<style>
    html {
        scroll-behavior: smooth;
    }
</style>
{% endblock %}