view templates/sat_website/menu.html @ 28:30a1edf90fae

move the language selector to the main menu
author souliane <souliane@mailoo.org>
date Wed, 21 Jan 2015 20:08:26 +0100
parents eda4deefecd1
children 876ae5e23690
line wrap: on
line source

{% comment %}
SàT website: Salut à Toi's presentation website
Copyright (C) 2012  Jérôme Poisson (goffi@goffi.org)

This file is part of SàT website.

SàT website 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.

Foobar 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}

{% load i18n %}
{% load utils %}

<ul class="{{ style }}">
    {% for cat_url, item in categories.items %}
        {% if item|is_tuple %}
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                    {{ item.0 }}
                    <span class="caret"></span>
                </a>
                <ul class="dropdown-menu" role="menu">
                    {% for subcat_url, cat_name in item.1.items %}
                        <li><a href="{{ subcat_url }}.html">{{ cat_name }}</a></li>
                    {% endfor %}
                </ul>
            </li>
        {% else %}
            <li><a href="{{ cat_url }}.html"><strong>{{ item }}</strong></a></li>
        {% endif %}
    {% endfor %}
    {% if language_select %}
        <li>
            <form id="language_form" class="form-inline" action="{% url 'set_language' %}" method="post">
                {% csrf_token %}
                <input name="next" type="hidden" value="{{ redirect_to }}" />
                <select id="language_select" name="language">
                    {% get_language_info_list for available_languages as languages %}
                    {% for language in languages %}
                        <option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>{{ language.name_local }} ({{ language.code }})</option>
                    {% endfor %}
                </select>
            </form>
        </li>
    {% endif %}
</ul>