r2837 - - applying orientation i (icon only) now will behave exactly like auto (+ removing label)

r2837 - - applying orientation i (icon only) now will behave exactly like auto (+ removing label)


Author: malk0.phpgtk
Date: Wed Jun 24 17:52:11 2009
New Revision: 2837
Modified:
branches/labs/button/demo.html
branches/labs/button/ui.button.js
Log:
- applying orientation i (icon only) now will behave exactly like auto (+
removing label)
Modified: branches/labs/button/demo.html
==============================================================================
--- branches/labs/button/demo.html    (original)
+++ branches/labs/button/demo.html    Wed Jun 24 17:52:11 2009
@@ -60,7 +60,7 @@
        $('#settingBar select').change(function(){
            if($(this).is('#bodySizeSelector'))
                return $('body').css('fontSize',$(this).val());
-            
$('.ui-button:gt(18)').button('option',$(this).attr('name'),$(this).val());
+            
$('.ui-button:gt(19)').button('option',$(this).attr('name'),$(this).val());
        });
        
$('select[class*=ui-buttonset]').selectbuttonset().filter(':gt(0)').change();
$('#switcher').themeswitcher();
@@ -101,6 +101,7 @@
        <br />
        <label>Change icon position
            <select id="orientationSelector" name="orientation"
class="ui-buttonset-small">
+                <option class="ui-icon-cancel" value="auto">auto</option>
                <option class="ui-icon-arrowthick-1-n" value="t">top</option>
                <option class="ui-icon-arrowthick-1-w" value="l"
selected="selected">left</option>
                <option class="ui-icon-arrowthick-1-s" value="b">bottom</option>
@@ -148,12 +149,11 @@
    </div>
    <h3>Using SPAN element</h3>
-    <div class="ui-buttonset-r">
-        <span class="ui-button ui-button-l-calendar">standard with
icon</span><span class="ui-button ui-button-contact">standard
button</span><span class="ui-button ui-button-person toggle">toggle
button</span><span class="ui-button ui-button-toggle-close">toggle
button</span>
+    <div class="ui-buttonset-t">
+        <span class="ui-button ui-button-b-calendar">standard with
icon</span><span class="ui-button ui-button-i-contact">standard
button</span><span class="ui-button ui-button-person toggle">toggle
button</span><span class="ui-button ui-button-toggle-close">toggle
button</span>
    </div>
    <h3>Using DIV element (start with no labels at all even if they're in the
original markup)</h3>
    <div class="ui-buttonset-i">
-
        <div class="ui-button ui-button-home">standard button</div><div
class="ui-button ui-button-toggle-eject">toggle button</div><div
class="ui-button ui-button-toggle-power">toggle button</div>
    </div>
    <h3>Using BUTTON element</h3>
Modified: branches/labs/button/ui.button.js
==============================================================================
--- branches/labs/button/ui.button.js    (original)
+++ branches/labs/button/ui.button.js    Wed Jun 24 17:52:11 2009
@@ -220,14 +220,15 @@
                    }
                    break;
                case 'orientation':
-                    if( ! value){
+                    if(! value){
                        value = 'auto';
                    }
-                    if( value==='auto' && self._buttonset &&
self._buttonset.buttonset('option','orientation') ){
-                        value = self._buttonset.buttonset('option','orientation');
+                    var applyValue = (value==='i'?'auto':value);
+                    if( applyValue==='auto' && self._buttonset ){
+                        applyValue = self._buttonset.buttonset('option','orientation');
                    }
-                    self._orientationValue = (value=='auto'||value=='i')?'l':value;
-                    if( value==='i'){
+                    self._orientationValue = (applyValue=='auto'||
applyValue=='i')?'l':applyValue;
+                    if( value==='i' || applyValue==='i'){
                        self._setData('label','');
                    }
                    
self._rmExpClass($.ui.button.classes.base+'-orientation-*',$.ui.button.classes.base+'-orientation-'+self._orientationValue);
@@ -274,9 +275,10 @@
                self._setData('size',buttonSetSize);
                self.options.size='auto';
            }
-            if( self._getData('orientation')==='auto' &&
buttonSetOrientation !== 'auto'){
+            var orientationOption = self._getData('orientation');
+            if( orientationOption==='auto' || orientationOption==='i' &&
buttonSetOrientation !== 'auto'){
                self._setData('orientation',buttonSetOrientation);
-                self.options.orientation='auto';
+                self.options.orientation=orientationOption;
            }
            if( 'auto' == self._getData('corners')){