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();
106 list-style-type: none;
111 <script type="text/javascript">window.__admin_media_prefix__ = "{{ settings.ADMIN_MEDIA_PREFIX }}";</script>
112 <link href="{{ settings.ADMIN_MEDIA_PREFIX }}css/base.css" rel="stylesheet" type="text/css" media="screen" />
113 <script type="text/javascript">
114 /* gettext identity library */
116 function gettext(msgid) { return msgid; }
117 function ngettext(singular, plural, count) { return (count == 1) ? singular : plural; }
118 function gettext_noop(msgid) { return msgid; }
120 function interpolate(fmt, obj, named) {
122 return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
124 return fmt.replace(/%s/g, function(match){return String(obj.shift())});
128 /* formatting library */
130 var formats = new Array();
132 formats['DATETIME_FORMAT'] = 'N j, Y, P';
133 formats['DATE_FORMAT'] = 'N j, Y';
134 formats['DECIMAL_SEPARATOR'] = '.';
135 formats['MONTH_DAY_FORMAT'] = 'F j';
136 formats['NUMBER_GROUPING'] = '0';
137 formats['TIME_FORMAT'] = 'P';
138 formats['FIRST_DAY_OF_WEEK'] = '0';
139 formats['TIME_INPUT_FORMATS'] = ['%H:%M:%S', '%H:%M'];
140 formats['THOUSAND_SEPARATOR'] = ',';
141 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'];
142 formats['YEAR_MONTH_FORMAT'] = 'F Y';
143 formats['SHORT_DATE_FORMAT'] = 'm/d/Y';
144 formats['SHORT_DATETIME_FORMAT'] = 'm/d/Y P';
145 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'];
147 function get_format(format_type) {
148 var value = formats[format_type];
149 if (typeof(value) == 'undefined') {
157 <script type="text/javascript" src="{{ settings.ADMIN_MEDIA_PREFIX }}js/core.js"></script>
161 {% trans "Node manager" %}
163 {% block description %}
164 {% trans "Nodes bulk management" %}
167 {% block admincontent %}
168 <div id="changelist" class="module filtered">
170 <form method="get" action="" id="changelist-search">
173 <label for="searchbar"><img alt="Search" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_searchbox.png"></label>
174 {{ filter_form.text }}
175 {{ filter_form.node_type }}
176 {{ filter_form.state_type }}
177 <input type="submit" value="{% trans "Search" %}"><br />
178 {{ filter_form.text_in }}
181 <div style="display: none;" id="author-filter-container">
182 {% for u in authors %}
183 <input name="authors" type="hidden" value="{{ u.id }}" />
186 <div style="display: none;" id="tag-filter-container">
188 <input name="tags" type="hidden" value="{{ t.id }}" />
193 <div id="changelist-filter">
194 <h2>{% trans "Filter" %}</h2>
195 <h3>{% trans "By type" %}</h3>
197 {% for type, name in node_types %}
198 <li{% ifequal filter_form.node_type.data type %} class="selected"{% endifequal %}>
199 <a class="node-type-link" href="#{{ type }}">{{ name }}</a>
203 <h3>{% trans "By state" %}</h3>
205 <li{% ifequal filter_form.state_type.data "any" %} class="selected"{% endifequal %}><a class="state-type-link" href="#any">{% trans "any" %}</a></li>
206 {% for state_type in state_types %}
207 <li{% ifequal filter_form.state_type.data state_type %} class="selected"{% endifequal %}>
208 <a class="state-type-link" href="#{{ state_type }}">{{ state_type }}</a>
212 <h3>{% trans "By author(s)" %}</h3>
213 {% if not authors.count %}
214 <small>{% trans "No users selected, use the box bellow to add users to the filter." %}</small>
217 {% for u in authors %}
218 <li class="selected">
219 <img class="author-filter-remover" rel="{{ u.id }}" src="{% media "/media/images/close-small-dark.png" %}">
220 {{ u.decorated_name }} ({{ u.reputation }})
224 <small>{% trans "Click on the cross next to a user name to remove it from the filter." %}</small>
226 <input type="text" size="20" autocomplete="off" id="author-selector" />
228 <h3>{% trans "By tag(s)" %}</h3>
229 {% if not tags.count %}
230 <small>{% trans "No tags selected, use the box bellow to add tags to the filter." %}</small>
234 <li class="selected">
235 <img class="tag-filter-remover" rel="{{ t.id }}" src="{% media "/media/images/close-small-dark.png" %}">
236 {{ t.name }} ({{ t.used_count }})
240 <small>{% trans "Click on the cross next to a tag name to remove it from the filter." %}</small>
242 <input type="text" size="20" autocomplete="off" id="tag-selector" />
243 {% comment %}<h3>{% trans "Show" %}</h3>
244 <form action="" method="get">
245 <div>{{ show_form.show }}</div>
246 <input type="submit" value="{% trans "Refresh" %}" />
247 </form>{% endcomment %}
249 <form id="changelist-form" method="POST" action="">
250 <div class="actions">
252 {% trans "Action" %}:
253 <select name="action">
254 <option selected="selected" value="">---------</option>
255 <option value="delete_selected">{% trans "Mark deleted" %}</option>
256 <!--<option value="hard_delete_selected">{% trans "Delete completelly" %}</option>-->
257 <option value="close_selected">{% trans "Close (questions only)" %}</option>
260 <button value="0" name="index" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
262 <table id="result_list" cellspacing="0">
266 <th class="action-checkbox-column">
267 <input type="checkbox" id="action-toggle" style="display: inline;" />
269 {% ifequal filter_form.node_type.data "all" %}
270 <th>{% trans "Type" %}</th>
272 <th class="sorted{% ifequal nodes.paginator.current_sort "title" %} ascending{% endifequal %}">
273 <a href="{{ nodes.paginator.title_sort_link }}">{% trans "Title" %}</a>
275 <th>{% trans "Author" %}</th>
276 <th class="sorted{% ifequal nodes.paginator.current_sort "added_at" %} ascending{% endifequal %}">
277 <a href="{{ nodes.paginator.added_at_sort_link }}">{% trans "Added at" %}</a>
279 <th class="sorted{% ifequal nodes.paginator.current_sort "score" %} ascending{% endifequal %}">
280 <a href="{{ nodes.paginator.score_sort_link }}">{% trans "Score" %}</a>
282 <th>{% trans "Last acivity by" %}</th>
283 <th class="sorted{% ifequal nodes.paginator.current_sort "act_at" %} ascending{% endifequal %}">
284 <a href="{{ nodes.paginator.act_at_sort_link }}">{% trans "Last activity at" %}</a>
286 <th>{% trans "Tags" %}</th>
287 <th>{% trans "State" %}</th>
292 {% for node in nodes.paginator.page %}
293 <tr class="{% cycle 'row1' 'row2' %}">
294 <td><input type="checkbox" name="_selected_node" value="{{ node.id }}" class="action-select"></td>
295 {% ifequal filter_form.node_type.data "all" %}
296 <th>{{ node.friendly_name }}</th>
298 <td><a href="{{ node.get_absolute_url }}" target="_blank">{{ node.headline }}</a></td>
299 <td><a href="{{ node.author.get_absolute_url }}">{{ node.author.username }}</a></td>
300 <td>{% diff_date node.added_at %}</td>
301 <td>{{ node.score }}</td>
302 <td><a href="{{ node.last_activity_by.get_absolute_url }}">{{ node.last_activity_by.username }}</a></td>
303 <td>{% diff_date node.last_activity_at %}</td>
305 {% for t in node.tags.all %}
306 {% if t in tags %}<b>{{ t.name }}</b>
307 {% else %}{{ t.name }}{% endif %}
310 <td>{{ node.state_list|join:", " }}</td>
315 {{ nodes.paginator.page_numbers }}