-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Button icon span #1216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button icon span #1216
Changes from all commits
d0d24a1
cf6e119
747635a
b408636
d344b50
d903e1a
6591ad1
b782bfc
19c6b9e
3223c29
01c54ec
fe00326
35564dd
0d71cbf
995a855
f55d4ce
1e225e7
d566fec
1ccec99
8d64f1f
21afafd
661ce0e
d3b0f85
0fead84
9b7dbc6
234aeb1
06455ac
320e2ec
c485bc5
4ab74f1
bad64ec
d95139e
b865d59
baf108e
841abaf
48c7481
dae9466
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,30 +8,63 @@ | |
<script src="../../ui/core.js"></script> | ||
<script src="../../ui/widget.js"></script> | ||
<script src="../../ui/button.js"></script> | ||
<script src="../../ui/checkboxradio.js"></script> | ||
<link rel="stylesheet" href="../demos.css"> | ||
<script> | ||
$(function() { | ||
$( "#check" ).button(); | ||
$( "#format" ).buttonset(); | ||
var checkboxes = $( "form input" ).checkboxradio(); | ||
|
||
$( ".controls input, .controls select" ).on( "change keyup", function(){ | ||
var option = $( this ).attr( "name" ), | ||
value = $( this ).val(); | ||
|
||
if( $( this ).is( "[type=checkbox] ") ) { | ||
if( $( this ).is(":checked") ) { | ||
value = true; | ||
} else { | ||
value = false; | ||
} | ||
} | ||
if( option != "label" || value !== "" ) { | ||
checkboxes.checkboxradio( "option", option, value ); | ||
} | ||
}); | ||
$( ".controls>button" ).click( function(){ | ||
if( this.id !== "create" ){ | ||
checkboxes.checkboxradio( this.id ); | ||
} else { | ||
checkboxes.checkboxradio(); | ||
} | ||
}); | ||
}); | ||
</script> | ||
<style> | ||
#format { margin-top: 2em; } | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<input type="checkbox" id="check" /><label for="check">Toggle</label> | ||
|
||
<div id="format"> | ||
<input type="checkbox" id="check1" /><label for="check1">B</label> | ||
<input type="checkbox" id="check2" /><label for="check2">I</label> | ||
<input type="checkbox" id="check3" /><label for="check3">U</label> | ||
</div> | ||
|
||
<div class="demo-description"> | ||
<p>A checkbox is styled as a toggle button with the button widget. The label element associated with the checkbox is used for the button text.</p> | ||
<p>This demo also demonstrates three checkboxes styled as a button set by calling <code>.buttonset()</code> on a common container.</p> | ||
css for new checkbox widget | ||
</div> | ||
<div class="controls"> | ||
<button id="create">Create</button> | ||
<button id="destroy">Destroy</button> | ||
<button id="enable">Enable</button> | ||
<button id="disable">Disable</button> | ||
<button id="refresh">Refresh</button> | ||
<input type="checkbox" id="icon" name="icon"><label for="icon">Icon</label> | ||
<input type="checkbox" id="disabled" name="disabled"><label for="disabled">Disabled</label> | ||
<input type="text" id="label" name="label"><label for="label">Label</label> | ||
</div> | ||
<form> | ||
<input type="checkbox" id="checkbox-1" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove closing slash on empty elements, here and below. |
||
<label for="checkbox-1">Checkbox widget sample</label> | ||
<input type="checkbox" id="checkbox-2" /><label for="checkbox-2">Checkbox widget sample</label> | ||
|
||
<input type="radio" id="radio-1" name="radio" checked/> | ||
<label for="radio-1">Radio widget sample</label> | ||
<input type="radio" id="radio-2" name="radio"/><label for="radio-2">Radio widget sample 2</label> | ||
<button type="reset">Reset</button> | ||
</form> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,39 +11,58 @@ | |
<link rel="stylesheet" href="../demos.css"> | ||
<script> | ||
$(function() { | ||
$( "button:first" ).button({ | ||
icons: { | ||
primary: "ui-icon-locked" | ||
}, | ||
text: false | ||
$( ".widget button:first" ).button({ | ||
icon: "ui-icon-gear", | ||
showLabel: false | ||
}).next().button({ | ||
icons: { | ||
primary: "ui-icon-locked" | ||
} | ||
icon: "ui-icon-triangle-1-w" | ||
}).next().button({ | ||
icons: { | ||
primary: "ui-icon-gear", | ||
secondary: "ui-icon-triangle-1-s" | ||
} | ||
icon: "ui-icon-triangle-1-e", | ||
iconPosition: "end" | ||
}).next().button({ | ||
icons: { | ||
primary: "ui-icon-gear", | ||
secondary: "ui-icon-triangle-1-s" | ||
}, | ||
text: false | ||
icon: "ui-icon-triangle-1-s", | ||
iconPosition: "bottom" | ||
}).next().button({ | ||
icon: "ui-icon-triangle-1-n", | ||
iconPosition: "top" | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
|
||
<button>Button with icon only</button> | ||
<button>Button with icon on the left</button> | ||
<button>Button with two icons</button> | ||
<button>Button with two icons and no text</button> | ||
|
||
<div class="demo-description"> | ||
<p>Some buttons with various combinations of text and icons.</p> | ||
</div> | ||
<div class="widget"> | ||
<h1>Widget</h1> | ||
<button>Button with icon only</button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Icon + text, though inconsistent with the CSS button equivalent, which is really just icon, no text. |
||
<button>Button with icon on the left</button> | ||
<button>Button with icon</button> | ||
<button>Button with icon and text</button> | ||
</div> | ||
<div class="css"> | ||
<h1>CSS</h1> | ||
<button class="ui-button ui-widget ui-corner-all ui-button-icon-only"> | ||
<span class="ui-icon ui-icon-gear"></span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double space, remove one |
||
Button with icon only | ||
</button> | ||
<button class="ui-button ui-widget ui-corner-all ui-icon-beginning"> | ||
<span class="ui-icon ui-icon-triangle-1-w"></span> | ||
Button with icon on the left | ||
</button> | ||
<button class="ui-button ui-widget ui-corner-all ui-icon-end"> | ||
<span class="ui-icon ui-icon-triangle-1-e"></span> | ||
Button with icon on the right | ||
</button> | ||
<button class="ui-button ui-widget ui-corner-all ui-icon-bottom"> | ||
<span class="ui-icon ui-icon-triangle-1-s"></span> | ||
Button with icon on bottom | ||
</button> | ||
<button class="ui-button ui-widget ui-corner-all ui-icon-top"> | ||
<span class="ui-icon ui-icon-triangle-1-n"></span> | ||
Button with icon on top | ||
</button> | ||
|
||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
TestHelpers.commonWidgetTests( "button", { | ||
defaults: { | ||
disabled: null, | ||
icons: { | ||
primary: null, | ||
secondary: null | ||
}, | ||
showLabel: true, | ||
label: null, | ||
text: true, | ||
icon: null, | ||
iconPosition: "beginning", | ||
|
||
// callbacks | ||
// Callbacks | ||
create: null | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after
if
, a few more times below. Too bad we don't run jscs and jshint for inline scripts, that would help here.