{% set page_title = active_nav.get('title') %}

{% extends theme("management/management_layout.html") %}

{% block breadcrumb %}
<ol class="breadcrumb flaskbb-breadcrumb">
    <li class="breadcrumb-item"><a href="{{ url_for('forum.index') }}">{% trans %}Forum{% endtrans %}</a></li>
    <li class="breadcrumb-item"><a href="{{ url_for('management.overview') }}">{% trans %}Management{% endtrans %}</a></li>
    <li class="breadcrumb-item active">{{ active_nav.get('title') }}</li>
</ol>
{% endblock %}

{% block management_content %}
{%- from theme('_macros/navigation.html') import sidebaritems -%}
{%- from theme('_macros/form.html') import render_field -%}

{% set extra_setting_links = run_hook("flaskbb_tpl_admin_settings_sidebar", user=current_user, is_markup=False) %}

<div class="col-md-3 settings-col">
    <div class="nav-sidebar">
        <ul class="nav">
            <li class="nav-item nav-header">FlaskBB Settings</li>
        {% for group in all_groups %}
            {% if group.key == active_nav.get('key') %}
                <li class="nav-item">
                    <a class="nav-link active" href="{{ url_for('management.settings', slug=group.key) }}">{{ group.name }}</a>
                </li>
            {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('management.settings', slug=group.key) }}">{{ group.name }}</a>
                </li>
            {% endif %}
        {% endfor %}
        {% if all_plugins or extra_setting_links|length %}
            <li class="nav-item nav-header">Plugin Settings</li>
        {% for plugin in all_plugins %}
            <li class="nav-item">
                <a class="nav-link {% if plugin.name == active_nav.get('key') %}active{% endif %}" href="{{ url_for('management.settings', plugin=plugin.name) }}">{{ plugin.name.title() }}</a>
            </li>
        {% endfor %}

        {{ sidebaritems(extra_setting_links) }}
        {% endif %}
        </ul>
    </div>
</div><!--/.col-md-3 -->

<div class="col-md-9 settings-col with-left-border">
    <div class="card settings">
        <div class="card-header settings-header">
            <span class="fa fa-cogs"></span> {{ active_nav.get('title') }}
        </div>
        <div class="card-body settings-body">
            <form class="row p-2" role="form" method="post">
                {{ form.hidden_tag() }}
                {% for field in form %}
                    {% if field.type != "CSRFTokenField" %}
                        {{ render_field(field, div_class="col-12 mb-3") }}
                    {% endif %}
                {% endfor %}

                <div class="form-group">
                    <div class="col-sm-5">
                        <button type="submit" class="btn btn-success">
                            {% trans %}Save{% endtrans %}
                        </button>
                    </div>
                </div>

            </form>
        </div> <!-- end settings-body -->
    </div>
</div>
{% endblock %}
