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');
107 $('#filter-name-box').keyup(function() {
108 if ($(this).val().trim().length > 0) {
109 $('#save-filter-button').removeAttr('disabled');
110 $('#save-filter-button').css('color', 'black');
112 $('#save-filter-button').css('color', '#AAA');
113 $('#save-filter-button').attr('disabled', 'disabled');
121 list-style-type: none;
126 <script type="text/javascript">window.__admin_media_prefix__ = "{{ settings.ADMIN_MEDIA_PREFIX }}";</script>
127 <link href="{{ settings.ADMIN_MEDIA_PREFIX }}css/base.css" rel="stylesheet" type="text/css" media="screen" />
128 <script type="text/javascript">
129 /* gettext identity library */
131 function gettext(msgid) { return msgid; }
132 function ngettext(singular, plural, count) { return (count == 1) ? singular : plural; }
133 function gettext_noop(msgid) { return msgid; }
135 function interpolate(fmt, obj, named) {
137 return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
139 return fmt.replace(/%s/g, function(match){return String(obj.shift())});
143 /* formatting library */
145 var formats = new Array();
147 formats['DATETIME_FORMAT'] = 'N j, Y, P';
148 formats['DATE_FORMAT'] = 'N j, Y';
149 formats['DECIMAL_SEPARATOR'] = '.';
150 formats['MONTH_DAY_FORMAT'] = 'F j';
151 formats['NUMBER_GROUPING'] = '0';
152 formats['TIME_FORMAT'] = 'P';
153 formats['FIRST_DAY_OF_WEEK'] = '0';
154 formats['TIME_INPUT_FORMATS'] = ['%H:%M:%S', '%H:%M'];
155 formats['THOUSAND_SEPARATOR'] = ',';
156 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'];
157 formats['YEAR_MONTH_FORMAT'] = 'F Y';
158 formats['SHORT_DATE_FORMAT'] = 'm/d/Y';
159 formats['SHORT_DATETIME_FORMAT'] = 'm/d/Y P';
160 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'];
162 function get_format(format_type) {
163 var value = formats[format_type];
164 if (typeof(value) == 'undefined') {
172 <script type="text/javascript" src="{{ settings.ADMIN_MEDIA_PREFIX }}js/core.js"></script>
176 {% trans "Node manager" %}
178 {% block description %}
179 {% trans "Nodes bulk management" %}
182 {% block admincontent %}
183 <div id="changelist" class="module filtered">
185 <form method="get" action="" id="changelist-search">
188 <label for="searchbar"><img alt="Search" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_searchbox.png"></label>
189 {{ filter_form.text }}
190 {{ filter_form.node_type }}
191 {{ filter_form.state_type }}
192 <input type="submit" value="{% trans "Search" %}"><br />
193 {{ filter_form.text_in }}
196 <input type="hidden" name="sort" value="{{ nodes.paginator.current_sort }}" />
197 <div style="display: none;" id="author-filter-container">
198 {% for u in authors %}
199 <input name="authors" type="hidden" value="{{ u.id }}" />
202 <div style="display: none;" id="tag-filter-container">
204 <input name="tags" type="hidden" value="{{ t.id }}" />
209 <div id="changelist-filter">
210 <h2>{% trans "Filter" %}</h2>
211 <h3>{% trans "By type" %}</h3>
213 {% for type, name in node_types %}
214 <li{% ifequal filter_form.node_type.data type %} class="selected"{% endifequal %}>
215 <a class="node-type-link" href="#{{ type }}">{{ name }}</a>
219 <h3>{% trans "By state" %}</h3>
221 <li{% ifequal filter_form.state_type.data "any" %} class="selected"{% endifequal %}><a class="state-type-link" href="#any">{% trans "any" %}</a></li>
222 {% for state_type in state_types %}
223 <li{% ifequal filter_form.state_type.data state_type %} class="selected"{% endifequal %}>
224 <a class="state-type-link" href="#{{ state_type }}">{{ state_type }}</a>
228 <h3>{% trans "By author(s)" %}</h3>
229 {% if not authors.count %}
230 <small>{% trans "No users selected, use the box bellow to add users to the filter." %}</small>
233 {% for u in authors %}
234 <li class="selected">
235 <img class="author-filter-remover" rel="{{ u.id }}" src="{% media "/media/images/close-small-dark.png" %}">
236 {{ u.decorated_name }} ({{ u.reputation }})
240 <small>{% trans "Click on the cross next to a user name to remove it from the filter." %}</small>
242 <input type="text" size="20" autocomplete="off" id="author-selector" />
244 <h3>{% trans "By tag(s)" %}</h3>
245 {% if not tags.count %}
246 <small>{% trans "No tags selected, use the box bellow to add tags to the filter." %}</small>
250 <li class="selected">
251 <img class="tag-filter-remover" rel="{{ t.id }}" src="{% media "/media/images/close-small-dark.png" %}">
252 {{ t.name }} ({{ t.used_count }})
256 <small>{% trans "Click on the cross next to a tag name to remove it from the filter." %}</small>
258 <input type="text" size="20" autocomplete="off" id="tag-selector" />
260 <h3>{% trans "Pre defined" %}</h3>
261 {% if not settings.NODE_MAN_FILTERS %}
262 <small>{% trans "There are no saved filters. Click bellow to add." %}</small>
264 <ul id="pre-filter-container">
265 {% for name, uri in settings.NODE_MAN_FILTERS %}
266 <li class="selected"><a href="{% url admin_tools "nodeman" %}?{{ uri }}">{{ name }}</a></li>
269 <form action="" method="POST">
270 <input name="filter_name" type="text" size="20" id="filter-name-box" style="color: #AAA;" value="{% trans "Filter name..." %}" />
271 <button name="save_filter" value="0" style="color: #AAA;" title="{% trans "Click to save the current filter" %}" id="save-filter-button" disabled="disabled" class="button">{% trans "Save" %}</button>
274 {% comment %}<h3>{% trans "Show" %}</h3>
275 <form action="" method="get">
276 <div>{{ show_form.show }}</div>
277 <input type="submit" value="{% trans "Refresh" %}" />
278 </form>{% endcomment %}
280 <form id="changelist-form" method="POST" action="">
281 <div class="actions">
283 {% trans "Action" %}:
284 <select name="action">
285 <option selected="selected" value="">---------</option>
286 <option value="delete_selected">{% trans "Mark deleted" %}</option>
287 <!--<option value="hard_delete_selected">{% trans "Delete completelly" %}</option>-->
288 <option value="close_selected">{% trans "Close (questions only)" %}</option>
291 <button value="0" name="execute" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
293 <table id="result_list" cellspacing="0">
297 current_sort = nodes.paginator.current_sort
298 added_at = current_sort == "added_at" and "descending" or (current_sort == "added_at_asc" and "ascending" or "")
299 score = current_sort == "score" and "descending" or (current_sort == "score_asc" and "ascending" or "")
300 act_at = current_sort == "act_at" and "descending" or (current_sort == "act_at_asc" and "ascending" or "")
302 added_at_link = current_sort == "added_at" and nodes.paginator.added_at_asc_sort_link or nodes.paginator.added_at_sort_link
303 score_link = current_sort == "score" and nodes.paginator.score_asc_sort_link or nodes.paginator.score_sort_link
304 act_at_link = current_sort == "act_at" and nodes.paginator.act_at_asc_sort_link or nodes.paginator.act_at_sort_link
307 <th class="action-checkbox-column">
308 <input type="checkbox" id="action-toggle" style="display: inline;" />
310 {% ifequal filter_form.node_type.data "all" %}
311 <th>{% trans "Type" %}</th>
313 <th>{% trans "Summary" %}</th>
314 <th>{% trans "State" %}</th>
315 <th>{% trans "Author" %}</th>
316 <th class="sorted {{ added_at }}">
317 <a href="{{ added_at_link }}">{% trans "Added at" %}</a>
319 <th class="sorted {{ score }}">
320 <a href="{{ score_link }}">{% trans "Score" %}</a>
322 <th>{% trans "Last acivity by" %}</th>
323 <th class="sorted {{ act_at }}">
324 <a href="{{ act_at_link }}">{% trans "Last activity at" %}</a>
326 <th>{% trans "Tags" %}</th>
331 {% for node in nodes.paginator.page %}
332 <tr class="{% cycle 'row1' 'row2' %}">
333 <td><input type="checkbox" name="_selected_node" value="{{ node.id }}" class="action-select"></td>
334 {% ifequal filter_form.node_type.data "all" %}
335 <th>{{ node.friendly_name }}</th>
338 <a href="{{ node.get_absolute_url }}" target="_blank">{{ node.headline }}</a><br />
341 <td>{{ node.state_list|join:", " }}</td>
342 <td><a href="{{ node.author.get_absolute_url }}">{{ node.author.username }}</a></td>
343 <td>{% diff_date node.added_at %}</td>
344 <td>{{ node.score }}</td>
345 <td><a href="{{ node.last_activity_by.get_absolute_url }}">{{ node.last_activity_by.username }}</a></td>
346 <td>{% diff_date node.last_activity_at %}</td>
348 {% for t in node.tags.all %}
349 {% if t in tags %}<b>{{ t.name }}</b>
350 {% else %}{{ t.name }}{% endif %}
357 {{ nodes.paginator.page_numbers }}