modified: SRC/public/js/ListeOeuvre.js

This commit is contained in:
Malibu 2015-03-04 22:43:27 +01:00
parent 652d5dba9a
commit 84dcddb48d
1 changed files with 8 additions and 5 deletions

View File

@ -53,7 +53,7 @@ $('.listeoeuvre').click(function(event) {
$("#oeuvrePic").append('<select multiple="multiple" id="my_selection" name="my_selection" class="image-picker show-html">'); $("#oeuvrePic").append('<select multiple="multiple" id="my_selection" name="my_selection" class="image-picker show-html">');
for (el in data) for (el in data)
{ {
$('#my_selection').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + data[el].urlPhoto + '" value="'+ data[el].id + '"></option>'); $('#my_selection').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + data[el].urlPhoto + '" id="selection'+ data[el].id +'" value="'+ data[el].id + '"></option>');
$("select").imagepicker(); $("select").imagepicker();
} }
} }
@ -67,7 +67,7 @@ $('.listeoeuvre').click(function(event) {
$('#enregistrer').click(function() { $('#enregistrer').click(function() {
url = "setListOeuvres"; url = "setListOeuvres";
dataSend = { dataSend = {
_token : $('#_token').val(), _token : $('#_tokenRes').val(),
idListeOeuvre : "1", idListeOeuvre : "1",
oeuvres : "1-2-3-4"}; oeuvres : "1-2-3-4"};
$.post(url, $.post(url,
@ -98,15 +98,18 @@ $('#removeFromSelection').click(function() {
url = "removeFromSelection"; url = "removeFromSelection";
dataSend = { dataSend = {
_token : $('#_tokenRemoveFromSelection').val(), _token : $('#_tokenRemoveFromSelection').val(),
oeuvres : $('#my_selection').val()}; oeuvres : $('#my_selection').val()};
$.post(url, $.post(url,
dataSend, dataSend,
function( data ) { function( data ) {
; ;
}, "json") }, "json")
.done(function() { .done(function() {
; $('#my_selection').val().forEach( function(el) {
$('#selection'+ el).remove();
});
$("select").imagepicker();
}) })
.fail(function() { .fail(function() {
$("#oeuvrePic").append('<div class="alert alert-danger">' $("#oeuvrePic").append('<div class="alert alert-danger">'