view MoinMoin/themes/basic/templates/show.html @ 2381:aa19b1b69b5c

adds helper function to render the local panel
author sharky93 <rishabhr123@gmail.com>
date Sat, 17 Aug 2013 02:50:14 +0530
parents 095250a9fd84
children 1430714a7924
line wrap: on
line source
{% extends theme("layout.html") %}
{% import "utils.html" as utils %}
{% import theme("itemviews.html") as itemviews with context %}
{% set exists = storage.has_item(item_name) %}

{% set icon = {'frontend.quicklink_item' : "icon-star-empty",
               'frontend.subscribe_item' : "icon-envelope",
               'frontend.index' : "icon-list-alt",
               'frontend.sitemap' : "icon-map-marker",
               'frontend.rename_item' : "icon-tag",
               'frontend.delete_item' : "icon-trash",
               'frontend.destroy_item' : "icon-fire",
               'frontend.similar_names' : "icon-search",
               'frontend.download_item' : "icon-download-alt",
               'frontend.copy_item' : "icon-comment",
           } %}

{% set user_actions, item_navigation, item_actions = theme_supp.get_local_panel(item_name) %}

{% block views %}
    {{ itemviews }}
{% endblock %}

{% block content %}

    {% block content_data %}
        {% if data_rendered %}
        <div id="moin-content-data">
            {{ data_rendered }}
        </div>
        {% endif %}
    {% endblock %}

{% endblock %}

{% block user_actions %}
    <div class="list-group-item">User Actions</div>
    {%- 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 in user_actions and user.valid %}
                <a class="list-group-item" href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
                    <span class="icon-stack">
                        <i class={{icon[endpoint]}}></i>
                    </span>
                    {%- if endpoint == 'frontend.quicklink_item' %}
                        {%- if user.is_quicklinked_to([item_name]) %}
                            {{ _('Remove Link') }}
                        {%- else %}
                            {{ _('Add Link') }}
                        {%- endif %}
                    {% elif endpoint == 'frontend.subscribe_item' %}
                        {%- if user.is_subscribed_to([item_name]) %}
                            {{ _('Unsubscribe') }}
                        {%- else %}
                            {{ _('Subscribe') }}
                        {%- endif %}
                    {% endif %}
                </a>
            {%- endif %}

        {%- endif %}
    {% endfor %}
{% endblock %}

{% block site_actions %}
    <div class="list-group-item">Item Navigation</div>
    {%- 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 in item_navigation %}
                <a class="list-group-item" href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
                <span class="icon-stack">    
                    <i class={{icon[endpoint]}}></i>
                </span>
                    {{ label }}
                </a>
            {%- endif %}

        {% endif %}
    {% endfor %}
{% endblock %}

{% block item_actions %}
    <div class="list-group-item">Item Actions</div>
    {%- 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 in item_actions and user.may.write(item_name) %}
                <a class="list-group-item" href="{{ url_for(endpoint, item_name=item_name) }}" title="{{ title }}" rel="nofollow">
                <span class="icon-stack">
                    <i class={{icon[endpoint]}}></i>
                </span>
                    {{ label }}
                </a>
            {%- endif %}

        {% endif %}
    {% endfor %}
{% endblock %}

{% block local_panel %}
        
        <!-- user, site, item actions -->
    <div class="list-group">
        {{ self.user_actions() }}

        {{ self.site_actions() }}

        {{ self.item_actions() }}
    </div>

{% endblock %}