view MoinMoin/templates/tickets.html @ 2717:c868f29f6d90

Fixed #3: Now user can select a filter(open/closed/all) and then choose sort option and only tickets relevant to that filter will be displayed
author Saurabh Kathpalia <saurabh.kathpalia95@gmail.com>
date Thu, 14 Aug 2014 23:28:15 +0530
parents 43987f1b008e
children 122424b4bc22
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']  %}
{{_("Filter:")}}
{% for status_value in status_values %}
    <form action="{{ url_for('frontend.tickets', selected_tags=list(selected_tags), time_sorting=time_sorting if time_sorting) }}" method="post" class='moin-ticketsearch-form'>
        <input type="hidden" name="q" value="{{ query if query }}" >
        &nbsp;<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 %}

<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>

<a id="moin-ticket-create-link" href="{{ url_for('frontend.new', itemtype='ticket') }}" >
    <button class="btn btn-primary btn-lg btn-block">{{ _("Create ticket") }}</button>
</a>

<form 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" class="form-control" placeholder="{{_('Find tickets')}}">
</form>

{% 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 a second, third or even fourth column header!")}}
    </p>
{% else %}
    {{ _("No Ticket found.") }}
{% endif %}

<h3 class="moin-ticket-tags">{{_("Tags")}}</h3>
{% for tag in tags %}
    {# 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 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 %}

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