[FIX] website_slides: de-raw-ify
Convert `embed_code` to a computed HTML field so it's considered markup-safe. It needs to be sanitize=False because we're putting <iframe> elements in it. Those get stripped by sanitize.
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
<!-- CONTENT -->
|
<!-- CONTENT -->
|
||||||
<tr>
|
<tr>
|
||||||
<td style="min-width: 590px;">
|
<td style="min-width: 590px;">
|
||||||
<t t-raw="message.body"/>
|
<t t-out="message.body"/>
|
||||||
<div style="margin: 32px 0px 32px 0px; text-align: center;">
|
<div style="margin: 32px 0px 32px 0px; text-align: center;">
|
||||||
<a t-att-href="record.channel_id.website_url"
|
<a t-att-href="record.channel_id.website_url"
|
||||||
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
|
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>&nbsp;</div>
|
<div>&nbsp;</div>
|
||||||
<div t-if="signature" style="font-size: 13px;">
|
<div t-if="signature" style="font-size: 13px;">
|
||||||
<div t-raw="signature"/>
|
<div t-out="signature"/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class Slide(models.Model):
|
|||||||
likes = fields.Integer('Likes', compute='_compute_user_info', store=True, compute_sudo=False)
|
likes = fields.Integer('Likes', compute='_compute_user_info', store=True, compute_sudo=False)
|
||||||
dislikes = fields.Integer('Dislikes', compute='_compute_user_info', store=True, compute_sudo=False)
|
dislikes = fields.Integer('Dislikes', compute='_compute_user_info', store=True, compute_sudo=False)
|
||||||
user_vote = fields.Integer('User vote', compute='_compute_user_info', compute_sudo=False)
|
user_vote = fields.Integer('User vote', compute='_compute_user_info', compute_sudo=False)
|
||||||
embed_code = fields.Text('Embed Code', readonly=True, compute='_compute_embed_code')
|
embed_code = fields.Html('Embed Code', readonly=True, compute='_compute_embed_code', sanitize=False)
|
||||||
# views
|
# views
|
||||||
embedcount_ids = fields.One2many('slide.embed', 'slide_id', string="Embed Count")
|
embedcount_ids = fields.One2many('slide.embed', 'slide_id', string="Embed Count")
|
||||||
slide_views = fields.Integer('# of Website Views', store=True, compute="_compute_slide_views")
|
slide_views = fields.Integer('# of Website Views', store=True, compute="_compute_slide_views")
|
||||||
|
|||||||
@@ -258,10 +258,10 @@
|
|||||||
<img t-if="slide.slide_type == 'infographic'"
|
<img t-if="slide.slide_type == 'infographic'"
|
||||||
t-att-src="website.image_url(slide, 'image_1024')" class="img-fluid" style="width:100%" t-att-alt="slide.name"/>
|
t-att-src="website.image_url(slide, 'image_1024')" class="img-fluid" style="width:100%" t-att-alt="slide.name"/>
|
||||||
<div t-if="slide.slide_type in ('presentation', 'document')" class="embed-responsive embed-responsive-4by3 embed-responsive-item mb8" style="height: 600px;">
|
<div t-if="slide.slide_type in ('presentation', 'document')" class="embed-responsive embed-responsive-4by3 embed-responsive-item mb8" style="height: 600px;">
|
||||||
<t t-raw="slide.embed_code"/>
|
<t t-esc="slide.embed_code"/>
|
||||||
</div>
|
</div>
|
||||||
<div t-if="slide.slide_type == 'video' and slide.document_id" class="embed-responsive embed-responsive-16by9 embed-responsive-item mb8">
|
<div t-if="slide.slide_type == 'video' and slide.document_id" class="embed-responsive embed-responsive-16by9 embed-responsive-item mb8">
|
||||||
<t t-raw="slide.embed_code"/>
|
<t t-esc="slide.embed_code"/>
|
||||||
</div>
|
</div>
|
||||||
<div t-if="slide.slide_type == 'webpage'" class="bg-white p-3">
|
<div t-if="slide.slide_type == 'webpage'" class="bg-white p-3">
|
||||||
<div t-field="slide.html_content"/>
|
<div t-field="slide.html_content"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user