[-] 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:
vAugagneur
2012-06-14 13:19:23 +00:00
parent 40fb308337
commit 7b35975139
+32 -14
View File
@@ -1,3 +1,4 @@
var has_been_moved = false;
var modules_list = new Array();
var hooks_list = new Array();
var hookable_list = new Array();
@@ -33,28 +34,38 @@ $(document).ready(function() {
});
// populate
getHookableList();
$('.unregisterHook').unbind('click').click(function() {
$('.unregisterHook').unbind('click').click(function()
{
id = $(this).attr('id');
$(this).parent().parent().parent().fadeOut('slow', function() {
$(this).remove();
});
return false;
});
$('#cancelMove').unbind('click').click(function() {
$('#cancelMove').unbind('click').click(function()
{
$('#' + cancelMove + '').sortable('cancel');
return false;
});
$('#saveLiveEdit').unbind('click').click(function() {
$('#saveLiveEdit').unbind('click').click(function()
{
saveModulePosition();
return false;
});
$('#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');
$("#fancy").trigger("click");
return false;
$('#closeLiveEdit').unbind('click').click(function()
{
if (!has_been_moved)
closeLiveEdit();
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>');
$("#fancy").attr('href', '#live_edit_feedback');
$("#fancy").trigger("click");
@@ -75,6 +86,7 @@ $(document).ready(function() {
if (new_target_id == '') {
new_target_id = event.target.id;
}
has_been_moved = true;
},
start: function(event, ui) {
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();
$("#live_edit_feedback_str").html('<div style="padding:10px"><img src="img/loadingAnimation.gif"></div>');
$("#fancy").attr('href', '#live_edit_feedback');
@@ -207,6 +220,7 @@ function saveModulePosition() {
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>');
timer = setTimeout("hideFeedback()", 3000);
has_been_moved = false;
},
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>');
@@ -216,22 +230,26 @@ function saveModulePosition() {
return true;
}
function closeFancybox() {
function closeFancybox()
{
clearTimeout(timer);
$.fancybox.close();
$('#live_edit_feedback_str').html('');
}
function closeLiveEdit(){
function closeLiveEdit()
{
window.location.href = window.location.protocol+'//'+window.location.host+window.location.pathname;
}
function hideFeedback() {
function hideFeedback()
{
$('#live_edit_feed_back').fadeOut('slow', function() {
$.fancybox.close();
$('#live_edit_feedback_str').html('');
});
};
function get(name) {
function get(name)
{
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);