// improve JS (select/unselect all)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9130 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vChabot committed 2011-10-07 12:29:51 +00:00
1 parent 0e494ed7db
commit 6749d55e54
1 file changed
+8 -2
+8 -2
View File
@@ -229,27 +229,33 @@ class AdminGroups extends AdminTab
$(this).attr("selected", "selected"); $(this).attr("selected", "selected");
}); });
}); });
select1 = true;
select2 = true;
$(\'#selectAll1\').click(function() { $(\'#selectAll1\').click(function() {
if ($(\'#selectRestrictions1 option:selected\').size() != $(\'#selectRestrictions1 option\').size()) if (select1)
{ {
select2 = false;
$(\'#selectRestrictions1 option\').attr(\'selected\', \'selected\'); $(\'#selectRestrictions1 option\').attr(\'selected\', \'selected\');
$(this).text(\''.$this->l('Unselect All', get_class($this), false, false).'\'); $(this).text(\''.$this->l('Unselect All', get_class($this), false, false).'\');
} }
else else
{ {
select2 = true;
$(\'#selectRestrictions1 option\').removeAttr(\'selected\'); $(\'#selectRestrictions1 option\').removeAttr(\'selected\');
$(this).text(\''.$this->l('Select All', get_class($this), false, false).'\'); $(this).text(\''.$this->l('Select All', get_class($this), false, false).'\');
} }
return false; return false;
}); });
$(\'#selectAll2\').click(function() { $(\'#selectAll2\').click(function() {
if ($(\'#selectRestrictions2 option:selected\').size() != $(\'#selectRestrictions2 option\').size()) if (select2)
{ {
select2 = false;
$(\'#selectRestrictions2 option\').attr(\'selected\', \'selected\'); $(\'#selectRestrictions2 option\').attr(\'selected\', \'selected\');
$(this).text(\''.$this->l('Unselect All', get_class($this), false, false).'\'); $(this).text(\''.$this->l('Unselect All', get_class($this), false, false).'\');
} }
else else
{ {
select2 = true;
$(\'#selectRestrictions2 option\').removeAttr(\'selected\'); $(\'#selectRestrictions2 option\').removeAttr(\'selected\');
$(this).text(\''.$this->l('Select All', get_class($this), false, false).'\'); $(this).text(\''.$this->l('Select All', get_class($this), false, false).'\');
} }