From a2d2962d7a7018216391d85a91671f8971237f2b Mon Sep 17 00:00:00 2001 From: Thomas Baccelli Date: Sat, 9 Apr 2016 20:21:07 +0200 Subject: [PATCH] fix #173 --- app/Controller/AppController.php | 8 +++++++- app/View/Layouts/ajax.ctp | 3 ++- app/View/PlaylistMemberships/add.ctp | 5 ++++- app/webroot/js/navigation.js | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 8f9ec2f..3ce4679 100644 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -42,7 +42,13 @@ class AppController extends Controller { 'httpOnly' => true ), 'Security' => array( - 'csrfExpires' => '+1 hour' + 'csrfExpires' => '+1 hour', + 'unlockedFields' => array( // dynamically added/changed fields + 'Playlist.id', + 'song', + 'album', + 'band' + ) ), 'DebugKit.Toolbar', 'Image', diff --git a/app/View/Layouts/ajax.ctp b/app/View/Layouts/ajax.ctp index d06197a..ba6b6cc 100644 --- a/app/View/Layouts/ajax.ctp +++ b/app/View/Layouts/ajax.ctp @@ -26,5 +26,6 @@ }, { "flash": Flash->render()); ?>, - "html": fetch('content')); ?> + "html": fetch('content')); ?>, + "playlist_form": fetch('playlist_form'));?> }] diff --git a/app/View/PlaylistMemberships/add.ctp b/app/View/PlaylistMemberships/add.ctp index 64ed7b4..222c13b 100644 --- a/app/View/PlaylistMemberships/add.ctp +++ b/app/View/PlaylistMemberships/add.ctp @@ -13,4 +13,7 @@ $(function() { }); }); -end(); ?> \ No newline at end of file +end(); ?> +start('playlist_form');?> +element('add_to_playlist');?> +end();?> \ No newline at end of file diff --git a/app/webroot/js/navigation.js b/app/webroot/js/navigation.js index c2ddbf1..f236b95 100644 --- a/app/webroot/js/navigation.js +++ b/app/webroot/js/navigation.js @@ -48,6 +48,10 @@ $(function(){ }else{ history.replaceState({url: response[1].url}, null, referrer); response[1].url = referrer; + if(response[2].playlist_form.length){ + var nodes = $(response[2].playlist_form); + $("#add-to").html($(nodes[nodes.length-1]).html()); + } } referrer = response[1].url; $('body script').remove();