<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="FlaskBB is a forum software written in Flask">
        <meta name="author" content="FlaskBB Team">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">

        <title>
        {% block title %}
            {%- if not page_title -%}
                {{ flaskbb_config["PROJECT_TITLE"] }} - {{ flaskbb_config["PROJECT_SUBTITLE"] }}
            {%- else -%}
                {{ page_title }} - {{ flaskbb_config["PROJECT_TITLE"] }}
            {%- endif -%}
        {% endblock %}
        </title>

        {% block stylesheets %}
        <!-- syntax highlighting -->
        <link rel="stylesheet" href="{{ url_for('static', filename='css/pygments.css') }}">
        <!-- bootstrap & aurora theme -->
        <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
        <!-- lato font -->
        <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
        <!-- emoji -->
        <script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.5"></script>
        {% endblock %}

        {# for extra stylesheets. e.q. a template has to add something #}
        {% block css %}
        {% endblock %}

        {# for various extra things #}
        {% block head_extra %}
        {% endblock %}
    </head>

    <body>

        <!-- main forum layout -->
        <div class="flaskbb-layout">
            <div class="container">

                <!-- forum header - place for the project title and subtitle -->
                {% block header %}
                <div class="flaskbb-header">
                    <div class="flaskbb-meta">
                        <div class="flaskbb-title">{{ flaskbb_config["PROJECT_TITLE"] }}</div>
                        <div class="flaskbb-subtitle">{{ flaskbb_config["PROJECT_SUBTITLE"] }}</div>
                    </div>
                </div>
                {% endblock %}

                <!-- forum menu - contains all the navigation items -->
                {% block navigation %}
                <div class="navbar navbar-default" role="navigation">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                      </button>
                    </div>

                    <div class="collapse navbar-collapse" id="navbar-collapse">
                        <!-- navbar left -->
                        <ul class="nav navbar-nav forum-nav">
                            {%- from theme("macros.html") import is_active, topnav with context -%}

                            {{ run_hook("flaskbb_tpl_navigation_before") }}
                            {{ topnav(endpoint='forum.index', name=_('Forum'), icon='fa fa-comment', active=active_forum_nav) }}
                            {{ topnav(endpoint='forum.memberlist', name=_('Memberlist'), icon='fa fa-user') }}
                            {{ topnav(endpoint='forum.search', name=_('Search'), icon='fa fa-search') }}
                            {{ run_hook("flaskbb_tpl_navigation_after") }}
                        </ul>

                        <!-- navbar right -->
                        <ul class="nav navbar-nav navbar-right">
                            {% if current_user and current_user.is_authenticated %}

                            {{ run_hook("flaskbb_tpl_user_nav_loggedin_before") }}

                            <!-- User Menu -->
                            <li>
                                <div class="btn-group navbar-btn user-btn">
                                    <a class="btn btn-primary" href="{{ url_for('user.profile', username=current_user.username) }}">
                                        <span class="fa fa-user fa-fw"></span> {{ current_user.username }}
                                    </a>
                                    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="{{ url_for('forum.topictracker') }}"><span class="fa fa-book fa-fw"></span> {% trans %}Topic Tracker{% endtrans %}</a></li>
                                        <li class="divider"></li>

                                        <li><a href="{{ url_for('user.settings') }}"><span class="fa fa-cogs fa-fw"></span> {% trans %}Settings{% endtrans %}</a></li>
                                        {% if current_user|is_admin_or_moderator %}
                                        <li><a href="{{ url_for('management.overview') }}"><span class="fa fa-cog fa-fw"></span> {% trans %}Management{% endtrans %}</a></li>
                                        <li class="divider"></li>
                                        {% endif %}

                                        <li><a href="{{ url_for('auth.logout') }}"><span class="fa fa-power-off fa-fw"></span> {% trans %}Logout{% endtrans %}</a></li>
                                    </ul>
                                </div>
                            </li>

                            {{ run_hook("flaskbb_tpl_user_nav_loggedin_after") }}

                            {% else %}
                            <!-- Not logged in - Login/Register -->
                            <li>
                                <div class="btn-group navbar-btn user-btn">
                                    <a class="btn btn-primary" href="{{ url_for('auth.login') }}">
                                        <span class="fa fa-user fa-fw"></span> {% trans %}Login{% endtrans %}
                                    </a>
                                    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
                                    <ul class="dropdown-menu" role="menu">
                                        {% if flaskbb_config["REGISTRATION_ENABLED"] %}
                                        <li><a href="{{ url_for('auth.register') }}"><span class="fa fa-user-plus fa-fw"></span> {% trans %}Register{% endtrans %}</a></li>
                                        {% endif %}
                                        <li><a href="{{ url_for('auth.forgot_password') }}"><span class="fa fa-undo fa-fw"></span> {% trans %}Reset Password{% endtrans %}</a></li>
                                    </ul>
                                </div>
                            </li>
                            {% endif %}

                        </ul> <!-- end navbar right -->
                    </div> <!-- end navbar-collapse -->
                </div> <!-- end navbar -->
                {% endblock %}

                <!-- Place for all the (flashed) messages -->
                {% block messages %}
                <div id="flashed-messages">
                    {% include theme('flashed_messages.html') %}
                </div>
                {% endblock %}

                <!-- the actual content block -->
                {% block content %}
                {% endblock %}
            </div> <!-- end container -->

            <!-- the forum footer -->
            {% block footer %}
            <footer class="flaskbb-footer">
                <div class="container">
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                            <div class="text-muted text-left">{{ flaskbb_config["PROJECT_COPYRIGHT"] | safe }}</div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                            <div class="text-muted text-right">powered by <a href="https://flaskbb.org">FlaskBB</a></div>
                            <div class="text-muted text-right">&copy; 2013 - {{ now.year }} <a href="https://flaskbb.org">FlaskBB Team</a></div>
                        </div>
                    </div>
                </div>
            </footer>
            {% endblock %}

        </div> <!-- end flaskbb-layout -->

        {% block javascript %}
        <!-- jquery and bootstrap and flaskbb.js -->
        <script src="{{ url_for('static', filename='js/scripts.min.js') }}"></script>
        <!-- Enable tooltips in all templates -->
        <script>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        })
        </script>
        {% endblock %}

        {# for extra scripts in other templates. #}
        {% block scripts %}
        {% endblock %}
    </body>
</html>
