1 {% extends basetemplate %}
3 {% load i18n user_tags extra_tags %}
6 <script type="text/javascript">
8 var $form = $('#changelist-search');
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));
16 $('.state-type-link').click(function() {
17 $form.find('#id_state_type').val($(this).attr('href').substring(1));
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');
27 $tr.removeClass('selected');
31 $('#action-toggle').change(function() {
32 var $rows = $('#result_list').find('tbody').find('tr');
33 var $boxes = $('#result_list').find('tbody').find('input');
35 if ($(this).attr('checked')) {
36 $rows.addClass('selected');
37 $boxes.attr('checked', 'checked')
39 $rows.removeClass('selected');
40 $boxes.removeAttr('checked');
44 $('#author-selector').autocomplete('{% url matching_users %}', {
49 formatItem: function(row, i, max, value) {
50 return row[1] + ' (' + row[2] + ' {% trans "rep" %})';
53 formatResult: function(row, i, max, value){
58 $('#author-selector').result(function(event, data, formatted) {
59 if ($('#author-filter-container').find('input[value=' + data[0] + ']').length == 0) {
60 $('#author-filter-container').append($("<input name=\"authors\" type=\"hidden\" value=\"" + data[0] + "\" />"));
65 $('.author-filter-remover').click(function() {
66 var id = $(this).attr('rel');
67 if ($('#author-filter-container').find('input[value=' + id + ']').length > 0) {
68 $('#author-filter-container').find('input[value=' + id + ']').remove();
73 $('#tag-selector').autocomplete('{% url matching_tags %}', {
78 formatItem: function(row, i, max, value) {
79 return row[1] + ' (' + row[2] + ' {% trans "uses" %})';
82 formatResult: function(row, i, max, value){
87 $('#tag-selector').result(function(event, data, formatted) {
88 if ($('#tag-filter-container').find('input[value=' + data[0] + ']').length == 0) {
89 $('#tag-filter-container').append($("<input name=\"tags\" type=\"hidden\" value=\"" + data[0] + "\" />"));
94 $('.tag-filter-remover').click(function() {
95 var id = $(this).attr('rel');
96 if ($('#tag-filter-container').find('input[value=' + id + ']').length > 0) {
97 $('#tag-filter-container').find('input[value=' + id + ']').remove();
102 $('#filter-name-box').one('focus', function() {
104 $(this).css('color', 'black');
108 $('#save-filter-button').click(function() {
109 var name = $('#filter-name-box').val();
110 $.ajax({type:'POST', url: window.location, data: {filtername: name}, success: function() {
111 $('#pre-filter-container').append('<li><a href="#">' + name +'</a></li>');
119 list-style-type: none;
124 <script type="text/javascript">window.__admin_media_prefix__ = "{{ settings.ADMIN_MEDIA_PREFIX }}";</script>
125 <link href="{{ settings.ADMIN_MEDIA_PREFIX }}css/base.css" rel="stylesheet" type="text/css" media="screen" />
126 <script type="text/javascript">
127 /* gettext identity library */
129 function gettext(msgid) { return msgid; }
130 function ngettext(singular, plural, count) { return (count == 1) ? singular : plural; }
131 function gettext_noop(msgid) { return msgid; }
133 function interpolate(fmt, obj, named) {
135 return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
137 return fmt.replace(/%s/g, function(match){return String(obj.shift())});
141 /* formatting library */
143 var formats = new Array();
145 formats['DATETIME_FORMAT'] = 'N j, Y, P';
146 formats['DATE_FORMAT'] = 'N j, Y';
147 formats['DECIMAL_SEPARATOR'] = '.';
148 formats['MONTH_DAY_FORMAT'] = 'F j';
149 formats['NUMBER_GROUPING'] = '0';
150 formats['TIME_FORMAT'] = 'P';
151 formats['FIRST_DAY_OF_WEEK'] = '0';
152 formats['TIME_INPUT_FORMATS'] = ['%H:%M:%S', '%H:%M'];
153 formats['THOUSAND_SEPARATOR'] = ',';
154 formats['DATE_INPUT_FORMATS'] = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y'];
155 formats['YEAR_MONTH_FORMAT'] = 'F Y';
156 formats['SHORT_DATE_FORMAT'] = 'm/d/Y';
157 formats['SHORT_DATETIME_FORMAT'] = 'm/d/Y P';
158 formats['DATETIME_INPUT_FORMATS'] = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y'];
160 function get_format(format_type) {
161 var value = formats[format_type];
162 if (typeof(value) == 'undefined') {
170 <script type="text/javascript" src="{{ settings.ADMIN_MEDIA_PREFIX }}js/core.js"></script>
174 {% trans "Node manager" %}
176 {% block description %}
177 {% trans "Nodes bulk management" %}
180 {% block admincontent %}
181 <div id="changelist" class="module filtered">
183 <form method="get" action="" id="changelist-search">
186 <label for="searchbar"><img alt="Search" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_searchbox.png"></label>
187 {{ filter_form.text }}
188 {{ filter_form.node_type }}
189 {{ filter_form.state_type }}
190 <input type="submit" value="{% trans "Search" %}"><br />
191 {{ filter_form.text_in }}
194 <input type="hidden" name="sort" value="{{ nodes.paginator.current_sort }}" />
195 <div style="display: none;" id="author-filter-container">
196 {% for u in authors %}
197 <input name="authors" type="hidden" value="{{ u.id }}" />
200 <div style="display: none;" id="tag-filter-container">
202 <input name="tags" type="hidden" value="{{ t.id }}" />
207 <div id="changelist-filter">
208 <h2>{% trans "Filter" %}</h2>
209 <h3>{% trans "By type" %}</h3>
211 {% for type, name in node_types %}
212 <li{% ifequal filter_form.node_type.data type %} class="selected"{% endifequal %}>
213 <a class="node-type-link" href="#{{ type }}">{{ name }}</a>
217 <h3>{% trans "By state" %}</h3>
219 <li{% ifequal filter_form.state_type.data "any" %} class="selected"{% endifequal %}><a class="state-type-link" href="#any">{% trans "any" %}</a></li>
220 {% for state_type in state_types %}
221 <li{% ifequal filter_form.state_type.data state_type %} class="selected"{% endifequal %}>
222 <a class="state-type-link" href="#{{ state_type }}">{{ state_type }}</a>
226 <h3>{% trans "By author(s)" %}</h3>
227 {% if not authors.count %}
228 <small>{% trans "No users selected, use the box bellow to add users to the filter." %}</small>
231 {% for u in authors %}
232 <li class="selected">
233 <img class="author-filter-remover" rel="{{ u.id }}" src="{% media "/media/images/close-small-dark.png" %}">
234 {{ u.decorated_name }} ({{ u.reputation }})
238 <small>{% trans "Click on the cross next to a user name to remove it from the filter." %}</small>
240 <input type="text" size="20" autocomplete="off" id="author-selector" />
242 <h3>{% trans "By tag(s)" %}</h3>
243 {% if not tags.count %}
244 <small>{% trans "No tags selected, use the box bellow to add tags to the filter." %}</small>
248 <li class="selected">
249 <img class="tag-filter-remover" rel="{{ t.id }}" src="{% media "/media/images/close-small-dark.png" %}">
250 {{ t.name }} ({{ t.used_count }})
254 <small>{% trans "Click on the cross next to a tag name to remove it from the filter." %}</small>
256 <input type="text" size="20" autocomplete="off" id="tag-selector" />
258 {% comment %}<h3>{% trans "Pre defined" %}</h3>
259 {% if not settings.NODE_MAN_FILTERS %}
260 <small>{% trans "There are no saved filters. Click bellow to add." %}</small>
262 <ul id="pre-filter-container">
263 {% for uri, name in settings.NODE_MAN_FILTERS %}
264 <li><a href="{% url admin_tools "nodeman" %}{{ uri }}">{{ name }}</a></li>
267 <input type="text" size="20" id="filter-name-box" style="color: #AAA;" value="{% trans "Filter name..." %}" />
268 <button name="add-filter" value="0" title="{% trans "Click to save the current filter" %}" id="save-filter-button" class="button">{% trans "Save" %}</button>
270 {% comment %}<h3>{% trans "Show" %}</h3>
271 <form action="" method="get">
272 <div>{{ show_form.show }}</div>
273 <input type="submit" value="{% trans "Refresh" %}" />
274 </form>{% endcomment %}
276 <form id="changelist-form" method="POST" action="">
277 <div class="actions">
279 {% trans "Action" %}:
280 <select name="action">
281 <option selected="selected" value="">---------</option>
282 <option value="delete_selected">{% trans "Mark deleted" %}</option>
283 <!--<option value="hard_delete_selected">{% trans "Delete completelly" %}</option>-->
284 <option value="close_selected">{% trans "Close (questions only)" %}</option>
287 <button value="0" name="index" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
289 <table id="result_list" cellspacing="0">
293 current_sort = nodes.paginator.current_sort
294 added_at = current_sort == "added_at" and "descending" or (current_sort == "added_at_asc" and "ascending" or "")
295 score = current_sort == "score" and "descending" or (current_sort == "score_asc" and "ascending" or "")
296 act_at = current_sort == "act_at" and "descending" or (current_sort == "act_at_asc" and "ascending" or "")
298 added_at_link = current_sort == "added_at" and nodes.paginator.added_at_asc_sort_link or nodes.paginator.added_at_sort_link
299 score_link = current_sort == "score" and nodes.paginator.score_asc_sort_link or nodes.paginator.score_sort_link
300 act_at_link = current_sort == "act_at" and nodes.paginator.act_at_asc_sort_link or nodes.paginator.act_at_sort_link
303 <th class="action-checkbox-column">
304 <input type="checkbox" id="action-toggle" style="display: inline;" />
306 {% ifequal filter_form.node_type.data "all" %}
307 <th>{% trans "Type" %}</th>
309 <th>{% trans "Summary" %}</th>
310 <th>{% trans "State" %}</th>
311 <th>{% trans "Author" %}</th>
312 <th class="sorted {{ added_at }}">
313 <a href="{{ added_at_link }}">{% trans "Added at" %}</a>
315 <th class="sorted {{ score }}">
316 <a href="{{ score_link }}">{% trans "Score" %}</a>
318 <th>{% trans "Last acivity by" %}</th>
319 <th class="sorted {{ act_at }}">
320 <a href="{{ act_at_link }}">{% trans "Last activity at" %}</a>
322 <th>{% trans "Tags" %}</th>
327 {% for node in nodes.paginator.page %}
328 <tr class="{% cycle 'row1' 'row2' %}">
329 <td><input type="checkbox" name="_selected_node" value="{{ node.id }}" class="action-select"></td>
330 {% ifequal filter_form.node_type.data "all" %}
331 <th>{{ node.friendly_name }}</th>
334 <a href="{{ node.get_absolute_url }}" target="_blank">{{ node.headline }}</a><br />
337 <td>{{ node.state_list|join:", " }}</td>
338 <td><a href="{{ node.author.get_absolute_url }}">{{ node.author.username }}</a></td>
339 <td>{% diff_date node.added_at %}</td>
340 <td>{{ node.score }}</td>
341 <td><a href="{{ node.last_activity_by.get_absolute_url }}">{{ node.last_activity_by.username }}</a></td>
342 <td>{% diff_date node.last_activity_at %}</td>
344 {% for t in node.tags.all %}
345 {% if t in tags %}<b>{{ t.name }}</b>
346 {% else %}{{ t.name }}{% endif %}
353 {{ nodes.paginator.page_numbers }}