diff public/javascripts/select_list_move.js @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents 261b3d9a4903
children
line wrap: on
line diff
--- a/public/javascripts/select_list_move.js	Tue Sep 09 09:28:31 2014 +0100
+++ b/public/javascripts/select_list_move.js	Tue Sep 09 09:29:00 2014 +0100
@@ -51,6 +51,17 @@
   }
 }
 
+function moveOptionTop(theSel) {
+  var index = theSel.selectedIndex;
+
+  if (index > 0) {
+    for (i=index; i>0; i--) {
+      swapOptions(theSel, i-1, i);
+    }
+    theSel.selectedIndex = 0;
+  }
+}
+
 function moveOptionDown(theSel) {
   var index = theSel.selectedIndex;
   if (index < theSel.length - 1) {
@@ -59,6 +70,17 @@
   }
 }
 
+function moveOptionBottom(theSel) {
+  var index = theSel.selectedIndex;
+  var indexTop = theSel.length - 1;
+  if (index < theSel.length - 1) {
+    for (i=index; i<indexTop; i++) {
+      swapOptions(theSel, i+1, i);
+    }
+    theSel.selectedIndex = indexTop;
+  }
+}
+
 // OK
 function selectAllOptions(id) {
   var select = $('#'+id);