summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-28 11:59:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-28 11:59:45 +0000
commit4c2264ee42eceeedc4787b9f3736b0bd19880d7a (patch)
tree0a1fe517dbb60ba2cf800f48c5cb8b655232d1d7 /public
parent66540afc08209939dd4b9a6d9969b99a6ffecfc9 (diff)
downloadredmine-4c2264ee42eceeedc4787b9f3736b0bd19880d7a.tar.gz
redmine-4c2264ee42eceeedc4787b9f3736b0bd19880d7a.zip
Adds 2 buttons to easily reorder selected columns (#4272).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3106 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/select_list_move.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/public/javascripts/select_list_move.js b/public/javascripts/select_list_move.js
index 1ced88232..a9c5bfd36 100644
--- a/public/javascripts/select_list_move.js
+++ b/public/javascripts/select_list_move.js
@@ -7,6 +7,17 @@ function addOption(theSel, theText, theValue)
theSel.options[selLength] = newOpt;
}
+function swapOptions(theSel, index1, index2)
+{
+ var text, value;
+ text = theSel.options[index1].text;
+ value = theSel.options[index1].value;
+ theSel.options[index1].text = theSel.options[index2].text;
+ theSel.options[index1].value = theSel.options[index2].value;
+ theSel.options[index2].text = text;
+ theSel.options[index2].value = value;
+}
+
function deleteOption(theSel, theIndex)
{
var selLength = theSel.length;
@@ -45,6 +56,22 @@ function moveOptions(theSelFrom, theSelTo)
if(NS4) history.go(0);
}
+function moveOptionUp(theSel) {
+ var index = theSel.selectedIndex;
+ if (index > 0) {
+ swapOptions(theSel, index-1, index);
+ theSel.selectedIndex = index-1;
+ }
+}
+
+function moveOptionDown(theSel) {
+ var index = theSel.selectedIndex;
+ if (index < theSel.length - 1) {
+ swapOptions(theSel, index, index+1);
+ theSel.selectedIndex = index+1;
+ }
+}
+
function selectAllOptions(id)
{
var select = $(id);