src/hdalab/templates/profile_home.html
changeset 473 f469ab22542d
parent 458 604b887e70c3
child 523 4d641dc5e7e6
--- a/src/hdalab/templates/profile_home.html	Tue Mar 03 14:03:38 2015 +0100
+++ b/src/hdalab/templates/profile_home.html	Wed Mar 04 15:24:23 2015 +0100
@@ -18,13 +18,10 @@
 {% 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 %}
 
@@ -51,9 +48,10 @@
        </div>
     <div class="sub-content">
         <h2>/ {% trans 'Gerer mes Renkan' %}</h2>
-        <p>
-            <a href="{% url 'renkan_new' %}">{% trans 'Nouveau Renkan' %}</a>
-           </p>
+        <form action="{% url 'renkan_new' %}" method="post">
+            {% csrf_token %}
+            <button id="new-renkan-button" title="{% trans 'Nouveau Renkan' %}" class="renkan-basic-action"><div id="new-renkan">{% trans 'Nouveau Renkan' %}</div></button>
+        </form>
         <p class="inline">{% if page.has_previous %}<a href="?page={{ page.previous_page_number }}&sort={{ sort_param }}&order={{ order_param }}{{ filters }}" >{% trans 'Previous' %}</a>{% endif %}
            {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}<a href="?page={{ page.next_page_number }}&sort={{ sort_param }}&order={{ order_param }}{{ filters }}">{% trans 'Next' %}</a>{% endif %}</p>
         <form class="inline"><p>{% if page.has_previous or page.has_next %} - {% endif %}{% trans 'Filter' %} : <input type="text" name="title" value="{{ title }}"/> - <span class="hand_cursor" id="toggle-search">{% trans 'Advanced search' %}</span></p></p></form>
@@ -70,6 +68,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">
@@ -77,6 +76,8 @@
             <tr class="border_bottom">
               <th><a 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=date&order={% if sort_param == 'date' %}{{ opposite }}{% else %}desc{% endif %}{{ filters }}">{% trans 'Modification date' %}</a>
                   {% if sort_param == 'date' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
               <th>{% trans 'Preview' %}</th>
@@ -90,6 +91,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>{% if hr.favorite %}✓{% else %}&nbsp;{% endif %}</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>
                 <td>{{ hr.state|state_to_str }}</td>