{% extends MACHINA_BASE_TEMPLATE_NAME %}
{% 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 %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'css/machina.board_theme.vendor.min.css' %}" />
<link rel="stylesheet" href="{% static 'css/machina.board_theme.min.css' %}" />
{% endblock css %}

{% block body %}
{% block header %}
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
  <a class="navbar-brand" href="{% url 'forum:index' %}">{% block brand %}{{ MACHINA_FORUM_NAME|default:"My forum" }}{% endblock %}</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    {% block header_collapse %}
    <form class="form-inline my-2 ml-3 my-lg-0" role="search" action="{% url 'forum_search:search' %}">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="q">
      <button class="btn btn-outline-light my-2 my-sm-0" type="submit">{% trans "Search" %}</button>
    </form>
    <div class="navbar-nav mr-auto">
      <a class="nav-item nav-link" href="{% url 'forum_search:search' %}">{% trans "Advanced search" %}</a>
    </div>
    {% endblock header_collapse %}
  </div>
</nav>
{% endblock header %}
<div class="my-5 container" id="main_container">
  <div class="row">
    <div class="col-12">
      {% block breadcrumb %}{% include "partials/breadcrumb.html" %}{% endblock breadcrumb %}
      <div class="float-right controls-link-wrapper">
      {% spaceless %}
      {% if not request.user.is_anonymous %}
        <a href="{% url 'forum_member:user_subscriptions' %}" class="d-inline-block ml-3"><i class="fas fa-bookmark">&nbsp;</i>{% trans "Subscriptions" %}</a>
        <a href="{% url 'forum_member:user_posts' request.user.id %}" class="d-inline-block ml-3"><i class="fas fa-comments">&nbsp;</i>{% trans "View my posts" %}</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="d-inline-block ml-3"><i class="fas fa-gavel">&nbsp;</i>{% trans "Moderation queue" %}</a>
      {% endif %}
      {% endspaceless %}
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-12">
      <br />
      {% block messages %}{% include "partials/messages.html" %}{% endblock messages %}
    </div>
  </div>
  {% block content %}
  {% endblock content %}
</div>
{% endblock body %}

{% block js %}
{{ block.super }}
<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 %}
