forked from Techsystech/web
[FIX] web_dialog_size: Fixes on legacy Dialogs
The problems found on Legacy Dialogs are the next: 1. The modal can't be dragged 2. The button for extending and reduce the modal is doing nothing 3. The x for close the modal is showed twice You can test it with dialogs showed on Vault module16.0
parent
e87080d976
commit
783536a818
|
@ -19,6 +19,10 @@ odoo.define("web_dialog_size.web_dialog_size", function (require) {
|
||||||
self.$modal
|
self.$modal
|
||||||
.find(".dialog_button_restore")
|
.find(".dialog_button_restore")
|
||||||
.on("click", self.proxy("_restore"));
|
.on("click", self.proxy("_restore"));
|
||||||
|
self.$modal.find(">:first-child").draggable({
|
||||||
|
handle: ".modal-header",
|
||||||
|
helper: false,
|
||||||
|
});
|
||||||
return config.then(function (r) {
|
return config.then(function (r) {
|
||||||
if (r.default_maximize) {
|
if (r.default_maximize) {
|
||||||
self._extending();
|
self._extending();
|
||||||
|
@ -29,39 +33,16 @@ odoo.define("web_dialog_size.web_dialog_size", function (require) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
opened: function () {
|
|
||||||
return this._super.apply(this, arguments).then(
|
|
||||||
function () {
|
|
||||||
if (this.$modal) {
|
|
||||||
this.$modal.find(">:first-child").draggable({
|
|
||||||
handle: ".modal-header",
|
|
||||||
helper: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
close: function () {
|
|
||||||
if (this.$modal) {
|
|
||||||
var draggable = this.$modal.find(">:first-child").draggable("instance");
|
|
||||||
if (draggable) {
|
|
||||||
this.$modal.find(">:first-child").draggable("destroy");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this._super.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
_extending: function () {
|
_extending: function () {
|
||||||
var dialog = this.$modal.find(".modal-dialog");
|
var dialog = this.$modal.find(".modal-dialog");
|
||||||
dialog.addClass("dialog_full_screen");
|
dialog.addClass("modal-dialog_full_screen");
|
||||||
dialog.find(".dialog_button_extend").hide();
|
dialog.find(".dialog_button_extend").hide();
|
||||||
dialog.find(".dialog_button_restore").show();
|
dialog.find(".dialog_button_restore").show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_restore: function () {
|
_restore: function () {
|
||||||
var dialog = this.$modal.find(".modal-dialog");
|
var dialog = this.$modal.find(".modal-dialog");
|
||||||
dialog.removeClass("dialog_full_screen");
|
dialog.removeClass("modal-dialog_full_screen");
|
||||||
dialog.find(".dialog_button_restore").hide();
|
dialog.find(".dialog_button_restore").hide();
|
||||||
dialog.find(".dialog_button_extend").show();
|
dialog.find(".dialog_button_extend").show();
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
<!-- This is for old Dialog template.
|
<!-- This is for old Dialog template.
|
||||||
Because Odoo haven't done every template to OWL. -->
|
Because Odoo haven't done every template to OWL. -->
|
||||||
<t t-extend="web.DialogWidget">
|
<t t-extend="web.DialogWidget">
|
||||||
<t t-jquery="button.btn-close" t-operation="inner">
|
|
||||||
<i class="fa fa-close" />
|
|
||||||
</t>
|
|
||||||
<t t-jquery="button.btn-close" t-operation="before">
|
<t t-jquery="button.btn-close" t-operation="before">
|
||||||
<button type="button" class="dialog_button_extend btn btn-secondary">
|
<button type="button" class="dialog_button_extend btn btn-secondary">
|
||||||
<i class="fa fa-expand" />
|
<i class="fa fa-expand" />
|
||||||
|
|
Loading…
Reference in New Issue