src/hdalab/templates/editorial/manage_renkans.html
changeset 473 f469ab22542d
parent 462 df8b3b49e81c
child 474 7ec378cc1f8a
--- a/src/hdalab/templates/editorial/manage_renkans.html	Tue Mar 03 14:03:38 2015 +0100
+++ b/src/hdalab/templates/editorial/manage_renkans.html	Wed Mar 04 15:24:23 2015 +0100
@@ -16,13 +16,11 @@
 {% block js_import %}
 {{block.super}}
 <script src="{% static 'hdalab/lib/jquery-ui-1.10.4.min.js' %}"></script>
+<script src="{% static 'hdalab/js/manage.js' %}"></script>
+<script src="{% static 'hdalab/js/renkan-search.js' %}"></script>
 <script type="text/javascript">
-    $(document).ready(function() {
-        $("#toggle-search").click(function(){
-            $("#advanced-form").toggle();
-        });
-        $(".date").datepicker({ dateFormat: 'yy-mm-dd' });
-    });
+    var favorite = {{favorite}};
+    initSearch(favorite);
 </script>
 {% endblock %}
 
@@ -43,6 +41,7 @@
             <option value="4"{% if state == '4' %} selected="selected"{% endif %}>{% trans 'Rejected' %}</option>
         </select>
       </p>
+      <p>{% trans 'Favorite' %} : <input type="checkbox" id="filter-favorite-chkbx" {% if favorite >= 1 %} checked="checked" {% endif %} value="{{favorite}}" /><input type="hidden" id="filter-favorite" name="favorite" value="{{favorite}}"/></p>
       <p><input type="submit" value="{% trans 'Search' %}"/></p>
     </form>
     <table id="rk-table">
@@ -50,6 +49,8 @@
         <tr class="border_bottom">
           <th><a class="" href="?sort=title&order={% if sort_param == 'title' %}{{ opposite }}{% else %}asc{% endif %}{{ filters }}">{% trans 'Title' %}</a>
               {% if sort_param == 'title' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
+          <th><a href="?sort=favorite&order={% if sort_param == 'favorite' %}{{ opposite }}{% else %}desc{% endif %}{{ filters }}">{% trans 'Fav.' %}</a>
+              {% if sort_param == 'favorite' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
           <th><a href="?sort=user&order={% if sort_param == 'user' %}{{ opposite }}{% else %}desc{% endif %}{{ filters }}">{% trans 'User' %}</a>
               {% if sort_param == 'user' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
           <th><a href="?sort=date&order={% if sort_param == 'date' %}{{ opposite }}{% else %}desc{% endif %}{{ filters }}">{% trans 'Modification date' %}</a>
@@ -65,6 +66,7 @@
        {% with hr.renkan as r %}
         <tr class="border_bottom">
             <td><a title="View renkan" href="{% url 'renkan_view' %}?rk_id={{ r.rk_id }}">{{ r.title }}</a></td>
+            <td><form action="{% url 'renkan_favorite' rk_id=r.rk_id %}" method="post">{% csrf_token %}<input class='favorite-checkbox' type='checkbox' name='favorite' value='{{hr.id}}' {% if hr.favorite %} checked='checked'{% endif %}></form></td>
             <td>{{ r.owner.username }}</td>
             <td>{{ r.modification_date|date:"Y-m-d H:i" }}</td>
             <td>{% thumbnail r.image 100x100 as thumb %}<img src="{{ thumb.url }}" width="{{ thumb.width }}" height="{{ thumb.height }}" /></td>