modified: SRC/public/js/ListeOeuvre.js
This commit is contained in:
parent
84dcddb48d
commit
91089b72f7
@ -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 + '" id="selection'+ data[el].id +'" value="'+ data[el].id + '"></option>');
|
$('#my_selection').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + data[el].urlPhoto + '" class="option_selected" id="selection'+ data[el].id +'" value="'+ data[el].id + '"></option>');
|
||||||
$("select").imagepicker();
|
$("select").imagepicker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,6 +127,11 @@ $('#removeFromSelection').click(function() {
|
|||||||
$('#search_button, #previous, #next').click(function(event) {
|
$('#search_button, #previous, #next').click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Disable oeuvres already taken
|
||||||
|
alreadySelected = $('.option_selected').map(function(){
|
||||||
|
return parseInt($(this).val());
|
||||||
|
}).get();
|
||||||
|
|
||||||
if(this.id == $('#next').attr('id') && $("#next").parent().hasClass('disabled') || this.id == $('#previous').attr('id') && $("#previous").parent().hasClass('disabled'))
|
if(this.id == $('#next').attr('id') && $("#next").parent().hasClass('disabled') || this.id == $('#previous').attr('id') && $("#previous").parent().hasClass('disabled'))
|
||||||
return 0;
|
return 0;
|
||||||
if (this.id == $('#next').attr('id')) {
|
if (this.id == $('#next').attr('id')) {
|
||||||
@ -159,7 +164,12 @@ $('#search_button, #previous, #next').click(function(event) {
|
|||||||
else {
|
else {
|
||||||
$("#oeuvreRes").append('<select multiple="multiple" id="my_researches" class="image-picker show-html">');
|
$("#oeuvreRes").append('<select multiple="multiple" id="my_researches" class="image-picker show-html">');
|
||||||
data.data.forEach( function(el) {
|
data.data.forEach( function(el) {
|
||||||
$('#my_researches').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '" value="'+ el.id + '"></option>');
|
|
||||||
|
if($.inArray(el.id, alreadySelected) != -1){
|
||||||
|
$('#my_researches').append('<option disabled="disabled" data-img-src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '" value="'+ el.id + '"></option>');
|
||||||
|
} else {
|
||||||
|
$('#my_researches').append('<option data-img-src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '" value="'+ el.id + '"></option>');
|
||||||
|
}
|
||||||
$("select").imagepicker();
|
$("select").imagepicker();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user