<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>
        {% block title %}
            {%- if not page_title -%}
                {{ config["PROJECT_TITLE"] }} - {{ config["PROJECT_SUBTITLE"] }}
            {%- else -%}
                {{ page_title }} - {{ config["PROJECT_TITLE"] }}
            {%- endif -%}
        {% endblock %}
        </title>
        <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">

        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">

        {% block css %}
        <link rel="stylesheet" href="{{ url_for('static', filename='css/code.css') }}">
        <link rel="stylesheet" href="{{ theme_static('css/bootstrap.min.css') }}">
        <link rel="stylesheet" href="{{ theme_static('css/bootstrap-theme.min.css') }}">
        <link rel="stylesheet" href="{{ theme_static('css/font-awesome.min.css') }}">
        <link rel="stylesheet" href="{{ theme_static('css/flaskbb.css') }}">
        {% endblock %}
    </head>

    <body>
        <div id="wrap">
        {% block navigation %}
        {%- from "macros.html" import topnav with context -%}
        <!-- Navigation -->
            <nav class="navbar navbar-default navbar-inverse navbar-static-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="/">FlaskBB</a>
                    </div>
                    <div class="collapse navbar-collapse navbar-ex1-collapse">
                        <ul class="nav navbar-nav">
                            {# active_forum_nav is set in {forum, category, topic}.html and new_{topic, post}.html #}
                            {{ topnav(endpoint='forum.index', name='Forum', icon='fa fa-comment', active=active_forum_nav) }}
                            {{ topnav(endpoint='forum.memberlist', name='Memberlist', icon='fa fa-user') }}
                        </ul>

                    {% if current_user and current_user.is_authenticated() %}
                        <div class="btn-group navbar-btn navbar-right" style="padding-left: 15px; margin-right: -10px">
                            <a class="btn btn-primary" href="{{ url_for('user.profile', username=current_user.username) }}">
                                <span class="fa fa-user"></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"></span> Topic Tracker</a></li>
                                <li class="divider"></li>

                                <li><a href="{{ url_for('user.settings') }}"><span class="fa fa-cogs"></span> Settings</a></li>
                                {% if current_user.permissions['admin'] %}
                                <li><a href="{{ url_for('admin.overview') }}"><span class="fa fa-cog"></span> Admin Panel</a></li>
                                <li class="divider"></li>
                                {% endif %}

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

                        <div class="btn-group navbar-btn navbar-right">
                            <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
                                <span class="fa fa-envelope"></span> <span class="badge">{{ current_user.pm_unread }}</span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="{{ url_for('user.inbox') }}"><span class="fa fa-envelope"></span> Inbox</a></li>
                                <li><a href="{{ url_for('user.new_message') }}"><span class="fa fa-pencil"></span> New Message</a></li>
                            </ul>
                        </div>
                    {% else %}
                        <div class="btn-group navbar-btn navbar-right">
                            <a class="btn btn-primary" href="{{ url_for('auth.login') }}">
                                <span class="fa fa-user"></span> Login
                            </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('auth.register') }}">Register</a></li>
                                <li><a href="{{ url_for('auth.forgot_password') }}">Reset Password</a></li>
                            </ul>
                        </div>
                    {% endif %}
                        <form class="navbar-form navbar-right" role="search">
                            <div class="form-group">
                                <input type="text" class="form-control" placeholder="Search">
                            </div>
                        </form>
                    </div><!-- nav-collapse -->
                </div><!-- container -->
            </nav> <!-- navbar navbar-inverse -->
            {% endblock %}


            <div class="container">
                {% block messages %}
                    {% include 'flashed_messages.html' %}
                {% endblock %}

                {% block content %}
                {% endblock %}
            </div> <!-- /container -->
        </div> <!-- End wrap -->

            {% block footer %}
            <div id="footer">
                <div class="container">
                    <p class="text-muted credit pull-left">powered by <a href="http://flask.pocoo.org">Flask</a></p>
                    <p class="text-muted credit pull-right">&copy; 2013 - <a href="http://flaskbb.org">FlaskBB.org</a></p>
                </div>
            </div>
            {% endblock %}

        {% block javascript %}
        <script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
        <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
        {% endblock %}
    </body>
</html>
