view MoinMoin/themes/basic/templates/layout.html @ 2720:0365115d5699

Merged thomaswaldmann/moin-2.0 into default
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Fri, 15 Aug 2014 00:13:56 +0530
parents 5f82ecf8b353 b8680cd6cf91
children 31628ac3ec21
line wrap: on
line source
{% extends theme("base.html") %}

{% import theme("snippets.html") as snippets %}
{% set logo = snippets.logo() %}
{% set footer_logos = snippets.creditlogos() %}
{% set credits = snippets.credits() %}
{% set user_actions, item_navigation, item_actions = theme_supp.get_local_panel(fqname) %}
{% set basic_scripts = snippets.add_scripts() %}

{% set current_url = request.url %}
{% set current_path = request.path %}
{% set current_url_showview = url_for_item(endpoint='frontend.show_item', item_name=item_name) %}

{# Helper macro to generate the local panel #}
{% macro local_panel_main(panelname) -%}
    {% for endpoint, href, iconcls, label, title, exists in panelname %}
        {# iconcls should be defined, defined for all local_panel_items, see themes/__init.py #}
        {{ hyperlink(href, title, exists, label, iconcls + " icon-fixed-width", "list-group-item") }}
    {% endfor %}
{% endmacro %}

{# Helper macro to generate links #}
{% macro hyperlink(href, title, exists, label, iconcls, mainclass) -%}
    <a href="{{ href }}"
        {% if not exists %} class="moin-nonexistent {% if mainclass %}{{ mainclass }} {% endif %}"
        {% else %}
        {% if mainclass %}
            class="{{ mainclass }}{% if current_url == href %} active{% endif %}"
        {% elif current_url == href %}
            class="active"
        {% elif current_path == href %}
            class="active"
        {% endif %}
        {% endif %}
        rel="nofollow"
        {% if title %} title="{{ title }}" {% endif %}>
        {% if iconcls %} <i class="{{ iconcls }}"> </i> {% endif %}
        {{ label }}
    </a>
{% endmacro %}

{% block layout %}
    <div class="container">
        <div class="row moin-header">
            <div class="col-lg-2 moin-logo">
                {% if logo %}
                <a href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
                    <img class="img-circle" src="{{ '/static/logos/moinmoin.png' }}" alt="Site Logo"/>
                </a>
                {% endif %}
            </div>
            <div class="col-lg-10">
                <div class="row">
                    <div class="col-lg-12">
                        <nav class="navbar moin-navbar-inverse">
                            <div class="container">
                                <div class="col-lg-3">
                                    <div class="moin-navbar-header">
                                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#target">
                                          <span class="sm-only"></span>
                                          <span class="icon-bar"></span>
                                          <span class="icon-bar"></span>
                                          <span class="icon-bar"></span>
                                        </button>
                                        {% if cfg.sitename %}
                                            <a class="navbar-brand" href="{{ url_for('frontend.show_item', item_name=cfg.item_root) }}">
                                                {{ cfg.sitename }}
                                            </a>
                                        {% endif %}
                                    </div>
                                </div>
                                <div class="col-lg-6 moin-loginsettings">
                                    <div class="moin-navbar-collapse navbar-collapse collapse in" id="target">
                                        <ul class="nav navbar-nav moin-pull-right">

                                            {% if user.valid -%}
                                            {% set avatar = user.avatar(20) %}
                                                {% if avatar %}
                                                    <li><img id="moin-avatar" src="{{ avatar }}" /></li>
                                                {%- endif %}
                                                {% if user.name -%}
                                                    {% set wiki_href, aliasname, title, exists = theme_supp.userhome() %}
                                                    <li>
                                                        {{ hyperlink(wiki_href, title, exists, aliasname, "icon-user icon-white", None) }}
                                                    </li>
                                                    {% if 'frontend.usersettings' not in cfg.endpoints_excluded -%}
                                                        <li>
                                                            {{ hyperlink(url_for('frontend.usersettings'), None, True,
                                                                _('Settings'), "icon-cog icon-white", None) }}
                                                        </li>
                                                    {%- endif %}
                                                {%- endif %}
                                                {% if user.auth_method in cfg.auth_can_logout %}
                                                    <li>
                                                        {{ hyperlink(url_for('frontend.logout', logout_submit=1), None, True,
                                                                _('Logout'), "icon-off icon-white", None) }}
                                                    </li>
                                                {% endif %}
                                            {% else %}
                                                {% set login_url = theme_supp.login_url() %}
                                                {% if login_url %}
                                                    <li>
                                                        {{ hyperlink(login_url, None, True, _('Login'), None, None) }}
                                                    </li>
                                                {% endif %}
                                            {%- endif %}
                                        </ul>
                                    </div>
                                </div>
                                {% if search_form %}
                                    <div class="col-lg-3">
                                        <form class="moin-navbar-form" action="{{ url_for('frontend.search') }}" method="get" role="search">
                                            <div class="input-group">
                                                <input name='q' type="text" class="form-control" placeholder="Search ...">
                                                <div class="input-group-btn">
                                                    <button class="btn btn-primary" type="submit">
                                                        <i class="icon-search"></i>
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                {% endif %}
                            </div>
                        </nav> <!-- navbar-inverse-->
                    </div> <!-- column-12 -->
                </div> <!-- row for top-navbar -->
                <div class="row">
                    <div class="col-lg-12">
                        <ul class="moin-breadcrumb">
                        {% set trail_items = theme_supp.path_breadcrumbs() %}
                        {% if trail_items %}
                            {% for wiki_name, fqname, item_href, exists, err in trail_items %}
                            {% if not loop.last %}
                                <li>
                                    {%- if wiki_name -%}
                                        <a href="{{ item_href }}"{{ " " }}
                                            title="{{ wiki_name }}"
                                            class="{% if err %}moin-badinterwiki{% else %}moin-interwiki{% endif %}">
                                            {{ fqname|shorten_fqname }}
                                        </a>
                                        <i class="icon-double-angle-right icon-fixed-width"></i>
                                    {%- else -%}
                                        <a href="{{ url_for('frontend.show_item', item_name=fqname) }}"{{ " " }}
                                            {% if not exists -%}class="moin-nonexistent"{%- endif -%}>
                                            {{ fqname|shorten_fqname }}
                                        </a>
                                        <i class="icon-double-angle-right icon-fixed-width"></i>
                                    {%- endif %}
                                    <ul class="moin-bcs-subitems">
                                        {% for fq_name in theme_supp.get_fqnames(fqname) -%}
                                            <li>
                                                <a href="{{ url_for('frontend.show_item', item_name=fq_name) }}">
                                                    {{ fq_name|shorten_fqname(length=25) }}
                                                </a>
                                            </li>
                                        {%- endfor %}
                                    </ul>
                                </li>
                            {% else %}
                                <li>
                                    <h4 class="moin-location-breadcrumb">
                                    {% for segment_name, segment_path, exists in theme_supp.location_breadcrumbs(fqname) -%}
                                        {% if loop.first %}
                                            <small>~ /</small>
                                        {% elif not loop.last %}
                                            <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
                                                {{ segment_name|shorten_fqname }}
                                            </a>
                                        <small>/</small>
                                        {%- endif %}
                                        {% if loop.last %}
                                            {% if title_name %}
                                                {{ title_name }}
                                            {% else %}
                                                <a href="{{ url_for('frontend.show_item', item_name=segment_path) }}" {% if not exists %}class="moin-nonexistent"{% endif %}>
                                                    {{ segment_name|shorten_fqname }}
                                            </a>
                                            {%- endif %}
                                        {%- endif %}
                                    {% endfor %}
                                    </h4>
                                    <ul class="moin-bcs-subitems">
                                        {% for fq_name in theme_supp.get_fqnames(fqname) -%}
                                            <li>
                                                <a href="{{ url_for('frontend.show_item', item_name=fq_name) }}">
                                                    {{ fq_name|shorten_fqname(length=25) }}
                                                </a>
                                            </li>
                                        {%- endfor %}
                                    </ul>
                                </li>
                            {% endif %}
                            {% endfor %}
                        {% endif %}

                        </ul><!-- complete list of breadcrumbs -->
                    </div>
                </div>
            </div> <!-- col-lg-10 -->
        </div> <!-- row-topnavbar -->

        <div class="row moin-content">
            <div class="col-lg-2">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="moin-sidebar">
                            {% set navibar_items = theme_supp.navibar(item_name) %}
                            {% set quicklinks = 'false' %}
                            {% if navibar_items %}

                            <div class="list-group-item moin-list-heading"> {{ _("Site Navigation") }} </div>
                            {% for cls, url, text, title in navibar_items if cls != 'userlink' %}
                                <a class="list-group-item {{ cls }}
                                    {% if url in [current_url, current_path, current_url_showview] %} active{% endif %}" href="{{ url }}"
                                    {% if title %}title="{{ title }}"{% endif %}>
                                    {{ text|shorten_item_name }}
                                </a>
                            {% endfor %}

                            {% if item_navigation %}
                            <div class="list-group-item moin-list-heading"> {{ _("Supplementation") }} </div>
                            {{ local_panel_main(item_navigation) }}
                            {% endif %}

                            {% endif %}

                            {% for cls, url, text, title in navibar_items if cls == 'userlink' %}
                                {% if loop.first %}
                                    <div class="list-group-item moin-list-heading">Quick Links</div>
                                {% endif %}
                                <div class="moin-quicklink">
                                    <a class="moin-quicklink-label {{ cls }}" href="{{ url }}" {% if title %}title="{{ title }} : {{ url|safe }}"{% else %}"{{ url|safe }}"{% endif %}>{{ text|shorten_item_name(20) }}
                                    </a>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                </div><!--first row of sidebar-->

                <div class="row">
                    <div class="col-lg-12">
                        {% if self.local_panel %}
                            {{ self.local_panel() }}
                        {% endif %}
                    </div>
                </div><!--second row of sidebar-->

            </div><!--/span-->

            <div class="col-lg-10">
                <div class="row">
                    <div class="col-lg-12">
                        {# id -> moin-flash is used to add special alerts for ex. for changes to User Settings via JS, see common.js #}
                        <div id="moin-flash">
                            {% for category, msg in get_flashed_messages(with_categories=true) %}
                            <div class="moin-flash moin-flash-{{ category }}">
                                {{ msg }}
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            </div>
                            {% endfor %}
                        </div>
                    </div>
                </div> <!-- moin-flash-message -->

                {% block views %}

                {% endblock %}

            <div class="row">
                {% set width = "col-lg-12" %}

                <div class="{{width}}">
                    {% set content_id = self.local_panel and 'moin-content' or 'moin-content-no-panel' %}
                    <div id="{{ content_id }}" lang="{{ theme_supp.content_lang }}" dir="{{ theme_supp.content_dir }}">
                        {% block content %}
                            {# All content templates should implement this block. #}
                        {% endblock %}
                    </div>
                </div><!--/span-->
            </div><!--/row-->

            </div><!--/span-->
        </div> <!--/row sidebar, tabs, content - main-->

        {% block footer %}
        <div class="row moin-footer">
            <div class="col-lg-12">
                <div class="navbar"> <!--footer-->
                    {{ footer_logos }}
                    {{ credits }}
                </div>
            </div>
        </div> <!--/row for footer-->
        {% endblock %}
    </div><!--/container-->
{% endblock %}

{% block body_scripts %}
    {{ super() }}
    {{ basic_scripts }}
{% endblock %}