[Jifty-commit] jifty branch, jquery_with_ui, updated. 43eb2d11d8baa59ae8f8e728ffc561b824c7355a

Jifty commits jifty-commit at lists.jifty.org
Wed Jan 27 08:30:24 EST 2010


The branch, jquery_with_ui has been updated
       via  43eb2d11d8baa59ae8f8e728ffc561b824c7355a (commit)
      from  1b1b2d5f1ac7f64ceec3d0a905f89c89c127446d (commit)

Summary of changes:
 share/web/static/js/ordered-list.js |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 43eb2d11d8baa59ae8f8e728ffc561b824c7355a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jan 27 21:30:17 2010 +0800

    tweak ordered-list.js: make sure head is really head

diff --git a/share/web/static/js/ordered-list.js b/share/web/static/js/ordered-list.js
index e91c541..0737916 100644
--- a/share/web/static/js/ordered-list.js
+++ b/share/web/static/js/ordered-list.js
@@ -4,7 +4,12 @@ jQuery(document).ready(function(){
         var box = jQuery(this);
         box.find('ul.unselected').sortable( {
             connectWith: box.find('ul.selected'),
-            cancel: 'li.head'
+            cancel: 'li.head',
+            update: function () {
+                if ( jQuery(this).find('li.head').length ) {
+                    jQuery(this).find('li.head').prependTo(this);
+                }
+            }
             });
         box.find('ul.selected').sortable( {
             connectWith: box.find('ul.unselected'),
@@ -12,6 +17,10 @@ jQuery(document).ready(function(){
             update: function () {
                 var select = box.find('select.submit');
                 select.children('option').remove();
+                // make sure head is always the first
+                if ( jQuery(this).find('li.head').length ) {
+                    jQuery(this).find('li.head').prependTo(this);
+                }
                 jQuery(this).find('li:not(.head)').each( function() {
                     var value = jQuery(this).find('input.value').val();
                     jQuery('<option selected="selected" value="' + value + '" >' + value + '</option>').appendTo(select);

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list