[-] BO : fix #PSTEST-1176 - Modules positions drag and drop - ajax process is broken, page JS too
This commit is contained in:
1 parent
92464e3546
commit
69bd98928e
3 files changed
+23
-23
No files matched your search
@@ -1309,6 +1309,7 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
if (!isset($k) || !isset($res[$k]) || !isset($res[$k + 1]))
|
if (!isset($k) || !isset($res[$k]) || !isset($res[$k + 1]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$from = $res[$k];
|
$from = $res[$k];
|
||||||
$to = $res[$k + 1];
|
$to = $res[$k + 1];
|
||||||
|
|
||||||
@@ -1329,6 +1330,7 @@ abstract class ModuleCore
|
|||||||
if (!Db::getInstance()->execute($sql))
|
if (!Db::getInstance()->execute($sql))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ class AdminModulesPositionsControllerCore extends AdminController
|
|||||||
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
public function initContent()
|
||||||
|
|||||||
+19
-23
@@ -135,16 +135,13 @@ function initTableDnD(table)
|
|||||||
url: currentIndex + '&token=' + token + '&' + $.tableDnD.serialize(),
|
url: currentIndex + '&token=' + token + '&' + $.tableDnD.serialize(),
|
||||||
data: params,
|
data: params,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
var nodrag_lines = $(tableDrag).find('tr:not(".nodrag")');
|
||||||
|
|
||||||
if (come_from == 'AdminModulesPositions')
|
if (come_from == 'AdminModulesPositions')
|
||||||
{
|
{
|
||||||
tableDrag.find('tr').removeClass('alt_row');
|
nodrag_lines.each(function(i) {
|
||||||
tableDrag.find('tr' + reOrder).addClass('alt_row');
|
$(this).find('.positions').html(i+1);
|
||||||
tableDrag.find('td.positions').each(function(i) {
|
});
|
||||||
$(this).html(i+1);
|
|
||||||
});
|
|
||||||
tableDrag.find('td.dragHandle a:hidden').show();
|
|
||||||
tableDrag.find('td.dragHandle:first a:even').hide();
|
|
||||||
tableDrag.find('td.dragHandle:last a:odd').hide();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -158,29 +155,28 @@ function initTableDnD(table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var up_reg = new RegExp('position=[-]?[0-9]+&');
|
var up_reg = new RegExp('position=[-]?[0-9]+&');
|
||||||
$(tableDrag).children('tbody').children('tr').each(function(i) {
|
nodrag_lines.each(function(i) {
|
||||||
$(this).attr('id', $(this).attr('id').replace(reg, '_' + i));
|
$(this).attr('id', $(this).attr('id').replace(reg, '_' + i));
|
||||||
// Update link position
|
// Update link position
|
||||||
// Up links
|
// Up links
|
||||||
$(this).children('td.dragHandle a:odd').attr('href', $(this).children('td.dragHandle a:odd').attr('href').replace(up_reg, 'position='+ (i - 1) +'&'));
|
$(this).children('td.dragHandle a:odd').attr('href', $(this).children('td.dragHandle a:odd').attr('href').replace(up_reg, 'position='+ (i - 1) +'&'));
|
||||||
|
|
||||||
// Down links
|
// Down links
|
||||||
$(this).children('td.dragHandle a:even').attr('href', $(this).children('td.dragHandle a:even').attr('href').replace(up_reg, 'position='+ (i + 1) +'&'));
|
$(this).children('td.dragHandle a:even').attr('href', $(this).children('td.dragHandle a:even').attr('href').replace(up_reg, 'position='+ (i + 1) +'&'));
|
||||||
|
|
||||||
});
|
});
|
||||||
$(tableDrag).children('tbody').children('tr').not('.nodrag').removeClass('alt_row').removeClass('not_alt_row');
|
}
|
||||||
$(tableDrag).children('tbody').children('tr:not(".nodrag"):odd').addClass('alt_row');
|
|
||||||
$(tableDrag).children('tbody').children('tr:not(".nodrag"):even').addClass('not_alt_row');
|
|
||||||
$(tableDrag).children('tbody').children('tr').children('td.dragHandle').children('a:hidden').show();
|
|
||||||
|
|
||||||
if (alternate) {
|
nodrag_lines.removeClass('alt_row').removeClass('not_alt_row');
|
||||||
$(tableDrag).children('tbody').children('tr').children('td.dragHandle:first').children('a:odd').hide();
|
nodrag_lines.filter(':odd').addClass('alt_row');
|
||||||
$(tableDrag).children('tbody').children('tr').children('td.dragHandle:last').children('a:even').hide();
|
nodrag_lines.filter(':even').addClass('not_alt_row');
|
||||||
}
|
nodrag_lines.children('td.dragHandle').children('a:hidden').show();
|
||||||
else {
|
|
||||||
$(tableDrag).children('tbody').children('tr').children('td.dragHandle:first').children('a:even').hide();
|
if (typeof alternate !== 'undefined' && alternate) {
|
||||||
$(tableDrag).children('tbody').children('tr').children('td.dragHandle:last').children('a:odd').hide();
|
nodrag_lines.children('td.dragHandle:first').children('a:odd').hide();
|
||||||
}
|
nodrag_lines.children('td.dragHandle:last').children('a:even').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nodrag_lines.children('td.dragHandle:first').children('a:even').hide();
|
||||||
|
nodrag_lines.children('td.dragHandle:last').children('a:odd').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user