[FIX] im_livechat: de-traw-ify
Mark computed field as Html (might not even be necessary as it's computed by rendering a template but... can't hurt?) Also update the template to use attf, seems dumb to format by hand.
This commit is contained in:
@@ -43,7 +43,7 @@ class ImLivechatChannel(models.Model):
|
||||
help="URL to a static page where you client can discuss with the operator of the channel.")
|
||||
are_you_inside = fields.Boolean(string='Are you inside the matrix?',
|
||||
compute='_are_you_inside', store=False, readonly=True)
|
||||
script_external = fields.Text('Script (external)', compute='_compute_script_external', store=False, readonly=True)
|
||||
script_external = fields.Html('Script (external)', compute='_compute_script_external', store=False, readonly=True, sanitize=False)
|
||||
nbr_channel = fields.Integer('Number of conversation', compute='_compute_nbr_channel', store=False, readonly=True)
|
||||
|
||||
image_128 = fields.Image("Image", max_width=128, max_height=128, default=_default_image)
|
||||
@@ -58,7 +58,7 @@ class ImLivechatChannel(models.Model):
|
||||
channel.are_you_inside = bool(self.env.uid in [u.id for u in channel.user_ids])
|
||||
|
||||
def _compute_script_external(self):
|
||||
view = self.env['ir.model.data'].get_object('im_livechat', 'external_loader')
|
||||
view = self.env.ref('im_livechat.external_loader')
|
||||
values = {
|
||||
"url": self.env['ir.config_parameter'].sudo().get_param('web.base.url'),
|
||||
"dbname": self._cr.dbname,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<title><t t-esc="channel_name"/> Livechat Support Page</title>
|
||||
|
||||
<!-- Call the external Bundle to render the css, js, and js loader tags -->
|
||||
<t t-raw="channel.script_external"/>
|
||||
<t t-out="channel.script_external"/>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
@@ -80,11 +80,11 @@
|
||||
-->
|
||||
<template id="external_loader" name="Livechat : external_script field of livechat channel">
|
||||
<!-- css style -->
|
||||
<link t-att-href="'%s/im_livechat/external_lib.css' % (url)" rel="stylesheet"/>
|
||||
<link t-attf-href="{{url}}/im_livechat/external_lib.css" rel="stylesheet"/>
|
||||
<!-- js of all the required lib (internal and external) -->
|
||||
<script t-att-src="'%s/im_livechat/external_lib.js' % (url)" type="text/javascript" />
|
||||
<script t-attf-src="{{url}}/im_livechat/external_lib.js" type="text/javascript" />
|
||||
<!-- the loader -->
|
||||
<script t-att-src="'%s/im_livechat/loader/%i' % (url, channel_id)" type="text/javascript"/>
|
||||
<script t-attf-src="{{url}}/im_livechat/loader/{{channel_id}}" type="text/javascript"/>
|
||||
</template>
|
||||
|
||||
<!-- the js code to initialize the LiveSupport object -->
|
||||
|
||||
Reference in New Issue
Block a user