[FIX] web_tour: restore rainbowMan for tours
Bugs introduced with commit https://github.com/odoo/odoo/commit/08e92204b661086b27a2d435d3ca06436540c0e0 - The new `rainbowMan` option was always `true` - When checking the option, it was looked in the wrong object so it was always considered false (so no more rainbowMan at all...) Also deactivate the rainbowMan for the automatic tours. Also refactor the method's documentation.
This commit is contained in:
@@ -170,14 +170,21 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
|
|||||||
console.log('Tour Manager is ready. running_tour=' + this.running_tour);
|
console.log('Tour Manager is ready. running_tour=' + this.running_tour);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Registers a tour described by the following arguments (in order)
|
* Registers a tour described by the following arguments *in order*
|
||||||
* @param [String] tour's name
|
*
|
||||||
* @param [Object] dict of options (optional), available options are:
|
* @param {string} name - tour's name
|
||||||
* test [Boolean] true if the tour is dedicated to tests (it won't be enabled by default)
|
* @param {Object} [options] - options (optional), available options are:
|
||||||
* skip_enabled [Boolean] true to add a link to consume the whole tour in its tips
|
* @param {boolean} [options.test=false] - true if this is only for tests
|
||||||
* url [String] the url to load when manually running the tour
|
* @param {boolean} [options.skip_enabled=false]
|
||||||
* rainbowMan [Bool] use to display the rainbow effect at the end of tour
|
* true to add a link in its tips to consume the whole tour
|
||||||
* @param [Array] dict of steps, each step being a dict containing a tip description
|
* @param {string} [options.url]
|
||||||
|
* the url to load when manually running the tour
|
||||||
|
* @param {boolean} [options.rainbowMan=true]
|
||||||
|
* whether or not the rainbowman must be shown at the end of the tour
|
||||||
|
* @param {Deferred} [options.wait_for]
|
||||||
|
* indicates when the tour can be started
|
||||||
|
* @param {Object[]} steps - steps' descriptions, each step being an object
|
||||||
|
* containing a tip description
|
||||||
*/
|
*/
|
||||||
register: function() {
|
register: function() {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
@@ -193,7 +200,7 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
|
|||||||
name: name,
|
name: name,
|
||||||
steps: steps,
|
steps: steps,
|
||||||
url: options.url,
|
url: options.url,
|
||||||
rainbowMan: options.rainbowMan || true,
|
rainbowMan: options.rainbowMan === undefined ? true : !!options.rainbowMan,
|
||||||
test: options.test,
|
test: options.test,
|
||||||
wait_for: options.wait_for || $.when(),
|
wait_for: options.wait_for || $.when(),
|
||||||
};
|
};
|
||||||
@@ -402,13 +409,14 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
|
|||||||
_consume_tour: function (tour_name, error) {
|
_consume_tour: function (tour_name, error) {
|
||||||
delete this.active_tooltips[tour_name];
|
delete this.active_tooltips[tour_name];
|
||||||
//display rainbow at the end of any tour
|
//display rainbow at the end of any tour
|
||||||
if (this.rainbowMan && this.tours[tour_name].current_step === this.tours[tour_name].steps.length){
|
if (this.tours[tour_name].rainbowMan && this.running_tour !== tour_name
|
||||||
|
&& this.tours[tour_name].current_step === this.tours[tour_name].steps.length) {
|
||||||
var $rainbow_message = $('<strong>' +
|
var $rainbow_message = $('<strong>' +
|
||||||
'<b>Good job!</b>' +
|
'<b>Good job!</b>' +
|
||||||
' You went through all steps of this tour.' +
|
' You went through all steps of this tour.' +
|
||||||
'</strong>');
|
'</strong>');
|
||||||
new RainbowMan({message: $rainbow_message, click_close: false}).appendTo(this.$body);
|
new RainbowMan({message: $rainbow_message, click_close: false}).appendTo(this.$body);
|
||||||
};
|
}
|
||||||
this.tours[tour_name].current_step = 0;
|
this.tours[tour_name].current_step = 0;
|
||||||
local_storage.removeItem(get_step_key(tour_name));
|
local_storage.removeItem(get_step_key(tour_name));
|
||||||
if (this.running_tour === tour_name) {
|
if (this.running_tour === tour_name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user