[IMP] survey: reduce pages width

Reduce the survey questions page in every display mode
and the print page display to be the half screen size.
This is done to match the previous results page improvements.

Also reducing the font size of the "Thank you" message and the
print page questions and sections titles to best match the new
half screen display.

Removing the badly placed livechat from the survey main layout as
it is overlapping the survey navigation.

The current "no_livechat" variable in the survey main layout and the
user input session layout is not taken into account.
This is due to the fact that, in the "website_livechat" module, the check
for the "no_livechat" variable is performed inside the "head" tag,
so way before the "div[@id='wrapwrap']" element.
Changing the xpath so that the "no_livechat" variable is correctly defined
before the check.

related odoo/odoo#152263

Task-3789479

closes odoo/odoo#156665

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
amdi-odoo
2024-04-23 11:13:12 +00:00
parent 1a667293d5
commit 45e4850e35
3 changed files with 16 additions and 17 deletions
+9 -10
View File
@@ -3,7 +3,7 @@
<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">
<xpath expr="//head" 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>
@@ -65,7 +65,7 @@
<t t-call="survey.layout">
<t t-if="answer.test_entry" t-call="survey.survey_button_form_view" />
<div class="wrap o_survey_wrap d-flex">
<div class="container o_survey_form d-flex flex-column mb-5">
<div class="o_container_small o_survey_form d-flex flex-column mb-5">
<t t-call="survey.survey_fill_header" />
<t t-call="survey.survey_fill_form" />
</div>
@@ -186,8 +186,8 @@
t-att-data-time-limit-minutes="time_limit_minutes"/>
<t t-if="survey.questions_layout == 'one_page'">
<t t-foreach='survey.question_and_page_ids' t-as='question'>
<h2 t-if="question.is_page" t-field='question.title' class="o_survey_title pb16 text-break w-lg-50 mx-lg-auto" />
<div t-if="question.is_page" t-field='question.description' class="text-break w-lg-50 mx-lg-auto"/>
<h2 t-if="question.is_page" t-field='question.title' class="o_survey_title pb16 text-break"/>
<div t-if="question.is_page" t-field='question.description' class="text-break"/>
<t t-if="not question.is_page and question in answer.predefined_question_ids" t-call="survey.question_container"/>
</t>
@@ -201,8 +201,8 @@
</t>
<t t-if="survey.questions_layout == 'page_per_section'">
<h2 t-field='page.title' class="o_survey_title pb16 text-break w-lg-50 mx-lg-auto" />
<div t-field='page.description' class="oe_no_empty text-break w-lg-50 mx-lg-auto"/>
<h2 t-field='page.title' class="o_survey_title pb16 text-break" />
<div t-field='page.description' class="oe_no_empty text-break"/>
<input type="hidden" name="page_id" t-att-value="page.id" />
<t t-foreach='page.question_ids' t-as='question'>
@@ -228,7 +228,7 @@
An exception is made for options with images, where we always want to optimize screen space.-->
<t t-set="minimized_display" t-value="survey.questions_layout == 'page_per_question' and not any(suggestion.value_image for suggestion in question.suggested_answer_ids)" />
<div t-if="survey.questions_layout == 'page_per_question'"
t-attf-class="o_survey_page_per_question #{'w-lg-50 mx-lg-auto' if question.question_type in ('numerical_box', 'date', 'datetime') else ''}">
t-attf-class="o_survey_page_per_question">
<input type="hidden" name="question_id" t-att-value="question.id" />
<!-- User has already answered for this session -->
<t t-if="answer.is_session_answer and (has_answered or answer.question_time_limit_reached)">
@@ -272,7 +272,7 @@
<template id="survey_fill_form_done" name="Survey: finished">
<div class="wrap">
<div class="o_survey_finished mt32 mb32">
<h1>Thank you!</h1>
<h1 class="fs-2">Thank you!</h1>
<div t-field="survey.description_done" class="oe_no_empty" />
<div class="row">
<div class="col">
@@ -332,8 +332,7 @@
<t t-set="is_skipped_question" t-value="skipped_questions and question in skipped_questions"/>
<div t-attf-class="js_question-wrapper pb-4
#{'d-none' if not display_question else ''}
#{'me-2' if extra_right_margin else ''}
#{'w-lg-50 mx-lg-auto' if survey.questions_layout != 'page_per_question' else ''}"
#{'me-2' if extra_right_margin else ''}"
t-att-id="question.id"
t-att-data-required="bool(question.constr_mandatory and (not survey.users_can_go_back or survey.questions_layout == 'one_page')) or None"
t-att-data-constr-error-msg="question.constr_error_msg or default_constr_error_msg if question.constr_mandatory else None"
@@ -7,7 +7,7 @@
<t t-set="survey_form_readonly" t-value="true"/>
<t t-if="answer.test_entry" t-call="survey.survey_button_form_view" />
<div class="wrap">
<div class="o_survey_print container">
<div class="o_survey_print o_container_small">
<div class='py-5 mt32'>
<h1><span t-field='survey.title' class="text-break"/></h1>
<t t-if="survey.description"><div t-field='survey.description' class="oe_no_empty text-break"/></t>
@@ -25,7 +25,7 @@
<canvas id="doughnut_chart"></canvas>
</div>
</div>
<div class="w-lg-50 mx-lg-auto">
<div>
<fieldset disabled="disabled">
<t t-set="question" t-value="False" />
<t t-foreach='survey.question_and_page_ids' t-as='question'>
@@ -34,14 +34,14 @@
or not is_html_empty(question.description))">
<hr t-if="question != survey.page_ids[0]" />
<div class="o_page_header mb-5">
<h1 t-field='question.title' class="text-break" />
<h1 t-field='question.title' class="text-break fs-2" />
<div t-if="question.description" t-field='question.description' class="oe_no_empty"/>
</div>
</t>
<t t-if="not question.is_page and not answer or (question in answer.predefined_question_ids &amp; questions_to_display)" >
<t t-set="answer_lines" t-value="answer.user_input_line_ids.filtered(lambda line: line.question_id == question)"/>
<div class="js_question-wrapper" t-att-id="question.id">
<h2>
<h2 class="fs-4">
<span t-field='question.title' class="text-break"/>
<span t-if="question.constr_mandatory" class="text-danger">*</span>
<span t-if="scoring_display_correction" class="badge rounded-pill" t-att-data-score-question="question.id"></span>
@@ -2,7 +2,7 @@
<odoo>
<data>
<template id="user_input_session" name="Survey User Input Session" inherit_id="web.frontend_layout" primary="True">
<xpath expr="//div[@id='wrapwrap']" position="before">
<xpath expr="//head/*[1]" 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>
@@ -107,9 +107,9 @@
</div>
</div>
</div>
<div class="container px-4 pb-3 pt96 d-flex flex-column o_survey_session_manage_container">
<div class="o_container_small px-4 pb-3 pt96 d-flex flex-column o_survey_session_manage_container">
<div class="o_survey_session_description_done d-none">
<h1>Thank you!</h1>
<h1 class="fs-2">Thank you!</h1>
<div t-field="survey.description_done"/>
</div>
<a role="button"