Skip to content

Added "icons" option for UI Dialog buttons #822

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions ui/jquery.ui.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ $.widget("ui.dialog", {
}
if ( hasButtons ) {
$.each( buttons, function( name, props ) {
var button, click;
var button, click, options;
props = $.isFunction( props ) ?
{ click: props, text: name } :
props;
Expand All @@ -345,10 +345,25 @@ $.widget("ui.dialog", {
props.click = function() {
click.apply( that.element[0], arguments );
};
// Copy allowed button options from given properties
options = {};
optionsList = ["icons","disabled","label"];
for ( var i in optionsList) {
if (props[optionsList[i]]) {
options[optionsList[i]] = props[optionsList[i]];
delete props[optionsList[i]];
}
}
// if no text specified
if (!props.text || props.text == "") {
options.text = false;
props.text = false;
}

button = $( "<button></button>", props )
.appendTo( that.uiButtonSet );
if ( $.fn.button ) {
button.button();
button.button(options);
}
});
this.uiDialog.addClass( "ui-dialog-buttons" );
Expand Down