view MoinMoin/templates/tickets.html @ 2851:5a49eeb1f307

add spaces to jinja2 expressions, add tests for missing spaces to coding_std.py
author RogerHaase <haaserd@gmail.com>
date Wed, 19 Nov 2014 11:51:19 -0700
parents 41ed0f7d1cb0
children 9f2917f3a243
line wrap: on
line source
{% extends theme("layout.html") %}
{% set search_form=None %}
{% set title = _("Tickets") %}

{% block content %}
    <h1>{{ _("Tickets") }}</h1>

    {% set status_values = ['all', 'open', 'closed']  %}
    <span>{{ _("Filter:") }}</span>
    {% for status_value in status_values %}
        <form action="{{ url_for('frontend.tickets', selected_tags=list(), time_sorting=time_sorting if time_sorting) }}" method="post" class='moin-ticketsearch-form'>
            <input type="hidden" name="q" value="" >
            <input type="hidden" name="status" value="{{ status_value }}">
            <input type="submit" value="{{ status_value.capitalize() }}" title="{{ _('Show %(status)s tickets', status=status_value) }}" class="{{ 'ticket-query-button active' if status == status_value  else 'ticket-query-button' }}">
        </form>
    {% endfor %}

    <input type="button" class="ticket-tags-button ticket-tags-toggle" title="{{ _("Show all tags") }}" value="{{ _("Tags") }}">

    <div class="tickets-sort-button dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
            {% if time_sorting == 'new' %}
                {% set sortedby = 'Recently updated' %}
            {% elif time_sorting == 'old' %}
                {% set sortedby = 'Least recently updated' %}
            {% endif %}
            {{ _("Sort: %(sortedby)s", sortedby=sortedby if sortedby) }}
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
            <li role="presentation">
                <form action="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='new') }}" method="post">
                    <input type="hidden" name="status" value="{{ status }}">
                    <input type="hidden" name="q" value="{{ query if query }}" >
                    <button type="submit">
                        {{ _("Recently updated") }}
                    </button>
                </form>
            </li>
            <li role="presentation">
                <form action="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting='old') }}" method="post">
                    <input type="hidden" name="status" value="{{ status }}">
                    <input type="hidden" name="q" value="{{ query if query }}" >
                    <button type="submit">
                        {{ _("Least Recently updated") }}
                    </button>
                </form>
            </li>
        </ul>
    </div>

    <form class="moin-ticket-search" action="{{ url_for('frontend.tickets',selected_tags=list(selected_tags), time_sorting=time_sorting if time_sorting) }}" method="post">
        <input type="hidden" name="status" value="{{ status }}">
        <input type="text" name="q" value="{{ query if query }}" id="moin-ticketsearch-query" placeholder="{{ _('Find tickets') }}">
    </form>

    {# TODO: This is a workaround that creates named tickets, rework when there is a means of creating unnamed tickets #}
    <form method="get" class="moin-ticket-create-link" action="{{ url_for('frontend.modify_item', item_name='ticket_'+current_timestamp ) }}">
        <input type="submit" value="{{ _('Create ticket') }}">
        <input type="hidden" name="itemtype" value="ticket">
    </form>

    <div class="moin-ticket-tags">
        <span>{{ _("Tags:") }}</span>
        {% for tag in tags|sort %}
            {# If user clicks on the tag then it gets selected if it is not already selected #}
            {# If that tag is already selected then it gets deselected #}
            {% set selected_tags_value = list(selected_tags.difference([tag]) if tag in selected_tags else selected_tags.union([tag])) %}
            <form class="moin-existing-tags" action="{{ url_for('frontend.tickets', selected_tags=selected_tags_value, time_sorting=time_sorting if time_sorting) }}" method="post">
                <input type="hidden" name="q" value="{{ query if query }}" >
                <input type="hidden" name="status" value="{{ status }}">
                <input type="submit" value="{{ tag }}" class="{{ 'ticket-tags-button btn btn-primary active' if tag in selected_tags else 'ticket-tags-button btn btn-default' }}">
            </form>
        {% endfor %}
    </div>

    {% if results %}
        <p>{{ _("%(result_len)d Tickets found.", result_len=results|length) }}</p>
        <table class="table table-hover" id="ticket-list">
            <thead>
                <tr>
                    <th id="ticket-itemid">{{ _("ID") }}</th>
                    <th id="ticket-summary">{{ _("Summary") }}</th>
                    <th id="ticket-status">{{ _("Status") }}</th>
                    <th id="ticket-effort" title="{{ _('Effort') }}">E</th>
                    <th id="ticket-difficulty" title="{{ _('Difficulty') }}">D</th>
                    <th id="ticket-severity" title="{{ _('Severity') }}">S</th>
                    <th id="ticket-priority" title="{{ _('Priority') }}">P</th>
                    <th id="ticket-tags">{{ _("Tags") }}</th>
                </tr>
            </thead>
            <tbody>
                {% for result in results %}
                    <tr>
                        <td>
                            <a href="{{ url_for_item(result['itemid'], field='itemid', namespace=result['namespace']) }}" title="{{ _('ITEMID: %(itemid)s', itemid=result['itemid']) }}">
                                {{ result['itemid'] | shorten_id }}
                            </a>
                        <td>
                            <a href="{{ url_for_item(result['itemid'], field='itemid', namespace=result['namespace']) }}" title="{{ _('ITEMID: %(itemid)s', itemid=result['itemid']) }}">
                                {{ result['summary'] }}
                            </a>
                        </td>
                        <td>
                            {{ _("Closed") if result['closed'] else _("Open") }}
                        </td>
                        <td>
                            {{ result.get('effort', '') }}
                        </td>
                        <td>
                            {{ result.get('difficulty', '') }}
                        </td>
                        <td>
                            {{ result.get('severity', '') }}
                        </td>
                        <td>
                            {{ result.get('priority', '') }}
                        </td>
                        <td>
                            {% for tag in result['tags'] %}
                                {{ tag }}
                            {% endfor %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>

        <p id="ticket-table-tip">
            {{ _("Tip: Sort multiple columns simultaneously by holding down the Shift key and clicking on additional column headers!") }}
        </p>
    {% else %}
        {{ _("No Ticket found.") }}
    {% endif %}

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