[IMP] survey: implement a tour

PURPOSE:

This commit adds a tour that is started when the survey module is
installed, and makes small changes to be able to implement the tour.

SPECS

-Implementation of the tour:
The tour suggests to the user to try and test a sample survey, and shows how
to check the results gathered for this survey.

-Changed the target of the "test" button to "self":
Since the test action is used during the tour, the test page needs to be opened
in the same tab so that the tour can continue.

Task-2794884

Part-of: odoo/odoo#87326
This commit is contained in:
Adrien Schoffeniels
2022-08-17 19:47:59 +02:00
parent 24e8e3adc3
commit 34c98e999d
4 changed files with 66 additions and 2 deletions
+3
View File
@@ -99,6 +99,9 @@ sent mails with personal token for the invitation of the survey.
'web.assets_tests': [
'survey/static/tests/**/*',
],
'web.assets_common': [
'survey/static/src/js/tours/survey_tour.js',
]
},
'license': 'LGPL-3',
}
+1 -1
View File
@@ -953,7 +953,7 @@ class Survey(models.Model):
return {
'type': 'ir.actions.act_url',
'name': "Test Survey",
'target': 'new',
'target': 'self',
'url': '/survey/test/%s' % self.access_token,
}
@@ -0,0 +1,61 @@
/** @odoo-module */
import { _t } from 'web.core';
import { Markup } from 'web.utils';
import tour from 'web_tour.tour';
tour.register('survey_tour', {
url: "/web",
rainbowManMessage: _t("Congratulations! You are now ready to collect feedback like a pro :-)"),
sequence: 225,
}, [
...tour.stepUtils.goToAppSteps('survey.menu_surveys', Markup(_t("Ready to change the way you <b>gather data</b>?"))),
{
trigger: 'body:has(.o_survey_load_sample) .o_survey_sample_container',
content: Markup(_t("Load a <b>sample Survey</b> to get started quickly.")),
position: 'bottom',
}, {
trigger: 'button[name=action_test_survey]',
content: _t("Let's give it a spin!"),
position: 'bottom',
}, {
trigger: '.o_survey_start button[type=submit]',
content: _t("Let's get started!"),
position: 'bottom',
}, {
trigger: '.o_survey_simple_choice button[type=submit]',
extra_trigger: '.js_question-wrapper span:contains("How frequently")',
content: _t("Whenever you pick an answer, Odoo saves it for you."),
position: 'bottom',
}, {
trigger: '.o_survey_numerical_box button[type=submit]',
extra_trigger: '.js_question-wrapper span:contains("How many")',
content: _t("Only a single question left!"),
position: 'bottom',
}, {
trigger: '.o_survey_matrix button[value=finish]',
extra_trigger: '.js_question-wrapper span:contains("How likely")',
content: _t("Now that you are done, submit your form."),
position: 'bottom',
}, {
trigger: '.o_survey_review a',
content: _t("Let's have a look at your answers!"),
position: 'bottom',
}, {
trigger: '.alert-info a:contains("This is a Test Survey")',
content: _t("Now, use this shortcut to go back to the survey."),
position: 'bottom',
}, {
trigger: 'button[name=action_survey_user_input_completed]',
content: _t("Here, you can overview all the participations."),
position: 'bottom',
}, {
trigger: 'td[name=survey_id]',
content: _t("Let's open the survey you just submitted."),
position: 'bottom',
}, {
trigger: '.breadcrumb a:contains("Feedback Form")',
content: _t("Use the breadcrumbs to quickly go back to the dashboard."),
position: 'bottom',
}
]);
+1 -1
View File
@@ -282,7 +282,7 @@
</t>
</t>
<t t-call="survey.survey_button_retake"/>
<div t-if="survey.scoring_type != 'scoring_without_answers'">
<div t-if="survey.scoring_type != 'scoring_without_answers'" class="o_survey_review">
If you wish, you can <a t-att-href="'/survey/print/%s?answer_token=%s&amp;review=True' % (survey.access_token, answer.access_token)">review your answers</a>
</div>
</div>