Created
July 16, 2021 10:09
-
-
Save madprog/63b61d8d920b2e97036eba6bad10aa62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
odoo.define('openerp_enterprise.BootstrapDialog', function (require) { | |
'use strict'; | |
const { | |
Component, | |
hooks: { useRef }, | |
misc: { Portal }, | |
} = owl; | |
class BootstrapDialog extends Component { | |
static components = { Portal }; | |
modal = useRef("modal"); | |
mounted() { | |
super.mounted(); | |
$(this.modal.el) | |
.on("hidden.bs.modal", (event) => { | |
event.stopPropagation(); | |
this.trigger("dialog-close"); | |
}) | |
.modal("show"); | |
} | |
willUnmount() { | |
$(this.modal.el).modal("dispose"); | |
super.willUnmount(); | |
} | |
} | |
return BootstrapDialog; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<templates xml:space="preserve"> | |
<t t-name="BootstrapDialog" owl="1"> | |
<Portal target="'body'"> | |
<div class="modal fade d-block" t-ref="modal" tabindex="-1" role="dialog" aria-hidden="false" aria-labelledby=""> | |
<t t-slot="default"/> | |
</div> | |
</Portal> | |
</t> | |
</templates> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment