view MoinMoin/templates/index.html @ 2869:e19c733eb108

fix #470 rework global index, subitem index; merge basic and modernized versions
author RogerHaase <haaserd@gmail.com>
date Sun, 04 Jan 2015 09:18:55 -0700
parents 1a14f5755290
children b031a33366c9
line wrap: on
line source
{% extends theme("layout.html") %}
{% import "forms.html" as forms with context %}
{% import theme("itemviews.html") as itemviews with context %}

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

{% block action_bars_inner %}
    {% if item_name %}
        {% set title = _("Index of subitems of '%(item_name)s'", item_name=item_name) %}
    {% else %}
        {% set title = _("Global Index ") %}
    {% endif %}
    <h1>{{ title }}</h1>

    <div class="moin-index-menu">
        {% if dirs or files %}
            <a href="#" class="moin-select-allitem allitem-toselect moin-button">
               <i class="fa fa-square-o fa-lg"></i>
               <span class="moin-select-button-text">{{ _("Select All") }}</span>
            </a>
            <a class="moin-button" id="moin-download-trigger" href="#">
               <i class="fa fa-download fa-lg"></i>
               {{ _("Download") }}
            </a>
            <a class="moin-action-tab moin-button" id="moin-delete-trigger"
               data-actionurl="{{ url_for('frontend.ajaxdelete', item_name=item_name) }}" href="#">
               <i class="fa fa-minus-circle fa-lg"></i>
               {{ _("Delete") }}
            </a>
            <a class="moin-action-tab moin-button"
               id="moin-destroy-trigger"
               data-actionurl="{{ url_for('frontend.ajaxdestroy', item_name=item_name) }}" href="#">
               <i class="fa fa-times-circle fa-lg"></i>
               {{ _("Destroy") }}
            </a>
        {% endif %}
        <a class="moin-button" id="moin-create-new-item" href="#">
           <i class="fa fa-file-o fa-lg"></i>
           {{ _("New Item") }}
        </a>
    </div>

    <div class="moin-contenttypes-wrapper">
        <span class="moin-ct-hide moin-button">

            <i class="fa fa-filter"></i>
            {{ _("Filter by content type") }}
        </span>
        {% set unknown_items_label = _("items having unknown mime types") %}
        {{ gen.form.open(form, method="get", action=url_for('frontend.index', item_name=item_name)) }}
            <ul>
                {{ forms.render(form['contenttype']) }}
            </ul>


            <a href="#" class="moin-filter-toggle moin-button">
                <i class="fa fa-refresh"></i>
                {{ _("Toggle") }}
            </a>
            {{ forms.render_submit(form) }}
        {{ gen.form.close() }}
    </div>
{% endblock %}

{% block action_bars %}
        {{ self.action_bars_inner() }}
{% endblock %}

{% macro entry_anchor(type, e) -%}
    index-{{ type }}-{{ e.meta['itemid'] }}
{%- endmacro %}

{% set maxchars = 16 %}

{% macro render_file_entry(e) %}
    <div>
        <span class="moin-select-item">
            <input type="checkbox">
        </span>
        {% set mimetype = "application/x.moin.download" %}
        <a href="{{ url_for('.download_item', item_name=e.fullname, mimetype=mimetype) }}" class="moin-download-link">
        </a>
        <a href="{{ url_for('.show_item', item_name=e.fullname) }}"
           class="{{ e.meta['contenttype']|contenttype_to_class }} moin-itemtype-{{ e.meta['itemtype'] }} moin-item"
           title="{{ e.relname }}">
           {{ e.relname|truncate(maxchars, true, '..') }}
        </a>
        {% if e in dirs %}
            <a href="#{{ entry_anchor('dir', e) }}"
               title="{{ _("This item also has subitems that match your filter.") }}">↓
            </a>
        {% endif %}
    </div>
{% endmacro %}

{% block content %}
    <div class="moin-index-message"><span></span></div>
    {{ self.action_bars() }}
    <div>
        {% if item_name: %}
            <div class="moin-index-path">
                <i class="fa fa-folder-o"></i>
                <a href="{{ url_for('frontend.index') }}" title="{{ _("Global Index") }}">{{ ("..") }}</a>
                <span class="moin-path-separator">{{ ("/") }}</span>
                {% for i in range(0, item_names|count) %}
                    {% set fullname = item_names[:i+1]|join('/') %}
                    {% set relname = item_names[i] %}
                    <a href="{{ url_for('frontend.index', item_name=fullname) }}" title="{{ relname }}">{{ relname }}</a>
                    <span class="moin-path-separator">{{ ("/") }}</span>
                {% endfor %}
            </div>
        {% endif %}
    </div>
    <div class='moin-clr'></div>
        <div id="moin-new-index" class="moin-item-index">
            <h3 style="display: none;">{{ _("Recently uploaded items") }}</h3>
            <div class="file_download_template" style="display: none;">
                <a></a>
            </div>
        </div>
    <div class="moin-index-separator"></div>
        {% if files or dirs %}
            <div id="moin-initials">
                {% if not startswith %}
                    <a class="selected moin-button" href="{{ url_for('frontend.index', item_name=item_name) }}">
                        <i class="fa fa-th"></i>
                        {{ _("Show All") }}
                    </a>
                {% else %}
                    <a class="moin-button" href="{{ url_for('frontend.index', item_name=item_name) }}">
                        <i class="fa fa-th"></i>
                        {{ _("Show All") }}
                    </a>
                {% endif %}
                {% for initial in initials %}
                    {% if startswith == initial %}
                        <a class="selected moin-button" href="{{ url_for('frontend.index', item_name=item_name, startswith=initial) }}">{{ initial }}</a>
                    {% else %}
                        <a class="moin-button" href="{{ url_for('frontend.index', item_name=item_name, startswith=initial) }}">{{ initial }}</a>
                    {% endif %}
                {% endfor %}
            </div>
            {% if files %}
                <div class="moin-item-index">
                    {% for e in files %}
                        {{ render_file_entry(e) }}
                    {% endfor %}
                </div>
                <div class="moin-clr"></div>
            {% endif %}
        {% endif %}
        <div id="popup">
            <div id="popup-for-action" class="popup-container">
                <div class="popup-header">
                    <input type="button" class="popup-closer popup-cancel" value="{{ _("X") }}" title="{{ _("Close") }}"/>
                    <span>{{ _("Please provide comment for this action") }}</span>
                </div>
                <div class="popup-body">
                    <input type="text" class="popup-comment" placeholder="{{ _("Enter your comment") }}"/>
                    <input type="hidden" class="popup-action" value=""/>
                    <br/>
                    <input type="button" class="popup-submit" value="{{ _("Submit") }}"/>
                    <input type="button" class="popup-cancel" value="{{ _("Cancel") }}"/>
                </div>
            </div>
            <div id="popup-for-newitem" class="popup-container">
                <div class="popup-header">
                    <input type="button" class="popup-closer popup-cancel" value="{{ _("X") }}" title="{{ _("Close") }}"/>
                    <span>{{ _("Create new item") }}</span>
                </div>
                <div class="popup-body">
                    <form action={{ url_for('.ajaxmodify') }} method="post">
                        <label for="moin-newitem">{{ _("Item name") }}</label>
                        {% if item_name %}
                            <input type="text" id="moin-newitem" name="newitem" placeholder="{{ _("Enter item name here") }}" value="{{ item_name }}/" required="required"/>
                        {% else %}
                            <input type="text" id="moin-newitem" name="newitem" placeholder="{{ _("Enter item name here") }}" required="required"/>
                        {% endif %}
                        <br/>
                        <input class="moin-button" type="submit" value="{{ _("Create") }}"/>
                        <input type="button" class="popup-cancel moin-button" value="{{ _("Cancel") }}"/>
                    </form>
                </div>
            </div>
        </div>

    <div id="moin-upload-cont">
        {% set submit_url = url_for('.jfu_server', item_name=item_name) %}
        {{ forms.render_file_uploader(submit_url) }}
    </div>
    <span class="moin-drag">{{ _("(Drag and drop multiple files to this white area to upload them.)") }}</span>
    <div id="lightbox">&nbsp;</div>
{% endblock %}

{% block body_scripts %}
    {{ super() }}
    <script src="{{ url_for('static', filename='js/index_action.js') }}"></script>
    <script src="{{ url_for('static', filename='js/jfu.js') }}"></script>
    {{ forms.file_uploader_scripts() }}
{% endblock %}

{% block head %}
    {{ super() }}
    {{ forms.file_uploader_styles() }}
{% endblock %}