
{% import "Juice/macros/html.html" as html with context %}
{% import "Juice/macros/menu.html" as menu with context %}
{% import "Juice/macros/forms.html" as forms with context %}
{% import "Juice/macros/widget.html" as widget with context %}


{% set wide_view = false %}
{% set show_menus = true %}
{% if __.__USER_AUTH_ENABLED__ and current_user and not current_user.is_authenticated %}
    {% set wide_view = true %}
    {% set show_menus = false %}
{% endif %}

{% set bootswatch_theme = "yeti" %}
{% if __.TEMPLATE_CONTEXT["bootswatch_theme"] is defined %}
    {% set bootswatch_theme = __.TEMPLATE_CONTEXT["bootswatch_theme"] %}
{% endif %}

<!DOCTYPE html>
<html>

<head>
    {{ html.head("%s - Admin",
                   add_social_graph=false,
                   add_google_analytics=false) }}
    {{ html.bootswatch_theme(bootswatch_theme) }}
    {{ html.css("juice-admin.css") }}
    {{ html.css("admin-all-css") }}
</head>

<body>

    {{ menu.navbar(brand=__.TEMPLATE_CONTEXT["brand_name"],
                    url="/",
                    groups=["admin"]) }}

    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                {{ widget.flashed_messages() }}
            </div>
        </div>
    </div>

    <div class="container-fluid" id="{% block admin_page_id %}{% endblock %}">

        {% if not wide_view %}
            <div class="row">
                <div class="col-md-12">
                    <h4>
                      <div class="visible-xs pull-left btn-offcanvas" data-toggle="offcanvas"><i class="fa fa-bars"></i></div>
                      <div class="pull-right"><strong>{{ menu.current_title() }} :: {{ menu.current_sub_title() }}</strong></div>
                      <div class="clearfix"></div>
                    </h4>
                    <hr>
                </div>
            </div>
        {% endif %}

        <div class="row row-offcanvas row-offcanvas-left">

            {% if wide_view %}
                <div class="col-md-12 col-sm-12 col-xs-12 main">
                    {% include __template__ %}
                </div>

            {% else %}
                <div class="col-md-2 col-sm-3 sidebar  sidebar-offcanvas">
                    {{ menu.panel(use_active=True) }}
                </div>

                <div class="col-md-10 col-sm-9 col-xs-12 main">
                    {% include __template__ %}
                </div>
            {% endif %}

        </div>
    </div>

    {{ html.js("admin-all-js") }}

<script>
    $(function(){
        $('[data-toggle="offcanvas"]').click(function() {
            $('.row-offcanvas').toggleClass('active')
        });
    })
</script>

<style>

.btn-offcanvas {
  width: 20px;
  cursor: pointer;
  margin-right: 10px;
}

</style>
</body>
</html>





