src/hdalab/templates/renkan_list.html
changeset 473 f469ab22542d
parent 458 604b887e70c3
child 519 9dc050cf904b
--- a/src/hdalab/templates/renkan_list.html	Tue Mar 03 14:03:38 2015 +0100
+++ b/src/hdalab/templates/renkan_list.html	Wed Mar 04 15:24:23 2015 +0100
@@ -12,18 +12,15 @@
     <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/profile.css' %}" />
 {% endblock %}
 
-{% block renkans_actif %}actif{% endblock %}
+{% block renkans_actif %}{% if not hide_favorite %}actif{% endif %}{% endblock %}
 
 {% block js_import %}
 {{block.super}}
 <script src="{% static 'hdalab/lib/jquery-ui-1.10.4.min.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 %}
 
@@ -40,6 +37,9 @@
       <p>{% trans 'Modification date' %} : {% trans 'begin' %} <input type="text" name="startdate" value="{{ startdate }}" class="date" /> -
                                            {% trans 'end' %} : <input type="text" name="enddate" value="{{ enddate }}" class="date" /></p>
       <p>{% trans 'Username' %} : <input type="text" name="username" value="{{ username }}"/></p>
+      {% if not hide_favorite %}
+      <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>
+      {% endif %}
       <p><input type="submit" value="{% trans 'Search' %}"/></p>
     </form>
     <table id="rk-table">
@@ -47,6 +47,10 @@
         <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>
+          {% if not hide_favorite %}
+          <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>
+          {% endif %}
           <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>
@@ -58,6 +62,9 @@
        {% 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>
+            {% if not hide_favorite %}
+            <td>{% if hr.favorite %}✓{% else %}&nbsp;{% endif %}</td>
+            {% endif %}
             <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>