]> source.dussan.org Git - jquery-ui.git/commitdiff
Button: Removed ui-button-text-icon class. Added ui-button-text-icon-primary and...
authorRichard D. Worth <rdworth@gmail.com>
Wed, 26 May 2010 19:08:37 +0000 (15:08 -0400)
committerRichard D. Worth <rdworth@gmail.com>
Wed, 26 May 2010 19:08:37 +0000 (15:08 -0400)
tests/static/button/default.html
tests/visual/button/button.html
themes/base/jquery.ui.button.css
ui/jquery.ui.button.js

index a2c35a4ad67a16d38261c202eebf27b277b82ed3..e0e0050907e6610d0f23cf42a3531ecaecf2731a 100644 (file)
                </button>
                
                <button class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
                </button>
-               
-               <button class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+
+               <button class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
+               </button>
+
+               <button class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
+               </button>
+
+               <button class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </button>
                
                <button class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">Both icons</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </button>
                
                <button class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">No text</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </button>
        </div>
                </a>
                
                <a href="#" class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
                </a>
                
-               <a href="#" class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+               <a href="#" class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
+               </a>
+               
+               <a href="#" class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
+               </a>
+
+               <a href="#" class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </a>
                
                <a href="#" class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">Both icons</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </a>
                
                <a href="#" class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">No text</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </a>
        </div>
                </label>
                
                <label class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
                </label>
                
-               <label class="ui-button ui-button-text-icon ui-widget ui-state-default ui-corner-all">
-                       <span class="ui-button-icon-primary ui-icon ui-icon-locked"></span>
-                       <span class="ui-button-text">Button</span>
+               <label class="ui-button ui-button-icon-only ui-widget ui-state-default ui-corner-all" title="Button">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
+               </label>
+               
+               <label class="ui-button ui-button-text-icon-primary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
+                       <span class="ui-button-text">Primary icon</span>
+               </label>
+               
+               <label class="ui-button ui-button-text-icon-secondary ui-widget ui-state-default ui-corner-all">
+                       <span class="ui-button-text">Secondary icon</span>
+                       <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </label>
                
                <label class="ui-button ui-button-text-icons ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">Both icons</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </label>
                
                <label class="ui-button ui-button-icons-only ui-widget ui-state-default ui-corner-all">
                        <span class="ui-button-icon-primary ui-icon ui-icon-gear"></span>
-                       <span class="ui-button-text">Button</span>
+                       <span class="ui-button-text">No text</span>
                        <span class="ui-button-icon-secondary ui-icon ui-icon-triangle-1-s"></span>
                </label>
        </div>
        <h2>Button Sets</h2>
        
        <div class="ui-buttonset">
-               <button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-left"><span class="ui-button-text">Simple button</span></button>
-               <button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Simple button</span></button>
-               <button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-right"><span class="ui-button-text">Simple button</span></button>
+               <button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-left"><span class="ui-button-text">First</span></button>
+               <button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Middle</span></button>
+               <button class="ui-button ui-button-text-only ui-widget ui-state-default"><span class="ui-button-text">Middle</span></button>
+               <button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-right"><span class="ui-button-text">Last</span></button>
        </div>
        
        
index 7575eadf1499d5b82ac132394458c30c9fe065eb..de0bb3ab9adc4620a25bb1b955b764d08c39efaa 100644 (file)
@@ -58,9 +58,9 @@
        <div>
                With icon
                <button class="{button:{icons:{primary:'ui-icon-locked'},text:false}}">Button with icon only</button>
-               <button class="{button:{icons:{primary:'ui-icon-locked'}}}">Button with icon on the left</button>
-               <button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}}}">Button with two icons</button>
-               <button class="{button:{icons:{secondary:'ui-icon-triangle-1-s'}}}">Button with text and secondary icon</button>
+               <button class="{button:{icons:{primary:'ui-icon-locked'}}}">Primary icon</button>
+               <button class="{button:{icons:{secondary:'ui-icon-triangle-1-s'}}}">Secondary icon</button>
+               <button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}}}">Both icons</button>
                <button class="{button:{icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'},text:false}}">Button with two icons and no text</button>
        </div>
 </div>
index 47777a42800529b305ccb821db25fca4b72e7baf..efe1ec03eb8573a7aa03ae49902ab91df425bf70 100644 (file)
@@ -11,15 +11,17 @@ button.ui-button-icons-only { width: 3.7em; }
 .ui-button .ui-button-text { display: block; line-height: 1.4;  }
 .ui-button-text-only .ui-button-text { padding: .4em 1em; }
 .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
 .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
 /* no icon support for input elements, provide padding by default */
 input.ui-button { padding: .4em 1em; }
 
 /*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
 .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
 .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
 
 /*button sets*/
@@ -28,8 +30,3 @@ input.ui-button { padding: .4em 1em; }
 
 /* workarounds */
 button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
-
-
-
-
-
index 83f14f4c986371642c14767d6d5237d1485cf96f..8176c332190e08991a1ae142bdb32f45ac8df73a 100644 (file)
@@ -16,7 +16,7 @@
 var lastActive,
        baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
        stateClasses = "ui-state-hover ui-state-active ",
-       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
+       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
        formResetHandler = function( event ) {
                $( ":ui-button", event.target.form ).each(function() {
                        var inst = $( this ).data( "button" );
@@ -288,7 +288,7 @@ $.widget( "ui.button", {
                        multipleIcons = icons.primary && icons.secondary;
                if ( icons.primary || icons.secondary ) {
                        buttonElement.addClass( "ui-button-text-icon" +
-                               ( multipleIcons ? "s" : "" ) );
+                               ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
                        if ( icons.primary ) {
                                buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
                        }
@@ -298,7 +298,7 @@ $.widget( "ui.button", {
                        if ( !this.options.text ) {
                                buttonElement
                                        .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
-                                       .removeClass( "ui-button-text-icons ui-button-text-icon" );
+                                       .removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
                                if ( !this.hasTitle ) {
                                        buttonElement.attr( "title", buttonText );
                                }