summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorwan <wan@odoo.com>2020-09-04 13:58:43 +0000
committerwan <wan@odoo.com>2020-09-10 14:52:46 +0000
commit1e4690a6b70f710c502a5b623f511cec94375169 (patch)
tree093472f8c42b34cc846e6e20161d681b03d6ef87 /addons
parent3227490e270a1f5b98ef7811edca59e9aa1b6b55 (diff)
[IMP] web_tour: rainbowManMessage as a function
Task 2327599 In some cases, we want a function to evaluate the string shown by the rainbow man. For instance, if the message should depend on the state of other tours.
Diffstat (limited to 'addons')
-rw-r--r--addons/web_tour/static/src/js/tour_manager.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js
index aae5c85bf38..06fb3d6ffcf 100644
--- a/addons/web_tour/static/src/js/tour_manager.js
+++ b/addons/web_tour/static/src/js/tour_manager.js
@@ -60,6 +60,9 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
* sequence will be executed in a non deterministic order).
* @param {Promise} [options.wait_for]
* indicates when the tour can be started
+ * @param {string|function} [options.rainbowManMessage]
+ text or function returning the text displayed under the rainbowman
+ at the end of the tour.
* @param {Object[]} steps - steps' descriptions, each step being an object
* containing a tip description
*/
@@ -391,8 +394,12 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
//display rainbow at the end of any tour
if (this.tours[tour_name].rainbowMan && this.running_tour !== tour_name &&
this.tours[tour_name].current_step === this.tours[tour_name].steps.length) {
- const message = this.tours[tour_name].rainbowManMessage ||
- _t('<strong><b>Good job!</b> You went through all steps of this tour.</strong>');
+ let message = this.tours[tour_name].rainbowManMessage;
+ if (message) {
+ message = typeof message === 'function' ? message() : message;
+ } else {
+ message = _t('<strong><b>Good job!</b> You went through all steps of this tour.</strong>');
+ }
new RainbowMan({message}).appendTo(this.$body);
}
this.tours[tour_name].current_step = 0;