]> git.parisson.com Git - telemeta.git/commitdiff
fix bug on playlist add and add pagination on advance search
authorafilsaime <shadow_kungfu@hotmail.fr>
Tue, 9 Jun 2015 13:58:56 +0000 (15:58 +0200)
committerafilsaime <shadow_kungfu@hotmail.fr>
Tue, 9 Jun 2015 13:58:56 +0000 (15:58 +0200)
telemeta/haystack_urls.py
telemeta/templates/search/addplaylist.html
telemeta/templates/search/advanceSearch.html
telemeta/views/new_playlist.py

index 0692c714125caad0c67640c0870b4f7b0890486b..28f37011f6baae9e6fdef9d9834e230299a19f39 100644 (file)
@@ -11,5 +11,5 @@ urlpatterns = patterns('',
     url(r'^advance/$', HaystackAdvanceSearch(form_class=HayAdvanceForm, template='search/advanceSearch.html'), name='haystack_advance_search'),
     url(r'^advance/(?P<type>[A-Za-z0-9._-]+)/$', HaystackAdvanceSearch(form_class=HayAdvanceForm, template='search/advanceSearch.html'), name='haystack_advance_search_type'),
     url(r'^playlist_add/(?P<type>[A-Za-z0-9._-]+)/$', NewPlaylistView().display, name='haystack_playlist'),
-    url(r'^playlist_confirmation/$',NewPlaylistView().addToPlaylist, name='add_confirmation'),
+    url(r'^playlist_confirmation/(?P<type>[A-Za-z0-9._-]+)/$',NewPlaylistView().addToPlaylist, name='add_confirmation'),
 )
index 778bb45cf4ea42554c8538004e3c0dab46f673df..3e3c7b70f27b3210b7a9f08755de8c44c7ac8c06 100644 (file)
@@ -54,7 +54,8 @@
     </style>
 {% endblock %}
 {% block content %}
-    <form method="POST" action="{%url "add_confirmation"%}">{% csrf_token %}
+
+    <form method="POST" action="{%url "add_confirmation" type %}">{% csrf_token %}
     <div class="row">
         <div class="col-md-4">
             <table class="listing" style="width:100%">
index f7a7fb5db6fbe5d25f02f792c57404f44c72f832..973ca0318f02d6553a8d8168db7ef8fb6cdfb2b8 100644 (file)
@@ -1,6 +1,7 @@
 {% extends 'telemeta/base.html' %}
 {% load telemeta_utils %}
 {% load i18n %}
+{% load bootstrap_pagination %}
 
 
 {% block title %}
     </form>
 
         {% if query %}
-            <h1>{% trans "Results" %}</h1>
+
+            <div class="row">
+                <div class="col-md-3">
+                    <img src="{{ STATIC_URL }}telemeta/images/search_red.png" alt="search-results" style="vertical-align:middle" /> <h1>{% trans "Search Results" %}</h1>
+                </div>
+                <div class="col-md-7">
+                    {% bootstrap_paginate page range=10 show_first_last="True" %}
+                </div>
+                <div class="col-md-0">&nbsp;</div>
+            </div>
+
             {% ifequal type 'item' %}
                  <p><b>Items ({{item_count}}) | <a href="{% url "haystack_advance_search_type" "collection" %}?{{request.GET.urlencode}}">Collections ({{collection_count}})</a></b></p>
              {% else %}
                     <p><b><a href="{% url "haystack_advance_search_type" "item" %}?{{request.GET.urlencode}}">Items ({{item_count}}) </a>| Collections ({{collection_count}})</b></p>
                 {% endifequal %}
              {% endifequal %}
-             <form method="POST" action="{% url "haystack_playlist"%} ">{% csrf_token %}
+             <form method="POST" action="{% url "haystack_playlist" type%} ">{% csrf_token %}
              {% with object_list as items %}
                 <div class="fullpage">
                     {% ifequal type 'item' %}
                     {%endifequal%}
                 </div>
 
-                {% if page.has_previous or page.has_next %}
-                    <div>
-                        {% if page.has_previous %}<a href="?{{request.GET.urlencode}};page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
-                        |
-                        {% if page.has_next %}<a href="?{{request.GET.urlencode}};page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
-                    </div>
-                {% endif %}
             {% endwith %}
             {% if user.is_authenticated %}
                 <input type="hidden" name="lastquerypath" value="{{request.get_full_path}}"/>
index b60fc8555cdef42ba4a202757c1c524c7d876a33..2ddb67e3646948b514eecae9007005ffdb2fd231 100644 (file)
@@ -13,7 +13,7 @@ class NewPlaylistView(object):
 
         idlist = request.POST.getlist('selected_items_list')
         itemlist = []
-        if self.type =="items":
+        if self.type =="item":
             for itemid in idlist:
                 itemlist.append(MediaItem.objects.all().get(id=itemid))