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

modifié :         SRC/public/js/getListeOeuvre.js
This commit is contained in:
sidya82 2015-02-19 16:50:36 +01:00
parent 94a2348737
commit d41fdb2815
2 changed files with 15 additions and 13 deletions

View File

@ -5,6 +5,7 @@ use Input;
use Request; use Request;
use App\ListeOeuvre; use App\ListeOeuvre;
use App\AssoListeAOeuvre; use App\AssoListeAOeuvre;
use Response;
class ReferentController extends Controller { class ReferentController extends Controller {
@ -82,7 +83,7 @@ class ReferentController extends Controller {
public function showListeOeuvres($id) public function showListeOeuvres($id)
{ {
return $listeoeuvres = ListeOeuvre::currentUser()->get()[0]->oeuvres()->toJson(); return Response::json(ListeOeuvre::currentUser()->get()[0]->oeuvres->toArray());
} }
public function deleteListeOeuvre() public function deleteListeOeuvre()

View File

@ -1,19 +1,20 @@
$(document).ready( function() { $(document).ready( function() {
console.log( "document loaded" );
$( '.listeoeuvre' ).click(function(this) { $('.listeoeuvre').click(function() {
id = $(this).$('.idListeOeuvre').val(); url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
$.get("showListOeuvres/"+id, function( data ) { $.get(url, function( data ) {
data.forEach( function(el) { data.forEach( function(el) {
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">') $("#oeuvrePic").append('<div class="col-xs-4 col-md-3">')
.append('<div class="col-xs-4 col-md-3">') .append('<div class="col-xs-4 col-md-3">')
.append('<a href="#" class="thumbnail">') .append('<a href="#" class="thumbnail">')
.append('<img src="http://www.augustins.org/documents/10180/156407/').append(el.urlPhoto).append('">') .append('<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '">')
.append('</a></div>'); .append('</a></div>');
}) })
}, "json" )
.fail(function() {
console.log( "error" );
});
});
}); });
//prevent the form from actually submitting in browser
return false;
} );
} );