]> git.parisson.com Git - telemeta.git/commitdiff
add return to search result option on playlist adding
authorafilsaime <shadow_kungfu@hotmail.fr>
Fri, 5 Jun 2015 10:33:27 +0000 (12:33 +0200)
committerafilsaime <shadow_kungfu@hotmail.fr>
Fri, 5 Jun 2015 10:33:27 +0000 (12:33 +0200)
telemeta/templates/search/addplaylist.html
telemeta/templates/search/advanceSearch.html
telemeta/templates/search/confirmation_add_playslist.html
telemeta/templates/search/search.html
telemeta/views/new_playlist.py

index e217921a5702f58ee10fde77d36df1922e3cdea8..bb8e639949d92c1c9c8c38077481f046b3ac8614 100644 (file)
 {% endblock %}
 {% block content %}
     <form method="POST" action="{%url "add_confirmation"%}">{% csrf_token %}
-        <select name="playlist_id" style="min-width:200px" id="selection">
-            {% for playlist in existing_playlists %}
-                <option value="{{playlist.id}}">{{playlist.title}}</option>
-            {% endfor %}
-        </select>
-        <table class="listing">
-       <thead>
-        <tr><th>{% trans "Title"%}</th>
+    <div class="row">
+        <div class="col-md-4">
+            <table class="listing" style="width:100%">
+           <thead>
+            <tr><th>{% trans "Selected items : "%}</th>
 
-        </tr>
-       </thead><tbody>
-        {% for item in selected_items_list %}
-        <tr>
+            </tr>
+           </thead><tbody>
+            {% for item in selected_items_list %}
+            <tr>
 
-         <td><a href="#">
-            {{item.title}}</a></td>
-        </tr>
-        {% endfor %}
-        </tbody>
-      </table>
+             <td><a href="#">
+                {{item.title}}</a></td>
+            </tr>
+            {% endfor %}
+            </tbody>
+            </table>
+        </div>
+        <div class="col-md-4 col-md-offset-3">
+              <label for="selection">select your playlist : </label>
+              <select name="playlist_id" style="width:100%;" id="selection">
+                    {% for playlist in existing_playlists %}
+                        <option value="{{playlist.id}}">{{playlist.title}}</option>
+                    {% endfor %}
+              </select>
+        </div>
+      </div>
       {% for item in selected_items_list %}
           <input type="hidden" name="item_id" value="{{item.id}}"/>
       {% endfor %}
-      <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to Playlist" %}</button>
+      <input type="hidden" name="lastquerypath" value="{{lastquerypath}}"/>
+      <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to Playlist" %}</button> or <a style="margin-top:10px" href="{{lastquerypath}}" id="btn" class="btn btn-default">return to search results</a>
   </form>
 {% endblock %}
 {% block extra_javascript %}
index 22173f2daff0623507d69c92dfc2f18c378d7316..375c99dca49cd7281c314fc33e7d251e53bcc7cb 100644 (file)
                 {% endif %}
             {% endwith %}
             {% if user.is_authenticated %}
+                <input type="hidden" name="lastquerypath" value="{{request.get_full_path}}"/>
                 <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to playlist" %}</button>
             {% endif %}
             </form>
index ac3e530bc141249e806c5361d4a4d6e9db6058d4..635f4350989af852e628964e4be18e8a3ee234a2 100644 (file)
@@ -6,7 +6,20 @@
 {% trans "Playlist Confirmation" %}
 {% endblock %}
 {% block content %}
-    {{existing_playlists}}
-    {{user.username}}
-    <h1>Added to PlayList</h1>
+    <table class="listing" style="width:100%">
+       <thead>
+        <tr><th>{% trans "Added to playlist : "%}</th>
+
+        </tr>
+       </thead><tbody>
+        {% for item in selected_items_list %}
+        <tr>
+
+         <td><a href="#">
+            {{item.title}}</a></td>
+        </tr>
+        {% endfor %}
+        </tbody>
+    </table></br>
+    <a style="margin-top:10px" href="{{lastquerypath}}" id="btn" class="btn btn-default">return to search results</a>
 {% endblock %}
\ No newline at end of file
index 433c11c0aeb7a7032dcce81766558bfa3e72c36a..a8bc5f3d68155a3caa7ca7305970635a99f3bf59 100644 (file)
@@ -55,6 +55,7 @@
                 {% endif %}
             {% endwith %}
             {% if user.is_authenticated %}
+                <input type="hidden" name="lastquerypath" value="{{request.get_full_path}}"/>
                 <button style="margin-top:10px" type="submit" id="btn" class="btn btn-default">{% trans "Add to playlist" %}</button>
             {% endif %}
             </form>
index 6d97946e7b42d5fe1f931ba4e2edac48441ddcb6..cb27a12bb8f2ec6b1d51e201923f63d743408f8a 100644 (file)
@@ -14,7 +14,8 @@ class NewPlaylistView(object):
             itemlist.append(MediaItem.objects.all().get(id=itemid))
         context = RequestContext(request, {
                 'selected_items_list': itemlist,
-                'existing_playlists': Playlist.objects.all().filter(author=request.user)})
+                'existing_playlists': Playlist.objects.all().filter(author=request.user),
+                'lastquerypath':request.POST.get('lastquerypath')})
         return HttpResponse(template_name.render(context))
 
     def addToPlaylist(self, request):
@@ -32,7 +33,8 @@ class NewPlaylistView(object):
             resource = PlaylistResource.objects.get_or_create(resource_type='item',public_id='4567891542',resource_id=item.id,playlist=selected_playlist)
 
         context = RequestContext(request, {
-                'existing_playlists': request.user.username})
+                'selected_items_list': itemlist,
+                'lastquerypath': request.POST.get('lastquerypath')})
         return HttpResponse(template_name.render(context))