view MoinMoin/themes/basic/templates/itemviews.html @ 2378:bff46cb932d1

Refactoring rendering of local tabs, local panel, fixes #21
author sharky93 <rishabhr123@gmail.com>
date Wed, 14 Aug 2013 20:26:44 +0530
parents 6d2770f69ffe
children 7df17df524e7
line wrap: on
line source
{% set exists = storage.has_item(item_name) %}
{% set current_endpoint = request.endpoint %}

{% set icon = {'frontend.show_item' : "icon-eye-open",
               'frontend.modify_item' : "icon-pencil",
               'frontend.history' : "icon-time",
               'frontend.show_item_meta' : "icon-wrench",
               'frontend.highlight_item' : "icon-picture",
               'frontend.backrefs' : "icon-share",
               'special.comments' : "icon-comment",
               'special.transclusions' : "icon-edit",
           } %}

{% set navtabs = ['frontend.show_item', 'frontend.modify_item', 'frontend.history',
                  'frontend.show_item_meta', 'frontend.highlight_item', 'frontend.backrefs',
                  'special.comments', 'special.transclusions',] %}

{% block views %}

    <ul class="moin-nav nav-tabs moin-shadow">
        {%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %}
            {%- if not check_exists or check_exists and exists %}

                {%- if endpoint == 'frontend.modify_item' and user.may.write(item_name) %}
                    <li {% if endpoint == current_endpoint %} class="active"{% endif %}>
                        <a href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
                         <span class={{icon[endpoint]}}></span>   
                            {{ label }}
                        </a>
                    </li>

                {%- elif endpoint == 'special.comments' %}
                    <li class="moin-toggle-comments-button">
                        <a href="#" title="{{ title }}">
                        <span class={{icon[endpoint]}}></span>
                            {{ label }}
                        </a>
                    </li>

                {% elif endpoint == 'special.transclusions' -%}
                    <li class="moin-transclusions-button">
                        <a href="#" title="{{ title }}">
                        <span class={{icon[endpoint]}}></span>
                            {{ label }}
                        </a>
                    </li>

                {%- elif endpoint in navtabs %}
                    <li {% if endpoint == current_endpoint %} class="active"{% endif %}>
                        <a href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
                        <span class={{icon[endpoint]}}></span>
                            {{ label }}
                        </a>
                    </li>
                {%- endif %}

            {%- endif %}
        {% endfor %}

    </ul>
{% endblock %}