improve filter display + default sort order for managing renkans V03.00.01
authorymh <ymh.work@gmail.com>
Tue, 07 Jul 2015 15:59:31 +0200
changeset 640 939461cc322b
parent 639 ff74440b69e0
child 641 f177958b4933
improve filter display + default sort order for managing renkans
src/hdalab/__init__.py
src/hdalab/static/hdalab/css/profile.css
src/hdalab/templates/editorial/manage_renkans.html
src/hdalab/templates/profile_home.html
src/hdalab/templates/renkan_list.html
src/hdalab/views/editorial.py
src/hdalab/views/profile.py
--- a/src/hdalab/__init__.py	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/__init__.py	Tue Jul 07 15:59:31 2015 +0200
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-VERSION = (3, 0, 0, "final", 0)
+VERSION = (3, 0, 1, "final", 0)
 
 
 def get_version():
--- a/src/hdalab/static/hdalab/css/profile.css	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/static/hdalab/css/profile.css	Tue Jul 07 15:59:31 2015 +0200
@@ -33,6 +33,14 @@
   padding: 5px;
 }
 
+.rk-table-header-span {
+  white-space: nowrap;
+}
+
+.rk-table-header-span a {
+  white-space: normal;
+}
+
 .renkan_list_actions {
   white-space: nowrap;
   width: 90px;
@@ -90,12 +98,17 @@
 #advanced-form {
   border-bottom: 1pt solid #555;
   border-top: 1pt solid #555;
+  margin: 10px 0;
 }
 
 #advanced-form p {
   font-size: 12px;
 }
 
+#advanced-form p:last-child {
+  margin-bottom: 10px;
+}
+
 /* editorialisation part */
 .hand_cursor {
   cursor: pointer;
--- a/src/hdalab/templates/editorial/manage_renkans.html	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/templates/editorial/manage_renkans.html	Tue Jul 07 15:59:31 2015 +0200
@@ -60,17 +60,17 @@
     <table id="rk-table">
       <thead>
         <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>
-              {% 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><span class='rk-table-header-span'><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 %}</span></th>
+          <th><span class='rk-table-header-span'><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 %}</span></th>
+          <th><span class='rk-table-header-span'><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 %}</span></th>
+          <th><span class='rk-table-header-span'><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 %}</span></th>
           <th>{% trans 'Preview' %}</th>
-          <th><a href="?sort=state&order={% if sort_param == 'state' %}{{ opposite }}{% else %}asc{% endif %}{{ filters }}">{% trans 'State' %}</a>
-              {% if sort_param == 'state' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
+          <th><span class='rk-table-header-span'><a href="?sort=state&order={% if sort_param == 'state' %}{{ opposite }}{% else %}asc{% endif %}{{ filters }}">{% trans 'State' %}</a>
+              {% if sort_param == 'state' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</span></th>
           <th>{% trans 'Actions' %}</th>
         </tr>
       </thead>
--- a/src/hdalab/templates/profile_home.html	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/templates/profile_home.html	Tue Jul 07 15:59:31 2015 +0200
@@ -75,15 +75,15 @@
         <table id="rk-table">
           <thead>
             <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><span class='rk-table-header-span'><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 %}</span></th>
+              <th><span class='rk-table-header-span'><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 %}</span></th>
+              <th><span class='rk-table-header-span'><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 %}</span></th>
               <th>{% trans 'Preview' %}</th>
-              <th><a href="?sort=state&order={% if sort_param == 'state' %}{{ opposite }}{% else %}asc{% endif %}{{ filters }}">{% trans 'State' %}</a>
-                  {% if sort_param == 'state' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</th>
+              <th><span class='rk-table-header-span'><a href="?sort=state&order={% if sort_param == 'state' %}{{ opposite }}{% else %}asc{% endif %}{{ filters }}">{% trans 'State' %}</a>
+                  {% if sort_param == 'state' %}<span class="ui-icon {% if opposite == 'asc' %}ui-icon-triangle-1-s{% else %}ui-icon-triangle-1-n{% endif %}"></span>{% endif %}</span></th>
               <th>{% trans 'Actions' %}</th>
             </tr>
           </thead>
--- a/src/hdalab/templates/renkan_list.html	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/templates/renkan_list.html	Tue Jul 07 15:59:31 2015 +0200
@@ -57,18 +57,18 @@
     <table id="rk-table">
       <thead>
         <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><span class='rk-table-header-span'><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 %}</span></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>
+          <th><span class='rk-table-header-span'><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 %}</span></th>
           {% endif %}
           {% if show_username %}
-          <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><span class='rk-table-header-span'><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 %}</span></th>
           {% endif %}
-          <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><span class='rk-table-header-span'><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 %}</span></th>
           <th>Preview</th><th>Actions</th></tr>
       </thead>
       <tbody>
--- a/src/hdalab/views/editorial.py	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/views/editorial.py	Tue Jul 07 15:59:31 2015 +0200
@@ -17,6 +17,9 @@
 
 class ManageRenkans(BaseRenkanList):
     template_name = "editorial/manage_renkans.html"
+    default_sort_field = "state"
+    default_sort_order = "asc"
+
     
     def get_context_data(self, **kwargs):
         return self.update_context(super(ManageRenkans, self).get_context_data(**kwargs), HdalabRenkan.objects.exclude(state=HdalabRenkan.EDITION).exclude(state=HdalabRenkan.REJECTED).select_related("renkan", "renkan__owner"))
--- a/src/hdalab/views/profile.py	Fri Jul 03 13:39:07 2015 +0200
+++ b/src/hdalab/views/profile.py	Tue Jul 07 15:59:31 2015 +0200
@@ -49,6 +49,9 @@
 
 class BaseRenkanList(TemplateView):
     
+    default_sort_field = "date"
+    default_sort_order = "desc"
+
     def update_context(self, context, renkan_queryset):
         
         filters = ""
@@ -83,8 +86,8 @@
         elif filter_favorite == 0:
             renkan_queryset = renkan_queryset.filter(favorite=False)
 
-        sort_param = self.request.GET.get('sort', "date")
-        order_param = self.request.GET.get('order', "desc")
+        sort_param = self.request.GET.get('sort', self.default_sort_field)
+        order_param = self.request.GET.get('order', self.default_sort_order)
         sort = {"date":"renkan__modification_date", "title":"renkan__title", "state":"state", "user":"renkan__owner__username", "favorite":"favorite"}.get(sort_param, None)
         if order_param=="desc":
             order = "-"