소스 검색

Playlist: suppression

Sevajol Bastien 11 년 전
부모
커밋
36a7f6ff8d

+ 5 - 1
app/Resources/translations/flash.en.yml 파일 보기

@@ -44,4 +44,8 @@ user:
44 44
 presubscription:
45 45
   success:         An email has been sent for confirmation.
46 46
   error:           An error occured, please, try again.
47
-  confirmed:       Your email is registered, THANKS!
47
+  confirmed:       Your email is registered, THANKS!
48
+
49
+playlist:
50
+  delete:
51
+    success:       Playlist deleted

+ 5 - 1
app/Resources/translations/flash.fr.yml 파일 보기

@@ -44,4 +44,8 @@ user:
44 44
 presubscription:
45 45
   success:         Un email a été envoyé a votre adresse email pour confirmation (vérifiez aussi dans vos SPAM)
46 46
   error:           Une erreur est survenue, veuillez réessayer
47
-  confirmed:       Votre email a bien été pris en compte, merci !
47
+  confirmed:       Votre email a bien été pris en compte, merci !
48
+
49
+playlist:
50
+  delete:
51
+    success:       Playlist supprimée

+ 11 - 0
src/Muzich/PlaylistBundle/Controller/EditController.php 파일 보기

@@ -66,4 +66,15 @@ class EditController extends Controller
66 66
     );
67 67
   }
68 68
   
69
+  public function deleteAction($playlist_id)
70
+  {
71
+    if (!($playlist = $this->getPlaylistManager()->findOwnedPlaylistWithId($playlist_id, $this->getUser())))
72
+      throw $this->createNotFoundException();
73
+    
74
+    $this->remove($playlist);
75
+    $this->flush();
76
+    $this->setFlash('success', 'playlist.delete.success');
77
+    return $this->redirect($this->generateUrl('playlists_user', array('user_slug' => $this->getUser()->getSlug())));
78
+  }
79
+  
69 80
 }

+ 4 - 0
src/Muzich/PlaylistBundle/Resources/config/routing.yml 파일 보기

@@ -6,6 +6,10 @@ playlist:
6 6
   pattern: /user/{user_slug}/playlist/{playlist_id}
7 7
   defaults: { _controller: MuzichPlaylistBundle:Show:show }
8 8
 
9
+playlist_delete:
10
+  pattern: /playlist/delete/{playlist_id}
11
+  defaults: { _controller: MuzichPlaylistBundle:Edit:delete }
12
+
9 13
 playlist_datas_for_autoplay:
10 14
   pattern: /ajax/autoplay/playlist/datas/{playlist_id}/{offset}
11 15
   defaults: { _controller: MuzichPlaylistBundle:Show:getAutoplayData, offset: null }

+ 4 - 0
src/Muzich/PlaylistBundle/Resources/views/Show/user.html.twig 파일 보기

@@ -18,6 +18,10 @@
18 18
           {{ playlist.name }}
19 19
         </a>
20 20
         
21
+        <a class="" href="{{ path('playlist_delete', { 'playlist_id' : playlist.id }) }}" >
22
+          X
23
+        </a>
24
+        
21 25
         {% include "MuzichCoreBundle:Tag:tag_cloud.html.twig" with {
22 26
           'tags' : playlist.tags
23 27
         } %}