Let et2_dialogs size themselves according to contents unless otherwise specified.

Fixes dialogs too narrow for their title
This commit is contained in:
nathangray 2018-05-14 15:16:25 -06:00
parent 108eac185a
commit 75cc38cbfa

View File

@ -474,12 +474,12 @@ var et2_dialog = (function(){ "use strict"; return et2_widget.extend(
this.set_dialog_type(this.options.dialog_type); this.set_dialog_type(this.options.dialog_type);
} }
this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons); this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons);
this.div.dialog({
var options = {
// Pass the internal object, not the option // Pass the internal object, not the option
buttons: this.options.buttons, buttons: this.options.buttons,
modal: this.options.modal, modal: this.options.modal,
resizable: this.options.resizable, resizable: this.options.resizable,
width: this.options.width,
minWidth: this.options.minWidth, minWidth: this.options.minWidth,
minHeight:this.options.minHeight, minHeight:this.options.minHeight,
maxWidth: 640, maxWidth: 640,
@ -492,7 +492,14 @@ var et2_dialog = (function(){ "use strict"; return et2_widget.extend(
beforeClose: this.options.beforeClose, beforeClose: this.options.beforeClose,
closeText: this.egw().lang('close'), closeText: this.egw().lang('close'),
position: {my:this.options.position, at:this.options.position, of:window} position: {my:this.options.position, at:this.options.position, of:window}
}); };
// Leaving width unset lets it size itself according to contents
if(this.options.width && this.options.width !== 'auto')
{
options.width = this.options.width;
}
this.div.dialog(options);
} }
});}).call(this); });}).call(this);
et2_register_widget(et2_dialog, ["dialog"]); et2_register_widget(et2_dialog, ["dialog"]);