[FIX]modal strict to bootstrap: no resize and only use 3 size, large-medium-small instead of changing width of modal
bzr revid: csn@openerp.com-20140410151940-w0m1ljjqgo0eysgp
This commit is contained in:
parent
964e94f8a8
commit
049539809d
|
@ -1091,9 +1091,6 @@
|
|||
margin-left: -6px;
|
||||
}
|
||||
.openerp .oe_about .oe_bottom {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-shadow: 0 1px 1px #999999;
|
||||
background-color: #8a0e0e;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#b41616), to(#600606));
|
||||
|
|
|
@ -931,9 +931,6 @@ $sheet-padding: 16px
|
|||
.oe_logo
|
||||
margin-left: -6px
|
||||
.oe_bottom
|
||||
position: absolute
|
||||
left: 0
|
||||
right: 0
|
||||
text-shadow: 0 1px 1px #999999
|
||||
@include vertical-gradient(#b41616, #600606)
|
||||
color: #eee
|
||||
|
|
|
@ -71,6 +71,8 @@ instance.web.Dialog = instance.web.Widget.extend({
|
|||
@param {Widget} parent
|
||||
@param {dictionary} options A dictionary that will be forwarded to jQueryUI Dialog. Additionaly, that
|
||||
dictionary can contain the following keys:
|
||||
- modal_size: one of the following: 'large', 'medium', 'small'
|
||||
- dialogClass: class to add to the body of dialog
|
||||
- buttons: Deprecated. The buttons key is not propagated to jQueryUI Dialog. It must be a dictionary (key = button
|
||||
label, value = click handler) or a list of dictionaries (each element in the dictionary is send to the
|
||||
corresponding method of a jQuery element targeting the <button> tag). It is deprecated because all dialogs
|
||||
|
@ -87,13 +89,7 @@ instance.web.Dialog = instance.web.Widget.extend({
|
|||
this.content_to_set = content;
|
||||
this.dialog_options = {
|
||||
destroy_on_close: true,
|
||||
width: 900,
|
||||
min_width: 0,
|
||||
max_width: '95%',
|
||||
height: 'auto',
|
||||
min_height: 0,
|
||||
max_height: $(window.top).height() - 200,
|
||||
resizable: true,
|
||||
modal_size: 'large', //'medium', 'small'
|
||||
buttons: null,
|
||||
};
|
||||
if (options) {
|
||||
|
@ -102,51 +98,6 @@ instance.web.Dialog = instance.web.Widget.extend({
|
|||
this.on("closing", this, this._closing);
|
||||
this.$buttons = $('<div class="modal-footer"><span class="oe_dialog_custom_buttons"/></div>');
|
||||
},
|
||||
_get_options: function() {
|
||||
var self = this;
|
||||
var o = _.extend({}, this.dialog_options);
|
||||
var sizes = {
|
||||
width: $(window.top).width(),
|
||||
height: $(window.top).height(),
|
||||
};
|
||||
_.each(sizes, function(available_size, unit) {
|
||||
o[unit] = self._get_size(o[unit], available_size);
|
||||
o['min_' + unit] = self._get_size(o['min_' + unit] || 0, available_size);
|
||||
o['max_' + unit] = self._get_size(o['max_' + unit] || 0, available_size);
|
||||
if (o[unit] !== 'auto' && o['min_' + unit] && o[unit] < o['min_' + unit]) {
|
||||
o[unit] = o['min_' + unit];
|
||||
}
|
||||
if (o[unit] !== 'auto' && o['max_' + unit] && o[unit] > o['max_' + unit]) {
|
||||
o[unit] = o['max_' + unit];
|
||||
}
|
||||
});
|
||||
var layout_inner = {};
|
||||
var layout_outer = {};
|
||||
_.each(o, function(value,key){
|
||||
if (_.contains(self.css_layout_inner, ''+key+'')){
|
||||
layout_inner[key] = value;
|
||||
delete o[key];
|
||||
}
|
||||
if (_.contains(self.css_layout_outer, ''+key+'')){
|
||||
layout_outer[key] = value;
|
||||
delete o[key];
|
||||
}
|
||||
});
|
||||
o.layout_inner = layout_inner;
|
||||
o.layout_outer = layout_outer;
|
||||
o.title = o.title || this.dialog_title;
|
||||
return o;
|
||||
},
|
||||
_get_size: function(val, available_size) {
|
||||
val = val.toString();
|
||||
if (val === 'auto') {
|
||||
return val;
|
||||
} else if (val.slice(-1) === "%") {
|
||||
return Math.round(available_size / 100 * parseInt(val.slice(0, -1), 10));
|
||||
} else {
|
||||
return parseInt(val, 10);
|
||||
}
|
||||
},
|
||||
renderElement: function() {
|
||||
if (this.content_to_set) {
|
||||
this.setElement(this.content_to_set);
|
||||
|
@ -189,7 +140,8 @@ instance.web.Dialog = instance.web.Widget.extend({
|
|||
*/
|
||||
init_dialog: function() {
|
||||
var self = this;
|
||||
var options = this._get_options();
|
||||
var options = _.extend({}, this.dialog_options);
|
||||
options.title = options.title || this.dialog_title;
|
||||
if (options.buttons) {
|
||||
this._add_buttons(options.buttons);
|
||||
delete(options.buttons);
|
||||
|
@ -201,36 +153,26 @@ instance.web.Dialog = instance.web.Widget.extend({
|
|||
'backdrop': false,
|
||||
'keyboard': true,
|
||||
});
|
||||
if (options.modal_size !== 'large'){
|
||||
var dialog_class_size = this.$dialog_box.find('.modal-lg').removeClass('modal-lg')
|
||||
if (options.modal_size === 'small'){
|
||||
dialog_class_size.addClass('modal-sm');
|
||||
}
|
||||
}
|
||||
|
||||
this.$el.appendTo(this.$dialog_box.find(".modal-body"));
|
||||
var dialog_body = this.$dialog_box.find('.modal-content');
|
||||
if (options.layout_outer || options.layout_inner){
|
||||
dialog_body.parent().css(options.layout_outer);
|
||||
dialog_body.css(options.layout_inner);
|
||||
}
|
||||
if (options.dialogClass){
|
||||
dialog_body.find(".modal-body").addClass(options.dialogClass);
|
||||
}
|
||||
dialog_body.openerpClass();
|
||||
dialog_body.draggable({ handle: ".modal-header", containment: "window" });
|
||||
|
||||
this.$dialog_box.on('hidden.bs.modal',this,function(){
|
||||
self.trigger("closing");
|
||||
});
|
||||
this.$dialog_box.modal('show');
|
||||
|
||||
if (options.layout_inner.height === 'auto' && options.layout_inner.max_height) {
|
||||
this.$el.css({ 'max-height': options.layout_inner.max_height, 'overflow-y': 'auto' });
|
||||
}
|
||||
var dialog_body = this.$dialog_box.find('.modal-content');
|
||||
if (options.resizable){
|
||||
dialog_body.resizable({ handles: 'n, e, s, w, ne, se, sw, nw' });
|
||||
}
|
||||
dialog_body.resize(function() {
|
||||
var main_modal = dialog_body.parent();
|
||||
var modal_body = main_modal.find(".modal-body .in");
|
||||
var modal_content = main_modal.find(".modal-content").height();
|
||||
modal_body.height(modal_content - 150);
|
||||
main_modal.find(".modal-content").height((modal_body.height() + main_modal.find(".modal-header").height() + main_modal.find(".modal-footer").height()) + 85);
|
||||
});
|
||||
this.dialog_inited = true;
|
||||
var res = this.start();
|
||||
return res;
|
||||
|
@ -305,6 +247,7 @@ instance.web.CrashManager = instance.web.Class.extend({
|
|||
error = _.extend({}, error, {data: _.extend({}, error.data, {message: error.data.arguments[0] + "\n\n" + error.data.arguments[1]})});
|
||||
}
|
||||
new instance.web.Dialog(this, {
|
||||
modal_size: 'medium',
|
||||
title: "OpenERP " + (_.str.capitalize(error.type) || "Warning"),
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
|
||||
|
@ -321,7 +264,6 @@ instance.web.CrashManager = instance.web.Class.extend({
|
|||
};
|
||||
new instance.web.Dialog(this, {
|
||||
title: "OpenERP " + _.str.capitalize(error.type),
|
||||
width: '80%',
|
||||
buttons: buttons
|
||||
}, QWeb.render('CrashManager.error', {session: instance.session, error: error})).open();
|
||||
},
|
||||
|
@ -371,6 +313,7 @@ instance.web.RedirectWarningHandler = instance.web.Dialog.extend(instance.web.Ex
|
|||
error.data.message = error.data.arguments[0];
|
||||
|
||||
new instance.web.Dialog(this, {
|
||||
modal_size: 'medium',
|
||||
title: "OpenERP " + (_.str.capitalize(error.type) || "Warning"),
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }},
|
||||
|
@ -527,6 +470,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
|
|||
*/
|
||||
display_error: function (error) {
|
||||
return new instance.web.Dialog(this, {
|
||||
modal_size: 'medium',
|
||||
title: error.title,
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }}
|
||||
|
@ -759,6 +703,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
|
|||
},
|
||||
display_error: function (error) {
|
||||
return new instance.web.Dialog(this, {
|
||||
modal_size: 'medium',
|
||||
title: error.title,
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.$el.parents('.modal').modal('hide'); }}
|
||||
|
@ -1079,9 +1024,9 @@ instance.web.UserMenu = instance.web.Widget.extend({
|
|||
window.location = $.param.querystring( window.location.href, 'debug');
|
||||
});
|
||||
new instance.web.Dialog(this, {
|
||||
resizable: false,
|
||||
modal_size: 'medium',
|
||||
dialogClass: 'oe_act_window',
|
||||
title: _t("About"),
|
||||
width: 507, height: 290,
|
||||
}, $help).open();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -587,6 +587,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||
}
|
||||
if (!_.isEmpty(result.warning)) {
|
||||
new instance.web.Dialog(this, {
|
||||
modal_size: 'medium',
|
||||
title:result.warning.title,
|
||||
buttons: [
|
||||
{text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
|
||||
|
@ -3229,7 +3230,7 @@ instance.web.form.M2ODialog = instance.web.Dialog.extend({
|
|||
init: function(parent) {
|
||||
this._super(parent, {
|
||||
title: _.str.sprintf(_t("Add %s"), parent.string),
|
||||
width: 312,
|
||||
modal_size: 'medium',
|
||||
});
|
||||
},
|
||||
start: function() {
|
||||
|
@ -4912,7 +4913,6 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({
|
|||
var self = this;
|
||||
this.renderElement();
|
||||
var dialog = new instance.web.Dialog(this, {
|
||||
min_width: '800px',
|
||||
dialogClass: 'oe_act_window',
|
||||
title: this.options.title || "",
|
||||
}, this.$el).open();
|
||||
|
|
|
@ -926,7 +926,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
|
|||
current_view = this.views[this.active_view].controller;
|
||||
switch (val) {
|
||||
case 'fvg':
|
||||
var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get"), width: '95%' }).open();
|
||||
var dialog = new instance.web.Dialog(this, { title: _t("Fields View Get") }).open();
|
||||
$('<pre>').text(instance.web.json_node_to_xml(current_view.fields_view.arch, true)).appendTo(dialog.$el);
|
||||
break;
|
||||
case 'tests':
|
||||
|
@ -943,7 +943,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
|
|||
this.dataset.call('perm_read', [ids]).done(function(result) {
|
||||
var dialog = new instance.web.Dialog(this, {
|
||||
title: _.str.sprintf(_t("View Log (%s)"), self.dataset.model),
|
||||
width: 400
|
||||
modal_size: 'medium',
|
||||
}, QWeb.render('ViewManagerDebugViewLog', {
|
||||
perm : result[0],
|
||||
format : instance.web.format_value
|
||||
|
@ -986,7 +986,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
|
|||
new instance.web.Dialog(self, {
|
||||
title: _.str.sprintf(_t("Model %s fields"),
|
||||
self.dataset.model),
|
||||
width: '95%'}, $root).open();
|
||||
}, $root).open();
|
||||
});
|
||||
break;
|
||||
case 'edit_workflow':
|
||||
|
@ -1223,7 +1223,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
domain = $.Deferred().resolve(undefined);
|
||||
}
|
||||
if (ids.length === 0) {
|
||||
new instance.web.Dialog(this, { title: _t("Warning")}, $("<div />").text(_t("You must choose at least one record."))).open();
|
||||
new instance.web.Dialog(this, { title: _t("Warning"), modal_size: 'medium',}, $("<div />").text(_t("You must choose at least one record."))).open();
|
||||
return false;
|
||||
}
|
||||
var active_ids_context = {
|
||||
|
|
|
@ -58,7 +58,6 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
|
|||
};
|
||||
this.view_edit_dialog = new instance.web.Dialog(this, {
|
||||
title: action_title,
|
||||
width: 850,
|
||||
buttons: [
|
||||
{text: _t("Create"), click: function() { self.on_create_view(); }},
|
||||
{text: _t("Edit"), click: function() { self.xml_element_id = 0; self.get_arch(); }},
|
||||
|
@ -376,7 +375,6 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
|
|||
this.one_object = one_object;
|
||||
this.edit_xml_dialog = new instance.web.Dialog(this, {
|
||||
title: _.str.sprintf(_t("View Editor %d - %s"), self.main_view_id, self.model),
|
||||
height: '90%',
|
||||
buttons: [
|
||||
{text: _t("Inherited View"), click: function(){
|
||||
var selected_row = self.edit_xml_dialog.$el.find('.ui-selected');
|
||||
|
@ -829,7 +827,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
|
|||
var self = this;
|
||||
this.edit_node_dialog = new instance.web.Dialog(this,{
|
||||
title: _t("Properties"),
|
||||
width: 450,
|
||||
modal_size: 'medium',
|
||||
buttons: [
|
||||
{text: _t("Update"), click: function () {
|
||||
var warn = false, update_values = [];
|
||||
|
@ -955,7 +953,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
|
|||
this.add_widget = [];
|
||||
this.add_node_dialog = new instance.web.Dialog(this,{
|
||||
title: _t("Properties"),
|
||||
width: 450,
|
||||
modal_size: 'medium',
|
||||
buttons: [
|
||||
{text: _t("Update"), click: function() {
|
||||
var check_add_node = true, values = {};
|
||||
|
|
Loading…
Reference in New Issue