[-] FO : fixed bug #PSCFV-2760 - live edit close confirm
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16020 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+32
-14
@@ -1,3 +1,4 @@
|
|||||||
|
var has_been_moved = false;
|
||||||
var modules_list = new Array();
|
var modules_list = new Array();
|
||||||
var hooks_list = new Array();
|
var hooks_list = new Array();
|
||||||
var hookable_list = new Array();
|
var hookable_list = new Array();
|
||||||
@@ -33,28 +34,38 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
// populate
|
// populate
|
||||||
getHookableList();
|
getHookableList();
|
||||||
$('.unregisterHook').unbind('click').click(function() {
|
$('.unregisterHook').unbind('click').click(function()
|
||||||
|
{
|
||||||
id = $(this).attr('id');
|
id = $(this).attr('id');
|
||||||
$(this).parent().parent().parent().fadeOut('slow', function() {
|
$(this).parent().parent().parent().fadeOut('slow', function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('#cancelMove').unbind('click').click(function() {
|
$('#cancelMove').unbind('click').click(function()
|
||||||
|
{
|
||||||
$('#' + cancelMove + '').sortable('cancel');
|
$('#' + cancelMove + '').sortable('cancel');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('#saveLiveEdit').unbind('click').click(function() {
|
$('#saveLiveEdit').unbind('click').click(function()
|
||||||
|
{
|
||||||
saveModulePosition();
|
saveModulePosition();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('#closeLiveEdit').unbind('click').click(function() {
|
$('#closeLiveEdit').unbind('click').click(function()
|
||||||
$("#live_edit_feedback_str").html('<div style="padding:10px;"><p style="margin-bottom:10px;">' + confirmClose + '</p><p style="height:1.6em;display:block"><a style="margin:auto;float:left" class="button" href="#" onclick="closeLiveEdit();">' + confirm + '</a><a style="margin:auto;float:right;" class="button" href="#" onclick="closeFancybox();">' + cancel + '</a></p></div>');
|
{
|
||||||
$("#fancy").attr('href', '#live_edit_feedback');
|
if (!has_been_moved)
|
||||||
$("#fancy").trigger("click");
|
closeLiveEdit();
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
$("#live_edit_feedback_str").html('<div style="padding:10px;"><p style="margin-bottom:10px;">' + confirmClose + '</p><p style="height:1.6em;display:block"><a style="margin:auto;float:left" class="button" href="#" onclick="closeLiveEdit();">' + confirm + '</a><a style="margin:auto;float:right;" class="button" href="#" onclick="closeFancybox();">' + cancel + '</a></p></div>');
|
||||||
|
$("#fancy").attr('href', '#live_edit_feedback');
|
||||||
|
$("#fancy").trigger("click");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
$('.add_module_live_edit').unbind('click').click(function() {
|
$('.add_module_live_edit').unbind('click').click(function()
|
||||||
|
{
|
||||||
$("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>');
|
$("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>');
|
||||||
$("#fancy").attr('href', '#live_edit_feedback');
|
$("#fancy").attr('href', '#live_edit_feedback');
|
||||||
$("#fancy").trigger("click");
|
$("#fancy").trigger("click");
|
||||||
@@ -75,6 +86,7 @@ $(document).ready(function() {
|
|||||||
if (new_target_id == '') {
|
if (new_target_id == '') {
|
||||||
new_target_id = event.target.id;
|
new_target_id = event.target.id;
|
||||||
}
|
}
|
||||||
|
has_been_moved = true;
|
||||||
},
|
},
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
new_target_id = ui.item[0].parentNode.id;
|
new_target_id = ui.item[0].parentNode.id;
|
||||||
@@ -179,7 +191,8 @@ function getHookableModuleList(hook) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function saveModulePosition() {
|
function saveModulePosition()
|
||||||
|
{
|
||||||
$("input.dynamic-input-save-position").remove();
|
$("input.dynamic-input-save-position").remove();
|
||||||
$("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>');
|
$("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>');
|
||||||
$("#fancy").attr('href', '#live_edit_feedback');
|
$("#fancy").attr('href', '#live_edit_feedback');
|
||||||
@@ -207,6 +220,7 @@ function saveModulePosition() {
|
|||||||
success: function(jsonData) {
|
success: function(jsonData) {
|
||||||
$('#live_edit_feedback_str').html('<div class="live_edit_feed_back_ok"><img src="img/admin/ok2.png"><h3>' + saveOK + '</h3><a style="margin:auto" class="exclusive" href="#" onclick="closeFancybox();">' + close + '</a></div>');
|
$('#live_edit_feedback_str').html('<div class="live_edit_feed_back_ok"><img src="img/admin/ok2.png"><h3>' + saveOK + '</h3><a style="margin:auto" class="exclusive" href="#" onclick="closeFancybox();">' + close + '</a></div>');
|
||||||
timer = setTimeout("hideFeedback()", 3000);
|
timer = setTimeout("hideFeedback()", 3000);
|
||||||
|
has_been_moved = false;
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
$('#live_edit_feedback_str').html('<div class="live_edit_feed_back_ko"><img src="img/admin/error.png"><h3>TECHNICAL ERROR:</h3>' + unableToSaveModulePosition + '<br><br><a style="margin:auto" class="button" href="#" onclick="closeFancybox();">' + close + '</a></div>');
|
$('#live_edit_feedback_str').html('<div class="live_edit_feed_back_ko"><img src="img/admin/error.png"><h3>TECHNICAL ERROR:</h3>' + unableToSaveModulePosition + '<br><br><a style="margin:auto" class="button" href="#" onclick="closeFancybox();">' + close + '</a></div>');
|
||||||
@@ -216,22 +230,26 @@ function saveModulePosition() {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function closeFancybox() {
|
function closeFancybox()
|
||||||
|
{
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
$.fancybox.close();
|
$.fancybox.close();
|
||||||
$('#live_edit_feedback_str').html('');
|
$('#live_edit_feedback_str').html('');
|
||||||
}
|
}
|
||||||
function closeLiveEdit(){
|
function closeLiveEdit()
|
||||||
|
{
|
||||||
window.location.href = window.location.protocol+'//'+window.location.host+window.location.pathname;
|
window.location.href = window.location.protocol+'//'+window.location.host+window.location.pathname;
|
||||||
}
|
}
|
||||||
function hideFeedback() {
|
function hideFeedback()
|
||||||
|
{
|
||||||
$('#live_edit_feed_back').fadeOut('slow', function() {
|
$('#live_edit_feed_back').fadeOut('slow', function() {
|
||||||
$.fancybox.close();
|
$.fancybox.close();
|
||||||
$('#live_edit_feedback_str').html('');
|
$('#live_edit_feedback_str').html('');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function get(name) {
|
function get(name)
|
||||||
|
{
|
||||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||||
var regex = new RegExp(regexS);
|
var regex = new RegExp(regexS);
|
||||||
var results = regex.exec(window.location.href);
|
var results = regex.exec(window.location.href);
|
||||||
|
|||||||
Reference in New Issue
Block a user