{% load i18n %}
{% load compress %}
{% load static %}
{% load hk_generic %}
<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta name="ROBOTS" content="INDEX, FOLLOW" />
        <title>{% block head_title %}{{ site_name }}{% endblock %}</title>
        <meta name="author" content="" />
        <meta name="dc.language" content="en" />
        <link rel="shortcut icon" href="{% static 'hyperkitty/img/favicon.ico' %}" />
        <link rel="stylesheet" href="{% static 'hyperkitty/libs/jquery/smoothness/jquery-ui-1.10.3.custom.min.css' %}" type="text/css" media="all" />
        <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/font-awesome/css/font-awesome.min.css' %}" type="text/css" media="all" />
        {% compress css %}
        <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/icomoon/icomoon.css' %}" type="text/css" media="all" />
        <link rel="stylesheet" href="{% static 'hyperkitty/libs/fonts/droid/droid.css' %}" type="text/css" media="all" />
        <link rel="stylesheet" href="{% static 'django-mailman3/css/main.css' %}" />
        <link rel="stylesheet" type="text/x-scss" media="all" href="{% static 'hyperkitty/sass/hyperkitty.scss' %}" />
        {% endcompress %}
        {% block additional_stylesheets %} {% endblock %}
        {% include 'hyperkitty/headers.html' %}
    </head>

    <body>

    {% include 'hyperkitty/top.html' %}

    <nav class="navbar sticky-top navbar-light bg-light navbar-expand-md">
        <div class="container">
            <div class="navbar-header col-md"> <!--part of navbar that's always present-->
                <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="fa fa-bars"></span>
                </button>
                {% include 'hyperkitty/navbar-brand.html' %}
            </div> <!-- /navbar-header -->

            <div class="navbar-collapse collapse justify-content-end"> <!--part of navbar that's collapsed on small screens-->
                <!-- show dropdown for smaller viewports b/c login name/email may be too long -->
                <!-- only show this extra button/dropdown if we're in small screen sizes -->
                <div class="nav navbar-nav navbar-right auth dropdown d-sm-none">
                  <a href="#" role="button" class="btn dropdown-toggle" id="loginDropdownMenu"
                     data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        {% if user.is_authenticated %}
                            {% gravatar user.email 20 %}
                        {% else %}
                            <span class="fa fa-bars"></span>
                        {% endif %}
                    </a>
                      {% if user.is_authenticated %}
                          <div class="dropdown-menu">
                            <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'mm_user_profile' %}">
                                <span class="fa fa-user"></span>
                                {% trans 'Account' %}
                            </a>
                            {% if 'postorius' in INSTALLED_APPS %}
                            <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'ps_user_profile' %}">
                                <span class="fa fa-cog"></span>
                                {% trans 'Mailman settings' %}
                            </a>
                            {% endif %}
                            <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url 'hk_user_profile' %}">
                                <span class="fa fa-comments"></span>
                                {% trans 'Posting activity' %}
                            </a>
                            <div class="dropdown-divider"></div>
                            <a role="menuitem" tabindex="-1" class="dropdown-item" href="{% url LOGOUT_URL %}?next={% url 'hk_root' %}">
                                <span class="fa fa-sign-out"></span>
                                {% trans "Logout" %}
                            </a>
                          </div> <!-- dropdown menu -->
                        {% else %}
                            <a role="menuitem" tabindex="-1" href="{% url LOGIN_URL %}?next={{next|default:request.path|urlencode}}">
                                <span class="fa fa-sign-in"></span>
                                {% trans "Sign In" %}
                            </a>
                            <a role="menuitem" tabindex="-1" href="{% url 'account_signup' %}?next={{next|default:request.path|urlencode}}">
                                <span class="fa fa-user-plus"></span>
                                {% trans "Sign Up" %}
                            </a>
                        {% endif %}

                </div>
                <form name="search" method="get" action="{% url 'hk_search' %}" class="navbar-form navbar-right my-2 my-lg-2 order-1" role="search">
                    {% if mlist %}<input type="hidden" name="mlist" value="{{ mlist.name }}" />{% endif %}
                        <div class="input-group">
                            <input name="q" type="text" class="form-control"
                                   placeholder="{% if mlist %}{% trans 'Search this list' %}{% else %}{% trans 'Search all lists' %}{% endif %}"
                                   {% if query %}value="{{ query }}"{% endif %}
                                   />
                            <span class="input-group-append">
                                <button class="btn btn-secondary" type="submit"><span class="fa fa-search"></span></button>
                            </span>
                        </div>
                </form>
                <!-- larger viewports -->
                <ul class="nav navbar-nav d-none d-sm-flex auth order-3">
                    {% if user.is_authenticated %}
                        <li class="dropdown nav-item">
                            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown"
                               role="button" aria-haspopup="true" aria-expanded="false">
                                {% gravatar user.email 20 %}
                                {{ user.username|truncatechars:"35" }}
                                <span class="caret"></span>
                            </a>
                            <div class="dropdown-menu">
                                <a href="{% url 'mm_user_profile' %}" class="dropdown-item">
                                    <span class="fa fa-user"></span>
                                    {% trans 'Account' %}
                                </a>
                                {% if 'postorius' in INSTALLED_APPS %}
                                <a href="{% url 'ps_user_profile' %}" class="dropdown-item">
                                    <span class="fa fa-cog"></span>
                                    {% trans 'Mailman settings' %}
                                </a>
                                {% endif %}
                                <a href="{% url 'hk_user_profile' %}" class="dropdown-item">
                                    <span class="fa fa-comments"></span>
                                    {% trans 'Posting activity' %}
                                </a>
                                <div role="separator" class="dropdown-divider"></div>
                                <a href="{% url LOGOUT_URL %}?next={% url 'hk_root' %}" class="dropdown-item">
                                    <span class="fa fa-sign-out"></span>
                                    {% trans "Logout" %}
                                </a>
                            </div>
                        </li>
                    {% else %}
                        <li class="nav-item"><a href="{% url LOGIN_URL %}?next={{next|default:request.path|urlencode}}" class="nav-link">
                            <span class="fa fa-sign-in"></span>
                            {% trans "Sign In" %}
                        </a></li>
                        <li class="nav-item"><a href="{% url 'account_signup' %}?next={{next|default:request.path|urlencode}}" class="nav-link">
                            <span class="fa fa-user-plus"></span>
                            {% trans "Sign Up" %}
                        </a></li>
                    {% endif %}
                </ul>

                {% if 'postorius' in INSTALLED_APPS %}
                <ul class="nav navbar-nav order-2">
                    <li class="nav-item">
                    {% if mlist %}
                    <a href="{% url 'list_summary' mlist.list_id %}" class="nav-link">
                        <span class="fa fa-cog"></span>
                        {% trans 'Manage this list' %}
                    </a>
                    {% else %}
                    <a href="{% url 'list_index' %}" class="nav-link">
                        <span class="fa fa-cog"></span>
                        {% trans 'Manage lists' %}
                    </a>
                    {% endif %}
                    </li>
                </ul>
                {% endif %}


            </div> <!--/navbar-collapse -->
        </div> <!-- /container for navbar -->
    </nav>

    {% if messages %}
    <div class="flashmsgs">
    {% for msg in messages %}
        <div class="flashmsg-wrapper">
            <!--<div class="alert alert-{{ msg.level_tag }}">-->
            <div role="alert" class="alert alert-{{ msg.tags }} {{msg.tags}}
                {% if msg.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}
                ">
                {% else %}
                alert-dismissible">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                {% endif %}
                {{ msg }}
            </div>
        </div>
    {% endfor %}
    </div>
    {% endif %}

     <div class="modal fade" tabindex="-1" role="dialog" id="keyboard-shortcuts">
       <div class="modal-dialog" role="document">
         <div class="modal-content">
           <div class="modal-header">
             <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
             <h4 class="modal-title">{% trans "Keyboard Shortcuts" %}</h4>
           </div>
           <div class="modal-body">
             <h3>{% trans "Thread View" %}</h3>
             <ul>
               <li><code>j</code>: {% trans "Next unread message" %} </li>
               <li><code>k</code>: {% trans "Previous unread message" %} </li>
               <li><code>j a</code>: {% trans "Jump to all threads" %}
               <li><code>j l</code>: {% trans "Jump to MailingList overview" %}
             </ul>
           </div>
         </div><!-- /.modal-content -->
       </div><!-- /.modal-dialog -->
     </div><!-- /.modal -->

     <div class="container">
        {% block content %} {% endblock %}
    </div> <!-- /container for content -->

    <footer class="footer">
      <div class="container">
        <p class="text-muted">
            {% trans 'Powered by' %} <a href="http://hyperkitty.readthedocs.org">HyperKitty</a> {% trans 'version' %} {{ HYPERKITTY_VERSION }}.
        </p>
      </div>
    </footer>

    <script src="{% static 'hyperkitty/libs/jquery/jquery-1.10.1.min.js' %}"></script>
    <script src="{% static 'hyperkitty/libs/jquery/jquery-ui-1.10.3.custom.min.js' %}"></script>
    {% compress js %}
    <script type="text/javascript" src="{% static 'hyperkitty/libs/popper/popper.min.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/libs/bootstrap/javascripts/bootstrap.min.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/libs/mousetrap/mousetrap.min.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/libs/jquery.expander.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/libs/d3.v2.min.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/libs/jquery.hotkeys.js' %}" />
    <script type="text/javascript" src="{% static 'django-mailman3/js/main.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-common.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-index.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-overview.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-thread.js' %}" />
    <script type="text/javascript" src="{% static 'hyperkitty/js/hyperkitty-userprofile.js' %}" />
    {% endcompress %}
    {% block additionaljs %} {% endblock %}

    {% include 'hyperkitty/bottom.html' %}

    </body>
</html>
