annotate gpp/templates/forums/manage_topics.html @ 505:a5d11471d031

Refactor the logic in the rate limiter decorator. Check to see if the request was ajax, as the ajax view always returns 200. Have to decode the JSON response to see if an error occurred or not.
author Brian Neal <bgneal@gmail.com>
date Sat, 03 Dec 2011 19:13:38 +0000
parents 593fb6dbd449
children
rev   line source
bgneal@232 1 {% extends 'base.html' %}
bgneal@283 2 {% load forum_tags %}
bgneal@232 3 {% block title %}Forums: {{ page_title }}{% endblock %}
bgneal@232 4 {% block custom_js %}
bgneal@232 5 <script type="text/javascript">
bgneal@232 6 //<![CDATA[
bgneal@232 7 $(document).ready(function() {
bgneal@232 8 $('#master_check').click(function() {
bgneal@232 9 var master_checked = this.checked;
bgneal@232 10 $('.topic_box').each(function(index) {
bgneal@232 11 this.checked = master_checked;
bgneal@232 12 });
bgneal@232 13 });
bgneal@232 14 $('#topic_form').submit(function() {
bgneal@232 15 var checked = false;
bgneal@232 16 $('.topic_box').each(function(index) {
bgneal@232 17 checked = checked || this.checked;
bgneal@232 18 });
bgneal@232 19 if (!checked) {
bgneal@232 20 alert("Please select some topics to remove.");
bgneal@232 21 return false;
bgneal@232 22 }
bgneal@232 23 return confirm("Are you sure you wish to remove the selected topics from your list?");
bgneal@232 24 });
bgneal@232 25 });
bgneal@232 26 //]]>
bgneal@232 27 </script>
bgneal@280 28 {% include "forums/forum_query.js" %}
bgneal@232 29 {% endblock %}
bgneal@232 30 {% block content %}
bgneal@283 31 {% forum_navigation page_title %}
bgneal@280 32 {% include "forums/forum_query.html" %}
bgneal@232 33 <p>{{ description }}</p>
bgneal@232 34 {% include 'forums/pagination.html' %}
bgneal@232 35 <form id="topic_form" action="." method="post">{% csrf_token %}
bgneal@232 36 <table class="forum-topic-table">
bgneal@232 37 <thead>
bgneal@232 38 <tr>
bgneal@232 39 <th>Forum</th>
bgneal@232 40 <th>Topic</th>
bgneal@232 41 <th><input type="checkbox" id="master_check" /></th>
bgneal@232 42 </tr>
bgneal@232 43 </thead>
bgneal@232 44 <tbody>
bgneal@232 45 {% for topic in page.object_list %}
bgneal@232 46 <tr>
bgneal@232 47 <td><a href="{{ topic.forum.get_absolute_url }}">{{ topic.forum.name }}</a></td>
bgneal@232 48 <td><a href="{{ topic.get_absolute_url }}">{{ topic.name }}</a></td>
bgneal@232 49 <td><input type="checkbox" class="topic_box" name="delete_ids" value="{{ topic.id }}" /></td>
bgneal@232 50 </tr>
bgneal@232 51 {% empty %}
bgneal@232 52 <tr><td colspan="3"><em>No topics found</em></td></tr>
bgneal@232 53 {% endfor %}
bgneal@232 54 </tbody>
bgneal@232 55 </table>
bgneal@232 56 {% include 'forums/pagination.html' %}
bgneal@232 57 {% if page.object_list %}
bgneal@232 58 <input type="hidden" name="page" value="{{ page.number }}" />
bgneal@232 59 <input type="submit" name="delete_selected" value="Delete Selected" />
bgneal@232 60 {% endif %}
bgneal@232 61 </form>
bgneal@232 62 {% endblock %}