mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Dialog: Extract button pane creation into _createButtonPane
This commit is contained in:
parent
1d6ce644e0
commit
4c9caa8169
@ -25,7 +25,15 @@
|
|||||||
var dialog = $( "#dialog" ).dialog({
|
var dialog = $( "#dialog" ).dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
height: 300,
|
height: 300,
|
||||||
width: 500
|
width: 500,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: "Ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Cancel"
|
||||||
|
}
|
||||||
|
]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
datepickerDialog = $( "#dialog-datepicker" ).dialog({
|
datepickerDialog = $( "#dialog-datepicker" ).dialog({
|
||||||
|
26
ui/jquery.ui.dialog.js
vendored
26
ui/jquery.ui.dialog.js
vendored
@ -123,16 +123,8 @@ $.widget("ui.dialog", {
|
|||||||
.addClass( "ui-dialog-content ui-widget-content" )
|
.addClass( "ui-dialog-content ui-widget-content" )
|
||||||
.appendTo( this.uiDialog );
|
.appendTo( this.uiDialog );
|
||||||
|
|
||||||
this._createTitlebar();
|
this._createTitlebar();
|
||||||
|
this._createButtonPane();
|
||||||
// TODO extract this one and the next into a _createButtonPane method
|
|
||||||
uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
|
|
||||||
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
|
|
||||||
|
|
||||||
( this.uiButtonSet = $( "<div>" ) )
|
|
||||||
.addClass( "ui-dialog-buttonset" )
|
|
||||||
.appendTo( uiDialogButtonPane );
|
|
||||||
|
|
||||||
|
|
||||||
// TODO move into _createWrapper
|
// TODO move into _createWrapper
|
||||||
// We assume that any existing aria-describedby attribute means
|
// We assume that any existing aria-describedby attribute means
|
||||||
@ -151,9 +143,6 @@ $.widget("ui.dialog", {
|
|||||||
this._makeResizable();
|
this._makeResizable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO merge with _createButtonPane?
|
|
||||||
this._createButtons();
|
|
||||||
|
|
||||||
this._isOpen = false;
|
this._isOpen = false;
|
||||||
|
|
||||||
// prevent tabbing out of dialogs
|
// prevent tabbing out of dialogs
|
||||||
@ -365,6 +354,17 @@ $.widget("ui.dialog", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_createButtonPane: function() {
|
||||||
|
var uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
|
||||||
|
.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
|
||||||
|
|
||||||
|
this.uiButtonSet = $( "<div>" )
|
||||||
|
.addClass( "ui-dialog-buttonset" )
|
||||||
|
.appendTo( uiDialogButtonPane );
|
||||||
|
|
||||||
|
this._createButtons();
|
||||||
|
},
|
||||||
|
|
||||||
_createButtons: function() {
|
_createButtons: function() {
|
||||||
var that = this,
|
var that = this,
|
||||||
buttons = this.options.buttons;
|
buttons = this.options.buttons;
|
||||||
|
Loading…
Reference in New Issue
Block a user