modifié : SRC/app/Http/Controllers/ReferentController.php

modifié :         SRC/public/js/ListeOeuvre.js
	modifié :         SRC/resources/views/referent.blade.php
This commit is contained in:
sidya82 2015-02-19 19:20:13 +01:00
parent 4fac5f8726
commit 1ecdc1b3ff
3 changed files with 10 additions and 7 deletions

View File

@ -97,14 +97,15 @@ class ReferentController extends Controller {
public function setListOeuvres () public function setListOeuvres ()
{ {
$idListeOeuvre = Input::get('idListeOeuvre'); $idListeOeuvre = Input::get('idListeOeuvre');
$idconcats = Input::get('oeuvres'); $idconcats = Input::get('oeuvres');
$list_oeuvres_id = explode("-", $idconcats); $list_oeuvres_id = explode("-", $idconcats);
$ListeOeuvre = ListeOeuvre::find($idListeOeuvre); $ListeOeuvre = ListeOeuvre::find($idListeOeuvre);
$ListeOeuvre->oeuvres()->detach(); $ListeOeuvre->oeuvres()->detach();
$ListeOeuvre->oeuvres()->attach($list_oeuvres_id); $ListeOeuvre->oeuvres()->attach($list_oeuvres_id);
return Response::json(array('sucess' => 'true', )); return Response::json(array());
} }
} }

View File

@ -28,16 +28,18 @@ $('.listeoeuvre').click(function() {
//Enregistrement d'une liste d'ouevre //Enregistrement d'une liste d'ouevre
$('#enregistrer').click(function() { $('#enregistrer').click(function() {
url = "/setListOeuvres/" + $(this).children('.idListeOeuvre').val(); url = "setListOeuvres";
dataSend = { idListeOeuvre : 1, dataSend = {
_token : $('#_token').val(),
idListeOeuvre : "1",
oeuvres : "1-2-3-4"}; oeuvres : "1-2-3-4"};
$.post(url, $.post(url,
dataSend, dataSend,
function( data ) { function( data ) {
; ;
}) }, "json")
.done(function() { .done(function() {
$("#oeuvrePic").append('<div class="alert alert-sucess">' $("#oeuvrePic").append('<div class="alert alert-success">'
+'<ul>' +'<ul>'
+'<li>Sauvegarde validée</li>' +'<li>Sauvegarde validée</li>'
+'</ul>' +'</ul>'

View File

@ -24,7 +24,7 @@
<form method="POST" role="form" action="deleteListeOeuvre"> <form method="POST" role="form" action="deleteListeOeuvre">
<input type="hidden" name="idUser" value="{{ $me->id }}"> <input type="hidden" name="idUser" value="{{ $me->id }}">
<input type="hidden" class="idListeOeuvre" name="idListeOeuvre" value="{{ $listeoeuvre->id }}"> <input type="hidden" class="idListeOeuvre" name="idListeOeuvre" value="{{ $listeoeuvre->id }}">
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" /> <input type="hidden" name="_token" id="_token" value="{{{ csrf_token() }}}" />
<td>{{$listeoeuvre->nom}}</td> <td>{{$listeoeuvre->nom}}</td>
<td><button type="submit" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td> <td><button type="submit" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr> </tr>