Skip to content
Snippets Groups Projects
base.html 4.61 KiB
Newer Older
  • Learn to ignore specific revisions
  • {% load compress %}
    
    {% load static %}
    
    {% load i18n %}
    
    {% load django_bootstrap5 %}
    
    {% load fontawesome_6 %}
    
    {% load tags_AKModel %}
    
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
    
        {% block meta %}{% endblock%}
    
    
        <title>{% block title %}AK Planning{% endblock %}</title>
    
        <!-- Load bootstrap, jquery and fontawesome-->
    
        {% compress css %}
    
            <link rel="stylesheet" type="text/x-scss" href="{% static 'common/vendor/bootswatch-lumen/theme.scss' %}">
    
            <link rel="stylesheet" href="{% static 'common/vendor/chosen-js/chosen.css' %}">
            <link rel="stylesheet" href="{% static 'common/css/bootstrap-chosen.css' %}">
            {% if 'AKDashboard'|check_app_installed %}
                <link rel="stylesheet" href="{% static 'AKDashboard/style.css' %}">
            {% endif %}
            <link href="{% static 'common/vendor/select2/select2.min.css' %}" rel="stylesheet" />
            {% fontawesome_6_css %}
            <link rel="stylesheet" href="{% static 'common/css/custom.css' %}">
        {% endcompress %}
    
        {% compress js %}
            {% bootstrap_javascript %}
            <script src="{% static 'common/vendor/jquery/jquery-3.6.3.min.js' %}"></script>
            <script src="{% static 'common/vendor/select2/select2.min.js' %}"></script>
            {% fontawesome_6_js %}
    
            <script src="{% static 'common/vendor/vuejs/vue.global.js' %}"></script>
    
        {% endcompress %}
    
        <script type='text/javascript'>
            var changed_form = false;
    
             $(document).ready(function() {
                // Ask before changing language if user changed main form on page
                $("#language-switcher").submit(function(e){
                    if(changed_form) {
                        if(!confirm("{% trans 'Are you sure you want to change the language now? This will clear the form!' %}"))
                            e.preventDefault(e);
                    }
                });
    
                // Remember any main form edits/changes
                $("form.post-form :input").change(function(){
                    if($(this).val() != '')
                        changed_form = true;
                });
            });
        </script>
    
    
    </head>
    <body>
    
        {% block language-switcher %}
            <!-- language switcher -->
    
            <div class="container d-flex flex-row-reverse" style="margin-top:20px">
    
                <form   action="{% url 'set_language' %}"
                        method="post"
                        class="form-inline"
                        name="language-form"
    
                        style="flex-direction: column;">
                    {% csrf_token %}
    
                    <input name="next" type="hidden" value="{{ request.path }}" />
    
                    {% get_current_language as LANGUAGE_CODE %}
                    {% get_available_languages as LANGUAGES %}
                    {% get_language_info_list for LANGUAGES as languages %}
    
    
                    <div class="align-content-end">
    
                        {% for language in languages %}
                            &nbsp;&nbsp;
                            <button type="submit"
                                    class="btn {% if language.code == LANGUAGE_CODE %}btn-info{% else %}btn-outline-info{% endif %}"
                                    name="language"
                                    value="{{ language.code }}"
                                    style="align-self: end;">
                                {{ language.code | upper }}
                            </button>
                        {% endfor %}
                    </div>
                </form>
            </div>
        {% endblock %}
    
    
        <div class="container mt-3 mb-4">
            <ol class="breadcrumb p-3">
    
                {% block breadcrumbs %}
                {% endblock %}
            </ol>
        </div>
    
        <div class="container">
            {% block content %}
            {% endblock %}
        </div>
    
    
        <div class="container" style="margin-top: 20px">
            <div id="footer" style="padding-top:10px;padding-bottom:10px;border-top:1px solid grey;">
                {% block footer_custom %}
                {% endblock %}
    
                <a href="{% url "admin:index" %}">{% trans "Go to backend" %}</a> &middot;
    
                <a href="{% url "docs_root" %}">{% trans "Docs" %}</a> &middot;
    
                {% footer_info as FI %}
                {% if FI.impress_text %}
                    {{ FI.impress_text }} &middot;
                {% endif %}
                {% if FI.impress_url %}
                    <a href="{{ FI.impress_url }}">{% trans "Impress" %}</a> &middot;
                {% endif %}
                {% if FI.repo_url %}
                    <a href="{{ FI.repo_url }}">{% trans "This software is open source" %}</a>
                {% endif %}
            </div>
        </div>
    
    
    </body>
    </html>