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

modifié :         SRC/app/Http/routes.php
	modifié :         SRC/public/js/getListeOeuvre.js
This commit is contained in:
sidya82 2015-02-19 17:35:57 +01:00
parent d92ce6372d
commit 2a18c47789
3 changed files with 10 additions and 7 deletions

View File

@ -31,8 +31,8 @@ class ReferentController extends Controller {
$me = User::current();
$user = User::all();
// $ListeOeuvre = ListeOeuvre::find(1);
// $ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
//$ListeOeuvre = ListeOeuvre::find(2);
//$ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
$listeoeuvres = ListeOeuvre::currentUser()->get();
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'listeoeuvres' => $listeoeuvres]);
@ -83,7 +83,7 @@ class ReferentController extends Controller {
public function showListeOeuvres($id)
{
return Response::json(ListeOeuvre::currentUser()->get()[0]->oeuvres->toArray());
return Response::json(ListeOeuvre::currentUser()->get()[1]->oeuvres->toArray());
}
public function deleteListeOeuvre()

View File

@ -39,6 +39,7 @@ Route::group(['middleware' => 'auth'], function ()
Route::post('deleteListeOeuvre', 'ReferentController@deleteListeOeuvre');
Route::post('addListeOeuvre', 'ReferentController@addListeOeuvre');
Route::get('showListOeuvres/{id}', 'ReferentController@showListeOeuvres');
Route::get('setListOeuvres', 'ReferentController@setListOeuvres');
});
Route::group(['middleware' => 'admin'], function ()

View File

@ -3,11 +3,13 @@ $(document).ready( function() {
$('.listeoeuvre').click(function() {
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
$.get(url, function( data ) {
if (data.length == 0 )
$("#oeuvrePic").append("Aucune Oeuvre");
data.forEach( function(el) {
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">')
.append('<a href="#" class="thumbnail">')
.append('<img width="50px" src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>')
.append('</a></div>');
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">'
+'<a href="#" class="thumbnail">'
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
+'</a></div>');
})
}, "json" )