[FIX] website_event_exhibitor: de-traw-ify

Remove t-raw and mark website_description as markup-safe right after
fetching it.

Also update `_fetchSponsor` to use async/await, and remove seemingly
unnecessary empty div in template, and convert `<span>` to `<div>` as
the contents is arbitrary and thus could be a block.
This commit is contained in:
Xavier Morel
2021-07-20 05:47:27 +00:00
parent f7b1d02c16
commit 22904af1f8
2 changed files with 7 additions and 13 deletions
@@ -3,6 +3,7 @@ odoo.define('website_event_exhibitor.event_exhibitor_connect', function (require
var Dialog = require('web.Dialog');
var publicWidget = require('web.public.widget');
const {Markup} = require('web.utils');
var ExhibitorConnectClosedDialog = Dialog.extend({
events: _.extend({}, Dialog.prototype.events, {
@@ -44,18 +45,13 @@ var ExhibitorConnectClosedDialog = Dialog.extend({
/**
* @private
* @returns {Promise<*>} promise after fetching sponsor data, given its
* sponsorId. Necessary to render template content;
*/
_fetchSponsor: function () {
let self = this;
let rpcPromise = this._rpc({
route: `/event_sponsor/${this.sponsorId}/read`,
}).then(function (readData) {
self.sponsorData = readData;
return Promise.resolve();
async _fetchSponsor() {
const sponsorData = await this._rpc({
route: `/event_sponsor/${this.sponsorId}/read`
});
return rpcPromise;
sponsorData.website_description = Markup(sponsorData.website_description);
this.sponsorData = sponsorData;
},
});
@@ -67,9 +67,7 @@
t-att-alt="widget.sponsorData.country_name"/>
</div>
</div>
<span class="col-12" t-if="widget.sponsorData.website_description" t-raw="widget.sponsorData.website_description"/>
</div>
<div>
<div class="col-12" t-if="widget.sponsorData.website_description" t-out="widget.sponsorData.website_description"/>
</div>
</div>
</t>