summaryrefslogtreecommitdiff
path: root/templates/todolists/view.html
blob: 504c8cbb9a62c83bd29680610aeb7472b396611b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{% extends "base.html" %}
{% block title %}Arch Linux - Todo: {{ list.name }}{% endblock %}

{% block content %}
<div id="dev-todo-details" class="box">

    <h2>Todo List: {{ list.name }}</h2>

    <ul class="admin-actions">
        {% if perms.main.delete_todolist %}
        <li><a href="/todo/delete/{{list.id}}/"
            title="Delete this todo list">Delete Todo List</a></li>
        {% endif %}
        {% if perms.main.change_todolist %}
        <li><a href="/todo/edit/{{list.id}}/"
            title="Edit this todo list">Edit Todo List</a></li>
        {% endif %}
    </ul>

    <p>{{list.description|safe|linebreaks}}</p>

    <table id="dev-todo-pkglist" class="results todo-table">
        <thead>
            <tr>
                <th>Name</th>
                <th>Arch</th>
                <th>Repo</th>
                <th>Maintainer</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            {% for pkg in list.packages %}
            <tr class="{% cycle 'odd' 'even' %}">
                <td><a href="{{ pkg.pkg.get_absolute_url }}"
                        title="View package details for {{ pkg.pkg.pkgname }}">{{ pkg.pkg.pkgname }}</a></td>
                <td>{{ pkg.pkg.arch.name }}</td>
                <td>{{ pkg.pkg.repo.name|capfirst }}</td>
                <td>{{ pkg.pkg.maintainers|join:', ' }}</td>
                <td>
                    {% if pkg.complete %}
                    <a href="/todo/flag/{{ list.id }}/{{ pkg.id }}/"
                        class="complete" title="Toggle completion status">Complete</a>
                    {% else %}
                    <a href="/todo/flag/{{ list.id }}/{{ pkg.id }}/"
                        class="incomplete" title="Toggle completion status">Incomplete</a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% load cdn %}{% jquery %}
<script type="text/javascript" src="/media/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
    $(function() {
        $('a[href*=todo/flag]').click(function() {
            var link = this;

            $.getJSON(link.href, function(data) {
                if (data.complete) {
                    $(link).text('Complete').addClass('complete').removeClass('incomplete');
                } else {
                    $(link).text('Incomplete').addClass('incomplete').removeClass('complete');
                }
            });

            return false;
        });
    });
$.tablesorter.addParser({
    id: 'todostatus',
    is: function(s) { return false; },
    format: function(s) {
        return s.match(/incomplete/) ? 1 : 0;
    },
    type: 'numeric'
});
$(document).ready(function() {
    $(".results").tablesorter({
        widgets: ['zebra'],
        sortList: [[0,0], [1,0]],
        headers: { 4: { sorter: 'todostatus' } }
    });
});
</script>
{% endblock %}