Search and Top Navigation
Ticket #4101: dialog-minheight.patch
File dialog-minheight.patch, 2.9 KB (added by scottgonzalez, April 18, 2009 08:46PM UTC)
Index: /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js
===================================================================
--- /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js (revision 2477)
+++ /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js (working copy)
@@ -19,7 +19,6 @@
drag: "drag.draggable",
dragStop: "stop.draggable",
maxHeight: "maxHeight.resizable",
- minHeight: "minHeight.resizable",
maxWidth: "maxWidth.resizable",
minWidth: "minWidth.resizable",
resizeStart: "start.resizable",
@@ -351,7 +350,7 @@
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
- minHeight: options.minHeight,
+ minHeight: self._minHeight(),
start: function() {
$(this).addClass("ui-dialog-resizing");
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
@@ -371,6 +370,14 @@
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
},
+ _minHeight: function() {
+ var options = this.options;
+
+ return (options.height == 'auto'
+ ? options.minHeight
+ : Math.min(options.minHeight, options.height));
+ },
+
_position: function(pos) {
var wnd = $(window), doc = $(document),
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
@@ -425,7 +432,8 @@
_setData: function(key, value){
var self = this,
- uiDialog = self.uiDialog;
+ uiDialog = self.uiDialog,
+ resize = false;
(setDataSwitch[key] && uiDialog.data(setDataSwitch[key], value));
switch (key) {
@@ -446,7 +454,10 @@
: uiDialog.draggable('destroy'));
break;
case "height":
- uiDialog.height(value);
+ resize = true;
+ break;
+ case "minHeight":
+ resize = true;
break;
case "position":
self._position(value);
@@ -452,7 +463,7 @@
self._position(value);
break;
case "resizable":
- var isResizable = uiDialog.is(':data(resizable)');
+ var isResizable = uiDialog.is(':ui-resizable');
// currently resizable, becoming non-resizable
(isResizable && !value && uiDialog.resizable('destroy'));
@@ -468,7 +479,7 @@
$(".ui-dialog-title", self.uiDialogTitlebar).html(value || ' ');
break;
case "width":
- uiDialog.width(value);
+ resize = true;
break;
}
@@ -473,6 +484,7 @@
}
$.widget.prototype._setData.apply(self, arguments);
+ (resize && self._size());
},
_size: function() {
@@ -496,13 +508,17 @@
})
.height();
- this.element
- .css({
+ this.element.css(options.height == 'auto'
+ ? {
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
- height: options.height == 'auto'
- ? 'auto'
- : Math.max(options.height - nonContentHeight, 0)
+ height: 'auto'
+ }
+ : {
+ height: Math.max(options.height - nonContentHeight, 0)
});
+
+ (this.uiDialog.is(':ui-resizable') &&
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight()));
}
});
Download in other formats:
Original Format
File dialog-minheight.patch, 2.9 KB (added by scottgonzalez, April 18, 2009 08:46PM UTC)
Index: /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js
===================================================================
--- /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js (revision 2477)
+++ /Users/sgonzale/Documents/workspace/jQuery UI/ui/ui.dialog.js (working copy)
@@ -19,7 +19,6 @@
drag: "drag.draggable",
dragStop: "stop.draggable",
maxHeight: "maxHeight.resizable",
- minHeight: "minHeight.resizable",
maxWidth: "maxWidth.resizable",
minWidth: "minWidth.resizable",
resizeStart: "start.resizable",
@@ -351,7 +350,7 @@
maxWidth: options.maxWidth,
maxHeight: options.maxHeight,
minWidth: options.minWidth,
- minHeight: options.minHeight,
+ minHeight: self._minHeight(),
start: function() {
$(this).addClass("ui-dialog-resizing");
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
@@ -371,6 +370,14 @@
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
},
+ _minHeight: function() {
+ var options = this.options;
+
+ return (options.height == 'auto'
+ ? options.minHeight
+ : Math.min(options.minHeight, options.height));
+ },
+
_position: function(pos) {
var wnd = $(window), doc = $(document),
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
@@ -425,7 +432,8 @@
_setData: function(key, value){
var self = this,
- uiDialog = self.uiDialog;
+ uiDialog = self.uiDialog,
+ resize = false;
(setDataSwitch[key] && uiDialog.data(setDataSwitch[key], value));
switch (key) {
@@ -446,7 +454,10 @@
: uiDialog.draggable('destroy'));
break;
case "height":
- uiDialog.height(value);
+ resize = true;
+ break;
+ case "minHeight":
+ resize = true;
break;
case "position":
self._position(value);
@@ -452,7 +463,7 @@
self._position(value);
break;
case "resizable":
- var isResizable = uiDialog.is(':data(resizable)');
+ var isResizable = uiDialog.is(':ui-resizable');
// currently resizable, becoming non-resizable
(isResizable && !value && uiDialog.resizable('destroy'));
@@ -468,7 +479,7 @@
$(".ui-dialog-title", self.uiDialogTitlebar).html(value || ' ');
break;
case "width":
- uiDialog.width(value);
+ resize = true;
break;
}
@@ -473,6 +484,7 @@
}
$.widget.prototype._setData.apply(self, arguments);
+ (resize && self._size());
},
_size: function() {
@@ -496,13 +508,17 @@
})
.height();
- this.element
- .css({
+ this.element.css(options.height == 'auto'
+ ? {
minHeight: Math.max(options.minHeight - nonContentHeight, 0),
- height: options.height == 'auto'
- ? 'auto'
- : Math.max(options.height - nonContentHeight, 0)
+ height: 'auto'
+ }
+ : {
+ height: Math.max(options.height - nonContentHeight, 0)
});
+
+ (this.uiDialog.is(':ui-resizable') &&
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight()));
}
});