{% extends "_base.html" %}
{% load static %}
{% load i18n %}
{% load forum_permission_tags %}

{% block title %}{{ MACHINA_FORUM_NAME|default:"Forum" }} &mdash; {% block sub-title %}{% endblock sub-title %}{% endblock title %}

{% block css %}
    <link rel="stylesheet" href="{% static 'css/machina.board_theme.min.css' %}" />
{% endblock css %}

{% block body %}
    {% block header %}
        <div class="navbar-fixed-top-spacing">&nbsp;</div>
        <div class="navbar navbar-default navbar-fixed-top machina-navbar" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-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="/">django-machina</a>
                </div>
                <div class="collapse navbar-collapse">
                    {% block header_collapse %}
                        <div class="col-sm-7 col-md-8 col-lg-5">
                            <form class="navbar-form form-inline" role="search" action="{% url 'forum_search:search' %}">
                                <div class="form-group col-sm-7 col-md-8">
                                    <div class="input-group">
                                        <input type="text" class="form-control" placeholder="{% trans 'Search...' %}" name="q">
                                        <div class="input-group-btn">
                                            <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <a href="{% url 'forum_search:search' %}" class="btn btn-link">{% trans "Advanced search" %}</a>
                                </div>
                            </form>
                        </div>
                    {% endblock header_collapse %}
                </div>
            </div>
        </div>
    {% endblock header %}
    <div class="container" id="main_container">
        <div class="row">
            <div class="col-xs-12">
                {% block breadcrumb %}
                    {% include "partials/breadcrumb.html" %}
                {% endblock breadcrumb %}
                <div class="pull-right controls-link-wrapper">
                    {% if not request.user.is_anonymous %}
                        <a href="{% url 'forum_member:user_topics' %}" class="btn btn-link"><i class="fa fa-comments-o ">&nbsp;</i>{% trans "View my messages" %}</a>
                    {% endif %}
                    {% get_permission 'can_access_moderation_queue' request.user as can_access_moderation_queue %}
                    {% if can_access_moderation_queue %}
                        <a href="{% url 'forum_moderation:queue' %}" class="btn btn-link"><i class="fa fa-gavel">&nbsp;</i>{% trans "Moderation queue" %}</a>
                    {% endif %}
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <br />
                {% block messages %}
                    {% include "partials/messages.html" %}
                {% endblock messages %}
            </div>
        </div>
        {% block content %}
        {% endblock content %}
    </div>
{% endblock body %}

{% block js %}
    <script src="{% static 'js/machina.packages.min.js' %}" type="text/javascript" charset="utf-8"></script>
    <script src="{% static 'js/machina.min.js' %}" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(function() {
            machina.init();
            {% block onbodyload %}{% endblock onbodyload %}
        });
    </script>
{% endblock js %}
