{% extends 'admin/base.html' %}
{% import 'admin/static.html' as admin_static with context %}
{% import 'mmw/admin/menus.html' as menus with context -%}

{% block title %}{{ admin_view.admin.name }} - {{ admin_view.name }}{% endblock %}

{% block head_meta %}
    <meta charset="UTF-8">
    {#
    http://www.w3schools.com/browsers/browsers_explorer.asp
    - Display size: 1024x768
    - bootstrap 3.3.1: Explorer 8-11
    - Bootswatch v3.2.0: ?
    - IE8 requires the use of Respond.js to enable media query support.
    - Jquery 2.X: IE9+
    - highcharts: IE6+    
    - jQuery VectorMap: IE6+ ?
    - momentjs 2.8.4: IE8+ on Windows 7
    #- momentjs 2.10.2: IE8+ on Windows 7
    - Select2 3.5.2: IE8+
    - bootstrap-modal 2.2.5: 
    - font-awesome 4.3.0: 
    - bootstrap-switch 3.3.2:
    - humanize 1.5.0
    - lodash 3.5.0 
    - x-editable 1.5.1: IE7+
    - bootstrap-daterangepicker 1.3.15 (last: 1.3.21 - use moment 2.9.0): 
    #}
    <meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="WEB UI for Mongo Mail Server">
    <meta name="author" content="Stéphane RAULT">
{% endblock %}


{% block head_css %}
    <link href="{{ current_theme_url }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='mmw/flags/flags.css')}}" rel="stylesheet">
    <link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css') }}" rel="stylesheet">

    <style>
    body {
        padding-top: 4px;
    }
    </style>
    
    <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/css/bootstrap3/bootstrap-switch.min.css" rel="stylesheet">

    <link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.5/css/bootstrap-modal-bs3patch.css" rel="stylesheet">
    <link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.5/css/bootstrap-modal.css" rel="stylesheet">
    
{% endblock %}

{% block brand %}
{#TODO: logo #}
<a class="navbar-brand" href="#">Mongo Mail</a>
{% endblock %}

{% block main_menu %}
<ul class="nav navbar-nav navbar-left">
  {{ menus.menu() }}
  {% block sub_main_menu %}
  {% endblock %}
</ul>
{% endblock %}

{% block menu_links %}
{% endblock %}

{% block access_control %}
    <div id="ajax-modal" class="modal fade" tabindex="-1" style="display: none;"></div>
    <ul class="nav navbar-nav navbar-right">
       {% include "mmw/user_menu.html" %}
    </ul>
    {#
    <ul class="nav navbar-nav navbar-right">
        <li>
            <button type="button" class="btn btn-default navbar-btn help-button"><i class="fa fa-question-circle fa-1x"></i></button>
        </li>
    </ul>
    #}   
{% endblock %}

{% block tail_js %}
   <!--[if lt IE 9]>
   <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js" type="text/javascript"></script>
   <![endif]-->

    {{ super() }}
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.2/js/bootstrap-switch.min.js"></script>
    {#<script src="//cdnjs.cloudflare.com/ajax/libs/lodash-compat/3.6.0/lodash.min.js" type="text/javascript"></script>#}
    <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js" type="text/javascript"></script>

    {#
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment-with-locales.min.js" type="text/javascript" ></script>
    #}

    {#    
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/tableExport.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jquery.base64.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/html2canvas.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/libs/sprintf.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/jspdf.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/libs/base64.js') }}"></script>
    #}
    
    {#
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js" type="text/javascript" ></script>
    #}
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.5/js/bootstrap-modalmanager.min.js" type="text/javascript" ></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.5/js/bootstrap-modal.min.js" type="text/javascript" ></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/humanize-plus/1.5.0/humanize.min.js" type="text/javascript" ></script>
    
    

    {# None pour charger manuellement la version cdn #}    
    {{ moment.include_moment(version=None) }}
    {{ moment.lang(current_lang)}}

{% endblock tail_js %}

{% block tail %}
    {{ super() }}
    
    
    <script type="text/javascript">
    $(document).ready(function() {
    	
        //change contenair to contenair-fluid on flask-admin/base.html
        var ct = $('div.container:first');
        ct.removeClass("container");
        ct.addClass("container-fluid");
        
        var $modal = $('#ajax-modal');
        
        {% if security.changeable %}
        $('#change-password').on('click', function(){
            $('body').modalmanager('loading');
            $modal.load('{{url_for_security('change_password')}}', '', function(){
                $modal.modal();
                change_password("#ajax-modal");
            });
        });
        {% endif %}

    });
    </script>
{% endblock tail %}

