Sfoglia il codice sorgente

Evolution #790: playlist: aléatoire

Bastien Sevajol 11 anni fa
parent
commit
6213c2f621

+ 0 - 0
src/Muzich/CoreBundle/Factory/Elements/Sndsc.php Vedi File


+ 13 - 0
src/Muzich/CoreBundle/Resources/public/css/main.css Vedi File

@@ -2256,6 +2256,19 @@ a.button img
2256 2256
   float: left;
2257 2257
 }
2258 2258
 
2259
+a.button.simpleimg
2260
+{
2261
+  padding: 6px;
2262
+  
2263
+}
2264
+
2265
+a.button.simpleimg img
2266
+{
2267
+  float: none;
2268
+}
2269
+
2270
+
2271
+
2259 2272
 a.button span
2260 2273
 {
2261 2274
   float: left;

+ 5 - 0
src/Muzich/CoreBundle/lib/AutoplayManager.php Vedi File

@@ -60,4 +60,9 @@ class AutoplayManager
60 60
     return $list;
61 61
   }
62 62
   
63
+  public function shuffle()
64
+  {
65
+    shuffle($this->elements);
66
+  }
67
+  
63 68
 }

+ 4 - 1
src/Muzich/PlaylistBundle/Controller/ShowController.php Vedi File

@@ -40,7 +40,7 @@ class ShowController extends Controller
40 40
     ));
41 41
   }
42 42
   
43
-  public function getAutoplayDataAction($playlist_id, $offset = null)
43
+  public function getAutoplayDataAction($playlist_id, $offset = null, $shuffle = false)
44 44
   {
45 45
     if (($uncondition = $this->userHaveNonConditionToMakeAction(SecurityContext::ACTION_PLAYLIST_DATA_AUTOPLAY)) !== false)
46 46
       return $this->jsonResponseError($uncondition);
@@ -51,6 +51,9 @@ class ShowController extends Controller
51 51
     
52 52
     $autoplaym = new AutoplayManager($playlist_manager->getPlaylistElements($playlist, $offset), $this->container);
53 53
     
54
+    if ($shuffle)
55
+      $autoplaym->shuffle();
56
+    
54 57
     return $this->jsonResponse(array(
55 58
       'status'    => 'success',
56 59
       'data'      => $autoplaym->getList()

+ 7 - 1
src/Muzich/PlaylistBundle/Resources/config/routing.yml Vedi File

@@ -28,7 +28,13 @@ playlist_pick:
28 28
 
29 29
 playlist_datas_for_autoplay:
30 30
   pattern: /ajax/autoplay/playlist/datas/{playlist_id}/{offset}
31
-  defaults: { _controller: MuzichPlaylistBundle:Show:getAutoplayData, offset: null }
31
+  defaults: { _controller: MuzichPlaylistBundle:Show:getAutoplayData, offset: null, shuffle: false }
32
+  requirements:
33
+    offset:  \d+
34
+  
35
+playlist_datas_for_autoplay_shuffle:
36
+  pattern: /ajax/autoplay/playlist/datas/{playlist_id}/shuffle
37
+  defaults: { _controller: MuzichPlaylistBundle:Show:getAutoplayData, offset: null, shuffle: true }
32 38
 
33 39
 playlist_update_order:
34 40
   pattern: /ajax/playlist/order/update/{playlist_id}/{token}

+ 4 - 0
src/Muzich/PlaylistBundle/Resources/views/Show/show.html.twig Vedi File

@@ -11,6 +11,10 @@
11 11
       <a class="autoplay_playlist button darkbutton" href="{{ path('playlist_datas_for_autoplay', { 'playlist_id' : playlist.id }) }}" >
12 12
         {{ 'playlist.read'|trans({}, 'elements') }}
13 13
       </a>
14
+      
15
+      <a class="autoplay_playlist button simpleimg darkbutton" href="{{ path('playlist_datas_for_autoplay_shuffle', { 'playlist_id' : playlist.id}) }}" >
16
+        <img src="{{ asset('/img/1372889556_random_shuffle.png') }}" alt="shuffle" />
17
+      </a>
14 18
 
15 19
       {% if app.user %}
16 20
         {% if not playlist.owned(app.user) and viewed_user.id != app.user.id %}

BIN
web/img/1372889556_random_shuffle.png Vedi File


+ 0 - 0
web/img/Floor26_design.png Vedi File