]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/skins/default/templates/osqaadmin/nodeman.html
Adds the hability to hard delete nodes in the bulk manager, and renames the tool.
[osqa.git] / forum / skins / default / templates / osqaadmin / nodeman.html
index 174d8bf71f313d085a3139e0d8b8f2ddc4ab6499..af8d1ce37d7038824a4d3a14b4cce05232694120 100644 (file)
                     $form.submit();
                 }
             });
-            
+
+            $('#filter-name-box').one('focus', function() {
+                $(this).val('');
+                $(this).css('color', 'black');
+            });
+
+            $('#filter-name-box').keyup(function() {
+                if ($(this).val().trim().length > 0) {
+                    $('#save-filter-button').removeAttr('disabled');
+                    $('#save-filter-button').css('color', 'black');
+                } else {
+                    $('#save-filter-button').css('color', '#AAA');
+                    $('#save-filter-button').attr('disabled', 'disabled');
+                }
+            });
+
         });
     </script>
     <style>
                     {{ filter_form.text_in }}
                 </div>
             </div>
+            <input type="hidden" name="sort" value="{{ nodes.paginator.current_sort }}" />
             <div style="display: none;" id="author-filter-container">
                 {% for u in authors %}
                 <input name="authors" type="hidden" value="{{ u.id }}" />
                 <small>{% trans "Click on the cross next to a tag name to remove it from the filter." %}</small>
             {% endif %}
             <input type="text" size="20" autocomplete="off" id="tag-selector" />
+
+            <h3>{% trans "Pre defined" %}</h3>
+            {% if not settings.NODE_MAN_FILTERS %}
+                <small>{% trans "There are no saved filters. Click bellow to add." %}</small>
+            {% endif %}
+            <ul id="pre-filter-container">
+                {% for name, uri in settings.NODE_MAN_FILTERS %}
+                <li class="selected"><a href="{% url admin_tools "nodeman" %}?{{ uri }}">{{ name }}</a></li>
+                {% endfor %}
+            </ul>
+            <form action="" method="POST">
+                <input name="filter_name" type="text" size="20" id="filter-name-box" style="color: #AAA;" value="{% trans "Filter name..." %}" />
+                <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>
+            </form>
+
             {% comment %}<h3>{% trans "Show" %}</h3>
             <form action="" method="get">
                 <div>{{ show_form.show }}</div>
                     <select name="action">
                         <option selected="selected" value="">---------</option>
                         <option value="delete_selected">{% trans "Mark deleted" %}</option>
-                        <!--<option value="hard_delete_selected">{% trans "Delete completelly" %}</option>-->
+                        <option value="hard_delete_selected">{% trans "Delete completelly" %}</option>
                         <option value="close_selected">{% trans "Close (questions only)" %}</option>
                     </select>
                 </label>
-                <button value="0" name="index" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
+                <button value="0" name="execute" title="{% trans "Run the selected action" %}" class="button" type="submit">{% trans "Go" %}</button>
             </div>
             <table id="result_list" cellspacing="0">
                 <thead>
                     <tr>
+                        {% declare %}
+                            current_sort = nodes.paginator.current_sort
+                            added_at = current_sort == "added_at" and "descending" or (current_sort == "added_at_asc" and "ascending" or "")
+                            score = current_sort == "score" and "descending" or (current_sort == "score_asc" and "ascending" or "")
+                            act_at = current_sort == "act_at" and "descending" or (current_sort == "act_at_asc" and "ascending" or "")
+
+                            added_at_link = current_sort == "added_at" and nodes.paginator.added_at_asc_sort_link or nodes.paginator.added_at_sort_link
+                            score_link = current_sort == "score" and nodes.paginator.score_asc_sort_link or nodes.paginator.score_sort_link
+                            act_at_link = current_sort == "act_at" and nodes.paginator.act_at_asc_sort_link or nodes.paginator.act_at_sort_link
+                        {% enddeclare %}
                         {% spaceless %}
                         <th class="action-checkbox-column">
                             <input type="checkbox" id="action-toggle" style="display: inline;" />
                         {% ifequal filter_form.node_type.data "all" %}
                             <th>{% trans "Type" %}</th>
                         {% endifequal %}
-                        <th class="sorted{% ifequal nodes.paginator.current_sort "title" %} ascending{% endifequal %}">
-                            <a href="{{ nodes.paginator.title_sort_link }}">{% trans "Title" %}</a>
-                        </th>
+                        <th>{% trans "Summary" %}</th>
+                        <th>{% trans "State" %}</th>
                         <th>{% trans "Author" %}</th>
-                        <th class="sorted{% ifequal nodes.paginator.current_sort "added_at" %} ascending{% endifequal %}">
-                            <a href="{{ nodes.paginator.added_at_sort_link }}">{% trans "Added at" %}</a>
+                        <th class="sorted {{ added_at }}">
+                            <a href="{{ added_at_link }}">{% trans "Added at" %}</a>
                         </th>
-                        <th class="sorted{% ifequal nodes.paginator.current_sort "score" %} ascending{% endifequal %}">
-                            <a href="{{ nodes.paginator.score_sort_link }}">{% trans "Score" %}</a>
+                        <th class="sorted {{ score }}">
+                            <a href="{{ score_link }}">{% trans "Score" %}</a>
                         </th>
                         <th>{% trans "Last acivity by" %}</th>
-                        <th class="sorted{% ifequal nodes.paginator.current_sort "act_at" %} ascending{% endifequal %}">
-                            <a href="{{ nodes.paginator.act_at_sort_link }}">{% trans "Last activity at" %}</a>
+                        <th class="sorted {{ act_at }}">
+                            <a href="{{ act_at_link }}">{% trans "Last activity at" %}</a>
                         </th>
                         <th>{% trans "Tags" %}</th>
-                        <th>{% trans "State" %}</th>
                         {% endspaceless %}
                     </tr>
                 </thead>
                         {% ifequal filter_form.node_type.data "all" %}
                             <th>{{ node.friendly_name }}</th>
                         {% endifequal %}
-                        <td><a href="{{ node.get_absolute_url }}" title="{{ node.summary }}" target="_blank">{{ node.headline }}</a></td>
+                        <td>
+                            <a href="{{ node.get_absolute_url }}" target="_blank">{{ node.headline }}</a><br />
+                            {{ node.summary }}
+                        </td>
+                        <td>{{ node.state_list|join:", " }}</td>
                         <td><a href="{{ node.author.get_absolute_url  }}">{{ node.author.username }}</a></td>
                         <td>{% diff_date node.added_at %}</td>
                         <td>{{ node.score }}</td>
                                 {% else %}{{ t.name }}{% endif %}
                             {% endfor %}
                         </td>
-                        <td>{{ node.state_list|join:", " }}</td>
                     </tr>
                 {% endfor %}
                 </tbody>