]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Extract button pane creation into _createButtonPane
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 15 Nov 2012 22:23:25 +0000 (23:23 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 26 Nov 2012 09:28:22 +0000 (10:28 +0100)
tests/visual/dialog/complex-dialogs.html
ui/jquery.ui.dialog.js

index 2b9a0d3a6b81917057c2046cb3d56345d1562c21..8e5d84d3d6cd9094fed18c466d3065ba4bc79db7 100644 (file)
                var dialog = $( "#dialog" ).dialog({
                                modal: true,
                                height: 300,
-                               width: 500
+                               width: 500,
+                               buttons: [
+                                       {
+                                               text: "Ok"
+                                       },
+                                       {
+                                               text: "Cancel"
+                                       }
+                               ]
                        }),
 
                        datepickerDialog = $( "#dialog-datepicker" ).dialog({
index d4f03af60d2dbdc8d530b33fa1b650f3d6f94cbf..79aae52ab64b4d0c45a23a3452556f3f632504d9 100644 (file)
@@ -123,16 +123,8 @@ $.widget("ui.dialog", {
                                .addClass( "ui-dialog-content ui-widget-content" )
                                .appendTo( this.uiDialog );
 
-                       this._createTitlebar();
-
-                       // 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 );
-
+               this._createTitlebar();
+               this._createButtonPane();
 
                // TODO move into _createWrapper
                // We assume that any existing aria-describedby attribute means
@@ -151,9 +143,6 @@ $.widget("ui.dialog", {
                        this._makeResizable();
                }
 
-               // TODO merge with _createButtonPane?
-               this._createButtons();
-
                this._isOpen = false;
 
                // 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() {
                var that = this,
                        buttons = this.options.buttons;