<!DOCTYPE html>
<!--
    This file is part of wger Workout Manager

    wger is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    wger is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.
-->

{% load i18n static wger_extras compress django_bootstrap_breadcrumbs %}
{% block breadcrumbs %}
    {% clear_breadcrumbs %}
{% endblock %}
<html lang="{{language.short_name}}">
{% spaceless_config %}
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Roland Geider">

    <!-- OpenGraph -->
    {% block opengraph %}
        <meta property="og:url" content="{{ request_absolute_path }}">
        <meta property="og:type" content="website">
    {% endblock %}
    {% block opengraphimages %}
        <meta property="og:image" content="{{ image_absolute_path }}">
    {% endblock %}

    <!-- twitter cards -->
    {% block twittercard %}
    {% if twitter %}
        <meta content="summary" name="twitter:card">
        <meta content="@{{ twitter }}" name="twitter:site">
    {% endif %}
    {% endblock %}


    {% compress css %}
    <link rel="stylesheet" type="text/css" href="{% static 'bower_components/bootstrap/dist/css/bootstrap.min.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'bower_components/components-font-awesome/css/font-awesome.min.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-custom.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-common.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-mobile.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'bower_components/shariff/build/shariff.min.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'bower_components/metrics-graphics/dist/metricsgraphics.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/metricsgraphics-custom.css' %}">
    {% endcompress %}

    <link rel="icon" href="{% static 'images/favicon.png' %}" type="image/png">

    {% compress js %}
    <script src="{% static 'bower_components/jquery/dist/jquery.js' %}"></script>
    <script src="{% static 'bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
    <script src="{% static 'bower_components/Sortable/Sortable.min.js' %}"></script>
    <script src="{% static 'bower_components/d3/d3.js' %}"></script>
    <script src="{% static 'bower_components/metrics-graphics/dist/metricsgraphics.min.js' %}"></script>
    <script src="{% static 'bower_components/devbridge-autocomplete/dist/jquery.autocomplete.min.js' %}"></script>
    <script src="{% static 'js/wger-core.js' %}"></script>
    <script src="{% static 'js/exercises.js' %}"></script>
    <script src="{% static 'js/nutrition.js' %}"></script>
    {% endcompress %}

    {% compress js %}
    <script src="{% static 'js/wger-core-mobile.js' %}"></script>
    {% endcompress %}
    {% block header %}{% endblock %}

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

        if (typeof wgerCustomPageInit !== "undefined")
        {
            wgerCustomPageInit();
        }

        // Init the modal dialog for editing forms
        wgerFormModalDialog();

        // Check for RO-access before allowing sharing
        wgerToggleReadOnlyAccess();
    });
    </script>


    <title>{% block title %}{% endblock %}</title>
</head>
<body>
<header>
    <div class="navbar navbar-fixed-top" style="background-color: #204A87;">
        <button type="button"
                class="btn btn-primary pull-left visible-xs"
                data-toggle="offcanvas"
                style="margin-top: 0.5em;margin-left: 0.5em;">
            <span class="glyphicon  glyphicon-th-list"></span>
        </button>
        <span class="center-block application-name">
            {# Show application's name or user's gym #}
            {% if custom_header %}
                {{ custom_header }}
            {% else %}
                wger
            {% endif %}
        </span>
    </div>

    <div class="hidden-xs" role="navigation">
        {% include 'navigation.html' %}
    </div>
</header>

<div class="container">

    <div class="modal fade" id="language-options">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">{% trans "Language" %}</h4>
                </div>
                <div class="modal-body">
                    <div class="list-group">
                        {% for language in languages %}
                            {% language_select language %}
                        {% endfor %}
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
                </div>
            </div>
        </div>
    </div>

    <div id="main" class="row-offcanvas row-offcanvas-left">
        <div class="modal fade" id="wger-ajax-info" tabindex="-1" role="dialog">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="ajax-info-title">Modal title</h4>
                    </div>
                    <div class="modal-body" id="ajax-info-content">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
                    </div>
                </div>
            </div>
        </div>
        <div id="current-url" data-current-url="{{request_full_path}}"></div>
        <div id="current-language" data-current-language="{{language.short_name}}"></div>

        {% if not user.is_authenticated or user.userprofile.is_temporary %}
            <div class="alert alert-warning" role="alert" style="padding:0.6em; margin-top: 1em; text-align:center; font-size:95%;">
            {% trans "You are using a guest account, data entered will be deleted after a week."%}
            {% if not has_demo_data %}
            <a href="{% url 'core:user:demo-entries' %}" rel="nofollow" class="btn btn-success btn-xs">
                {% trans "Create some demo entries" %}
                <span class="glyphicon glyphicon-chevron-right"></span>
            </a>
            {% else %}
                <a href="{% url 'core:user:registration' %}" class="btn btn-success btn-xs">
                    {% trans "Register" %}
                    <span class="glyphicon glyphicon-chevron-right"></span>
                </a>
            {% endif %}
            </div>
        {% endif %}

        <div id="main-template">
            {% block template %}{% endblock %}
        </div>

        <div class="sidebar-offcanvas visible-xs" role="navigation">
            {% include 'navigation.html' %}
        </div>
    </div>
</div>


<div class="btn-group btn-group-justified" style="margin-top: 1em;">
    {% if user.is_authenticated %}
    <div class="btn-group">
        <a href="{% url 'core:index' %}" {% auto_link_css request.user_agent.is_mobile %}>{% trans "Dashboard" %}</a>
    </div>
    <div class="btn-group">
        <a href="{% url 'manager:workout:overview' %}" {% auto_link_css request.user_agent.is_mobile %}>{% trans "Workouts" %}</a>
    </div>
    <div class="btn-group">
        <a href="{% url 'nutrition:plan:overview' %}" {% auto_link_css request.user_agent.is_mobile %}>{% trans "Nutrition" %}</a>
    </div>
    {% else %}
    <div class="btn-group">
        <a href="{% url 'core:user:login' %}" {% auto_link_css request.user_agent.is_mobile %}>{% trans "Login" %}</a>
    </div>
    <div class="btn-group">
        <a href="{% url 'software:features' %}" {% auto_link_css request.user_agent.is_mobile %}>{% trans "Features" %}</a>
    </div>
    {% endif %}
</div>

<script src="{% static 'bower_components/shariff/build/shariff.min.js' %}"></script>
</body>
{% endspaceless_config %}
</html>
