[IMP] survey, website_livechat: hide livechat in survey layout

Purpose
=======

Lighten the survey layout. Livechat button should not appear on survey pages.

Specifications
==============

Survey Layout inherits from web.frontend_layout, mainly to be able to use all
the styles rules defined in it and keep consistency between other frontend
pages and survey.

To avoid having the livechat button displayed on survey layout, 'no_livechat'
template variable has been introduced. The livechat button will be displayed
on all layout inheriting from frontend_layout (that is extended in
website_livechat to add that livechat button) only if 'no_livechat'
is False. By default, this variable is not set so will be considered as False.
In survey layout, no_livechat is set to True.

Links
=====

Task ID: 2195185
PR #45112
This commit is contained in:
David Beguin
2020-02-13 15:29:00 +00:00
parent 732cb7c254
commit f9d34ec711
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -3,6 +3,10 @@
<data>
<!-- Main survey layout -->
<template id="survey.layout" name="Survey Layout" inherit_id="web.frontend_layout" primary="True">
<xpath expr="//div[@id='wrapwrap']" position="before">
<!--TODO DBE Fix me : If one day, there is a survey_livechat bridge module, put this in that module-->
<t t-set="no_livechat" t-value="True"/>
</xpath>
<xpath expr="//div[@id='wrapwrap']" position="attributes">
<attribute name="t-att-style" add="('height: 100%; overflow: auto; background: url(' + '/survey/get_background_image/%s/%s' % (survey.access_token, answer.access_token) + ') no-repeat fixed center; box-shadow: inset 0 0 0 10000px rgba(255,255,255,.7); background-size: cover;') if survey and survey.background_image and answer else 'height: 100%; overflow: auto;'"/>
</xpath>
@@ -53,7 +53,7 @@
<template id="loader" inherit_id="website.layout" name="Livechat : include loader on Website">
<xpath expr="//div[@id='wrapwrap']" position="after">
<t t-if="website and website.channel_id">
<t t-if="website and website.channel_id and not no_livechat">
<script>
<t t-call="im_livechat.loader">
<t t-set="info" t-value="website.get_livechat_channel_info()"/>