# HG changeset patch # User cavaliet # Date 1411728935 -7200 # Node ID a0fa17c4823609af0e68a2dadcb13d289bb0bb8a # Parent 9a854bb09f347a12fb6cfa15ddb6fab743e31679 title filter on renkan lists (personal, public and admin). diff -r 9a854bb09f34 -r a0fa17c48236 src/hdalab/static/hdalab/css/profile.css --- a/src/hdalab/static/hdalab/css/profile.css Thu Sep 25 17:14:29 2014 +0200 +++ b/src/hdalab/static/hdalab/css/profile.css Fri Sep 26 12:55:35 2014 +0200 @@ -19,19 +19,11 @@ float: left; margin-right: 5px; } -.ui-icon-eye { background-position: -160px -144px; } -/* sortable */ -.header{ - background-image:url('../img/bg.gif'); - background-repeat: no-repeat; - background-position: right center; - cursor: pointer; +.ui-icon-eye { + background-position: -160px -144px; } -.headerSortUp{ - background-image: url('../img/asc.gif'); -} -.headerSortDown{ - background-image:url('../img/desc.gif'); +.inline{ + display: inline-block; } /* editorialisation part */ diff -r 9a854bb09f34 -r a0fa17c48236 src/hdalab/templates/editorial/manage_renkans.html --- a/src/hdalab/templates/editorial/manage_renkans.html Thu Sep 25 17:14:29 2014 +0200 +++ b/src/hdalab/templates/editorial/manage_renkans.html Fri Sep 26 12:55:35 2014 +0200 @@ -14,19 +14,20 @@ {% endblock %} {% block main_content %} -

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous or page.has_next %} - {% endif %}{% trans 'Filter' %} :

- - - - @@ -51,6 +52,6 @@ {% endfor %}
{% trans 'Title' %} + {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %}{% trans 'User' %} + {% trans 'User' %} {% if sort_param == 'user' %}{% endif %}{% trans 'Modification date' %} + {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} {% trans 'Preview' %}{% trans 'State' %} + {% trans 'State' %} {% if sort_param == 'state' %}{% endif %} {% trans 'Actions' %}
-

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

{% endblock %} \ No newline at end of file diff -r 9a854bb09f34 -r a0fa17c48236 src/hdalab/templates/profile_home.html --- a/src/hdalab/templates/profile_home.html Thu Sep 25 17:14:29 2014 +0200 +++ b/src/hdalab/templates/profile_home.html Fri Sep 26 12:55:35 2014 +0200 @@ -20,17 +20,18 @@

Nouveau Renkan - Modification du mot de passe

 

Mes renkans :

-

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous or page.has_next %} - {% endif %}{% trans 'Filter' %} :

- - - @@ -57,6 +58,6 @@ {% endfor %}
{% trans 'Title' %} + {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %}{% trans 'Modification date' %} + {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} {% trans 'Preview' %}{% trans 'State' %} + {% trans 'State' %} {% if sort_param == 'state' %}{% endif %} {% trans 'Actions' %}
-

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

{% endblock %} \ No newline at end of file diff -r 9a854bb09f34 -r a0fa17c48236 src/hdalab/templates/renkan_list.html --- a/src/hdalab/templates/renkan_list.html Thu Sep 25 17:14:29 2014 +0200 +++ b/src/hdalab/templates/renkan_list.html Fri Sep 26 12:55:35 2014 +0200 @@ -16,14 +16,15 @@ {% block main_content %}

Liste des renkans publiques

-

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous or page.has_next %} - {% endif %}{% trans 'Filter' %} :

- - @@ -43,6 +44,6 @@ {% endfor %}
{% trans 'Title' %} + {% trans 'Title' %} {% if sort_param == 'title' %}{% endif %}{% trans 'Modification date' %} + {% trans 'Modification date' %} {% if sort_param == 'date' %}{% endif %} PreviewActions
-

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} - {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

+

{% if page.has_previous %}{% trans 'Previous' %}{% endif %} + {% if page.has_previous and page.has_next %} - {% endif %}{% if page.has_next %}{% trans 'Next' %}{% endif %}

{% endblock %} \ No newline at end of file diff -r 9a854bb09f34 -r a0fa17c48236 src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Thu Sep 25 17:14:29 2014 +0200 +++ b/src/hdalab/views/profile.py Fri Sep 26 12:55:35 2014 +0200 @@ -45,6 +45,10 @@ def update_context(self, context, renkan_queryset): + filter_title = self.request.GET.get("filter", "") + if(len(filter_title)>0): + renkan_queryset = renkan_queryset.filter(renkan__title__icontains=filter_title) + sort_param = self.request.GET.get('sort', "date") order_param = self.request.GET.get('order', "desc") sort = {"date":"renkan__modification_date", "title":"renkan__title", "state":"state", "user":"renkan__owner__username"}.get(sort_param) @@ -55,8 +59,8 @@ order = "" opposite = "desc" - rl = renkan_queryset.order_by(order + sort) - p = Paginator(rl, settings.RENKANS_PER_PAGE) + renkan_queryset = renkan_queryset.order_by(order + sort) + p = Paginator(renkan_queryset, settings.RENKANS_PER_PAGE) page_nb = self.request.GET.get('page') try: page = p.page(page_nb) @@ -65,7 +69,7 @@ except EmptyPage: page = p.page(p.num_pages) - context.update({"page": page, "sort_param":sort_param, "order_param":order_param, "opposite":opposite}) + context.update({"page": page, "sort_param":sort_param, "order_param":order_param, "opposite":opposite, "filter":filter_title}) return context @@ -76,7 +80,7 @@ template_name = "profile_home.html" def get_context_data(self, **kwargs): - return self.update_context( super(ProfileHome, self).get_context_data(**kwargs), HdalabRenkan.objects.select_related("renkan").filter(renkan__owner=self.request.user) ) + return self.update_context( super(ProfileHome, self).get_context_data(**kwargs), HdalabRenkan.objects.select_related("renkan").filter(renkan__owner=self.request.user)) class RenkanPublicList(BaseRenkanList):