]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/osqaadmin/nodeman.html
Finished with node bulk management, although only option for now is to delete nodes.
[osqa.git] / forum / skins / default / templates / osqaadmin / nodeman.html
1 {% extends basetemplate %}
2
3 {% load i18n user_tags extra_tags %}
4
5 {% block adminjs %}
6     <script type="text/javascript">
7         $(function() {
8             var $form = $('#changelist-search');
9
10             $('.node-type-link').click(function() {
11                 $form.find('#id_state_type').val('any');
12                 $form.find('#id_node_type').val($(this).attr('href').substring(1));
13                 $form.submit();
14             });
15
16             $('.state-type-link').click(function() {
17                 $form.find('#id_state_type').val($(this).attr('href').substring(1));
18                 $form.submit();
19             });
20
21             $('.action-select').change(function() {
22                 $('#action-toggle').removeAttr('checked');
23                 var $tr = $(this).parents('tr');
24                 if ($(this).attr('checked')) {
25                     $tr.addClass('selected');
26                 } else {
27                     $tr.removeClass('selected');
28                 }
29             }).change();
30
31             $('#action-toggle').change(function() {
32                 var $rows = $('#result_list').find('tbody').find('tr');
33                 var $boxes = $('#result_list').find('tbody').find('input');
34
35                 if ($(this).attr('checked')) {
36                     $rows.addClass('selected');
37                     $boxes.attr('checked', 'checked')
38                 } else {
39                     $rows.removeClass('selected');
40                     $boxes.removeAttr('checked');
41                 }
42             });
43         });
44     </script>
45     <style>
46         #toolbar ul li {
47             list-style-type: none;
48             display: inline;
49             margin-right: 12px;
50         }
51     </style>
52 {% endblock %}
53
54 {% block subtitle %}
55     {% trans "Node manager" %}
56 {% endblock %}
57 {% block description %}
58     {% trans "Nodes bulk management" %}
59 {% endblock %}
60
61 {% block admincontent %}
62     <div id="changelist" class="module filtered">
63         <div id="toolbar">
64             <form method="get" action="" id="changelist-search">
65             <div>
66                 <label for="searchbar"><img alt="Search" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_searchbox.png"></label>
67                 {{ filter_form.text }}
68                 {{ filter_form.node_type }}
69                 {{ filter_form.state_type }}
70                 <input type="submit" value="{% trans "Search" %}"><br />
71                 {{ filter_form.text_in }}
72             </div>
73             </form>
74         </div>
75         <div id="changelist-filter">
76             <h2>{% trans "Filter" %}</h2>
77             <h3>{% trans "By type" %}</h3>
78             <ul>
79                 {% for type, name in node_types %}
80                 <li{% ifequal filter_form.node_type.data type %} class="selected"{% endifequal %}>
81                     <a class="node-type-link" href="#{{ type }}">{{ name }}</a>
82                 </li>
83                 {% endfor %}
84             </ul>
85             <h3>{% trans "By state" %}</h3>
86             <ul>
87                 <li{% ifequal filter_form.state_type.data "any" %} class="selected"{% endifequal %}><a class="state-type-link" href="#any">{% trans "any" %}</a></li>
88                 {% for state_type in state_types %}
89                     <li{% ifequal filter_form.state_type.data state_type %} class="selected"{% endifequal %}>
90                         <a class="state-type-link" href="#{{ state_type }}">{{ state_type }}</a>
91                     </li>
92                 {% endfor %}
93             </ul>
94             {% comment %}<h3>{% trans "Show" %}</h3>
95             <form action="" method="get">
96                 <div>{{ show_form.show }}</div>
97                 <input type="submit" value="{% trans "Refresh" %}" />
98             </form>{% endcomment %}
99         </div>
100         <form id="changelist-form" method="POST" action="">
101             <div class="actions">
102                 <label>
103                     {% trans "Action" %}:
104                     <select name="action">
105                         <option selected="selected" value="">---------</option>
106                         <option value="delete_selected">{% trans "Mark deleted" %}</option>
107                     </select>
108                 </label>
109                 <button value="0" name="index" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
110             </div>
111             <table id="result_list" cellspacing="0">
112                 <thead>
113                     <tr>
114                         {% spaceless %}
115                         <th class="action-checkbox-column">
116                             <input type="checkbox" id="action-toggle" style="display: inline;" />
117                         </th>
118                         {% ifequal filter_form.node_type.data "all" %}
119                             <th>{% trans "Type" %}</th>
120                         {% endifequal %}
121                         <th class="sorted{% ifequal nodes.paginator.current_sort "title" %} ascending{% endifequal %}">
122                             <a href="{{ nodes.paginator.title_sort_link }}">{% trans "Title" %}</a>
123                         </th>
124                         <th>{% trans "Author" %}</th>
125                         <th class="sorted{% ifequal nodes.paginator.current_sort "added_at" %} ascending{% endifequal %}">
126                             <a href="{{ nodes.paginator.added_at_sort_link }}">{% trans "Added at" %}</a>
127                         </th>
128                         <th class="sorted{% ifequal nodes.paginator.current_sort "score" %} ascending{% endifequal %}">
129                             <a href="{{ nodes.paginator.score_sort_link }}">{% trans "Score" %}</a>
130                         </th>
131                         <th>{% trans "Last acivity by" %}</th>
132                         <th class="sorted{% ifequal nodes.paginator.current_sort "act_at" %} ascending{% endifequal %}">
133                             <a href="{{ nodes.paginator.act_at_sort_link }}">{% trans "Last activity at" %}</a>
134                         </th>
135                         {% endspaceless %}
136                     </tr>
137                 </thead>
138                 <tbody>
139                 {% for node in nodes.paginator.page %}
140                     <tr class="{% cycle 'row1' 'row2' %}">
141                         <td><input type="checkbox" name="_selected_node" value="{{ node.id }}" class="action-select"></td>
142                         {% ifequal filter_form.node_type.data "all" %}
143                             <th>{{ node.friendly_name }}</th>
144                         {% endifequal %}
145                         <td><a href="{{ node.get_absolute_url }}" target="_blank">{{ node.headline }}</a></td>
146                         <td><a href="{{ node.author.get_absolute_url  }}">{{ node.author.username }}</a></td>
147                         <td>{% diff_date node.added_at %}</td>
148                         <td>{{ node.score }}</td>
149                         <td><a href="{{ node.last_activity_by.get_absolute_url  }}">{{ node.last_activity_by.username }}</a></td>
150                         <td>{% diff_date node.last_activity_at %}</td>
151                     </tr>
152                 {% endfor %}
153                 </tbody>
154             </table>
155             {{ nodes.paginator.page_numbers }}
156         </form>
157     </div>
158 {% endblock %}