modified: SRC/app/Http/Controllers/ReferentController.php
modified: SRC/app/Http/routes.php modified: SRC/public/js/ListeOeuvre.js modified: SRC/resources/views/referent.blade.php
This commit is contained in:
parent
85440932a6
commit
880652df04
@ -168,33 +168,15 @@ class ReferentController extends Controller {
|
|||||||
$ListeOeuvre->jeux()->sync($table);
|
$ListeOeuvre->jeux()->sync($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAssoGames($id) {
|
||||||
|
|
||||||
|
$ListeOeuvre = ListeOeuvre::find($id);
|
||||||
|
return Response::json($ListeOeuvre->jeux()->get()->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
public function getImage($filename) {
|
public function getImage($filename) {
|
||||||
|
|
||||||
// Append the filename to the path where our images are located
|
// TODO
|
||||||
$path = Config::get('view.images') . $filename;
|
|
||||||
print($path);
|
|
||||||
|
|
||||||
// Initialize an instance of Symfony's File class.
|
|
||||||
// This is a dependency of Laravel so it is readily available.
|
|
||||||
$file = new Symfony\Component\HttpFoundation\File\File($path);
|
|
||||||
|
|
||||||
// Make a new response out of the contents of the file
|
|
||||||
// Set the response status code to 200 OK
|
|
||||||
$response = Response::make(
|
|
||||||
File::get($path),
|
|
||||||
200
|
|
||||||
);
|
|
||||||
|
|
||||||
// Modify our output's header.
|
|
||||||
// Set the content type to the mime of the file.
|
|
||||||
// In the case of a .jpeg this would be image/jpeg
|
|
||||||
$response->header(
|
|
||||||
'Content-type',
|
|
||||||
$file->getMimeType()
|
|
||||||
);
|
|
||||||
|
|
||||||
// We return our image here.
|
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ Route::group(['middleware' => 'auth'], function ()
|
|||||||
Route::post('search', 'ReferentController@search');
|
Route::post('search', 'ReferentController@search');
|
||||||
Route::post('addItemsToList', 'ReferentController@addItemsToList');
|
Route::post('addItemsToList', 'ReferentController@addItemsToList');
|
||||||
Route::post('updateAssoGames', 'ReferentController@updateAssoGames');
|
Route::post('updateAssoGames', 'ReferentController@updateAssoGames');
|
||||||
|
Route::get('getAssoGames/{id}', 'ReferentController@getAssoGames');
|
||||||
Route::get('showPic/{file}', 'ReferentController@getImage');
|
Route::get('showPic/{file}', 'ReferentController@getImage');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,8 +22,25 @@ $('.listeoeuvre').click(function(event) {
|
|||||||
$('.listeoeuvre').removeClass("active");
|
$('.listeoeuvre').removeClass("active");
|
||||||
$(this).addClass("active");
|
$(this).addClass("active");
|
||||||
$('#oeuvrePic').empty();
|
$('#oeuvrePic').empty();
|
||||||
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
|
|
||||||
|
|
||||||
|
// asso games
|
||||||
|
url = "/getAssoGames/" + $(this).children('.idListeOeuvre').val();
|
||||||
|
var p = new XMLHttpRequest();
|
||||||
|
p.open("GET", url, true);
|
||||||
|
p.onreadystatechange = function () {
|
||||||
|
if (p.readyState != 4 || p.status != 200)
|
||||||
|
return;
|
||||||
|
var data2 = JSON.parse(p.response);
|
||||||
|
$( ".checkboxGame" ).prop( "checked", false);
|
||||||
|
|
||||||
|
for (el in data2) {
|
||||||
|
id = data2[el].id;
|
||||||
|
$('#checkbox' + id).prop( "checked", true );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
p.send();
|
||||||
|
|
||||||
|
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
|
||||||
var r = new XMLHttpRequest();
|
var r = new XMLHttpRequest();
|
||||||
r.open("GET", url, true);
|
r.open("GET", url, true);
|
||||||
r.onreadystatechange = function () {
|
r.onreadystatechange = function () {
|
||||||
@ -42,7 +59,6 @@ $('.listeoeuvre').click(function(event) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
r.send();
|
r.send();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -152,7 +168,7 @@ $('.checkbox').click(function(event) {
|
|||||||
return $(this).val();
|
return $(this).val();
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
var searchValues = $("input#checkbox").map(function(){
|
var searchValues = $(".checkboxGame").map(function(){
|
||||||
return $(this).is(":checked");
|
return $(this).is(":checked");
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@
|
|||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<input type="hidden" name="idGame" id="idGame" value="{{ $game->id }}">
|
<input type="hidden" name="idGame" id="idGame" value="{{ $game->id }}">
|
||||||
<label class="ios7-switch">
|
<label class="ios7-switch">
|
||||||
<input id="checkbox" type="checkbox">
|
<input id="checkbox{{$game->id}}" class="checkboxGame" type="checkbox">
|
||||||
<span></span>
|
<span></span>
|
||||||
{{ $game->nom }}
|
{{ $game->nom }}
|
||||||
</label>
|
</label>
|
||||||
|
Reference in New Issue
Block a user