Skip to content
Snippets Groups Projects
Commit ce8c074b authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'hotline#46111_fiche_bib_probleme_upload_image_nouvelle_en_front'...

Merge branch 'hotline#46111_fiche_bib_probleme_upload_image_nouvelle_en_front' into 'hotline-master'

hotline #46111 : library configuration: ajax form submit handles photo upload

See merge request !1751
parents 0fd5c9e8 19113e01
Branches
Tags
1 merge request!1797Master
- ticket #46111 : Modification de la fiche bibliothèque en front : correction de l'upload de l'image
\ No newline at end of file
......@@ -7,10 +7,10 @@
window.initializePopups = function() {
$('[data-popup="true"]')
.unbind('click').click(function(event){
event.preventDefault();
current_anchor=$(this);
addLoadingClass();
opacDialogFromUrl(addPath($(this).attr('href'),'/render/popup'));
event.preventDefault();
current_anchor=$(this);
addLoadingClass();
opacDialogFromUrl(addPath($(this).attr('href'),'/render/popup'));
});
}
......@@ -25,16 +25,19 @@
window.initializeAjaxFormSubmit = function(form) {
form.submit(function(event) {
formData = new FormData(form[0]);
updateAndDestroyCKEditor();
event.preventDefault();
$.ajax({
type: "POST",
url: form.attr('action'),
data: form.serialize(),
dataType: 'json',
success: function(data) {
opacDialogClose();
opacDialogFromData(data);
type: "POST",
contentType: false,
processData: false,
url: form.attr('action'),
data: formData,
dataType: 'json',
success: function(data) {
opacDialogClose();
opacDialogFromData(data);
}
});
});
......@@ -53,7 +56,7 @@
i.destroy();
}
}
function initModalSize(width, height) {
......@@ -62,7 +65,7 @@
var size = {'width' : width || common_width, 'height' : height || common_height };
return size;
}
var onOpen = function() {
initializePopups();
......@@ -94,10 +97,10 @@
var modal_size = initModalSize(width, height);
popupDialog = $('<iframe src="'+url+'" style="min-width:95%"></div>')
.dialog({width: modal_size['width'],
height: modal_size['height'],
close: returnFunc,
modal:true,
title: titleDialog});
height: modal_size['height'],
close: returnFunc,
modal:true,
title: titleDialog});
}
......@@ -109,9 +112,9 @@
window.opacShowModalConnection = function(data, returnFunc ,width ,height ) {
var modal_size = initModalSize(width, height);
opacShowModal(data['redirect'],
modal_size['width'] ,
modal_size['height'],
returnFunc);
modal_size['width'] ,
modal_size['height'],
returnFunc);
}
......@@ -130,8 +133,8 @@
var dialog_form = $('#opac-dialog form[data-onclose="submit"]');
if (dialog_form.length)
$.ajax({url: dialog_form.attr('action'),
type: 'post',
data: dialog_form.serialize()});
type: 'post',
data: dialog_form.serialize()});
$('#opac-dialog').dialog('close');
$('#opac-dialog').remove();
......@@ -151,18 +154,18 @@
if (data['show_modal'] && data['show_modal']=='true')
show_modal=true;
var position = (data['position'] != undefined) ?
data['position'] :
{ my: "center bottom",
at: "center center",
of: window };
var position = (data['position'] != undefined) ?
data['position'] :
{ my: "center bottom",
at: "center center",
of: window };
//pour que le dialogue soit en dessous de la notification
if ($("#info_message").size())
position = {my: "center bottom",
at: "center center",
of: "#info_message",
collision: "flip"};
position = {my: "center bottom",
at: "center center",
of: "#info_message",
collision: "flip"};
var titre = titre;
var modal = container.dialog({
width:modal_size['width'],
......@@ -176,7 +179,7 @@
return modal;
}
window.addLoadingClass = function () {
if (current_anchor == undefined)
return;
......@@ -196,12 +199,11 @@
var legend = fieldset.find('legend');
tabs.append('<li><a href="#tab'+index+'">'
+legend.text()
+'</a></li>');
+legend.text()
+'</a></li>');
legend.remove();
});
dialog_form.prepend(tabs).tabs();
}
})()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment