diff --git a/SRC/app/Http/Controllers/ReferentController.php b/SRC/app/Http/Controllers/ReferentController.php index 7d827ce..e7937af 100755 --- a/SRC/app/Http/Controllers/ReferentController.php +++ b/SRC/app/Http/Controllers/ReferentController.php @@ -161,7 +161,13 @@ class ReferentController extends Controller { } public function addItemsToList() { - ; + + $idListeOeuvre = Session::get('listeoeuvre_current'); + $ListeOeuvre = ListeOeuvre::find($idListeOeuvre); + + $oeuvresToAdd = Input::get('oeuvres'); + $ListeOeuvre->oeuvres()->attach($oeuvresToAdd); + return Response::json(array()); } public function updateAssoGames() { diff --git a/SRC/public/js/ListeOeuvre.js b/SRC/public/js/ListeOeuvre.js index 398b6a6..70d65a4 100755 --- a/SRC/public/js/ListeOeuvre.js +++ b/SRC/public/js/ListeOeuvre.js @@ -123,6 +123,34 @@ $('#removeFromSelection').click(function() { +// Add to my favorites list +$('#addIntoMyList').click(function() { + + url = "addItemsToList"; + dataSend = { + _token : $('#_tokenRes').val(), + oeuvres : $('#my_researches').val()}; + $.post(url, + dataSend, + function( data ) { + ; + }, "json") + .done(function() { + $('#oeuvreRes').empty(); + }) + .fail(function() { + $("#oeuvreRes").append('