[FIX] web_tour, website{_*}: not consume non-displayed tour steps
website{_*}: website, website_blog, website_sale, website_slides
Before this commit if several steps were referencing the same trigger
(e.g. "+New" button in website) only one was displayed, but all were
consumed when it was clicked.
Because of this the tour steps on "+New" were active even when its menu
was opened.
After this commit only the displayed step gets consumed if the step is
marked as 'consumeVisibleOnly: true'.
It cannot be done implictly on all steps because of [1].
This new marker is set on all steps referencing "+New".
The tour steps on "+New" now also require their menu to not be opened.
[1]: https://github.com/odoo/odoo/commit/5e888f8a6ccf9996b3231db6bf314d045619109e
task-2728994 (was task-2675252)
X-original-commit: 0fa40e37e596798665a098ee999f49749b6012a2
Part-of: odoo/odoo#83692
This commit is contained in:
@@ -179,6 +179,17 @@ var Tip = Widget.extend({
|
||||
this._updatePosition(true);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @return {boolean} true if tip is visible
|
||||
*/
|
||||
isShown() {
|
||||
return this.el && !this.info.hidden;
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -439,6 +450,10 @@ var Tip = Widget.extend({
|
||||
}
|
||||
$consumeEventAnchors.on(consumeEvent + ".anchor", (function (e) {
|
||||
if (e.type !== "mousedown" || e.which === 1) { // only left click
|
||||
if (this.info.consumeVisibleOnly && !this.isShown()) {
|
||||
// Do not consume non-displayed tips.
|
||||
return;
|
||||
}
|
||||
this.trigger("tip_consumed");
|
||||
this._unbind_anchor_events();
|
||||
}
|
||||
|
||||
@@ -38,8 +38,9 @@ tour.register('rte_translator', {
|
||||
extra_trigger: 'html[lang*="pa-GB"]',
|
||||
}, {
|
||||
content: "Open new page menu",
|
||||
trigger: '#new-content-menu > a',
|
||||
trigger: "body:has(#o_new_content_menu_choices.o_hidden) #new-content-menu > a",
|
||||
extra_trigger: 'a[data-action="edit"]',
|
||||
consumeVisibleOnly: true,
|
||||
}, {
|
||||
content: "click on new page",
|
||||
trigger: 'a[data-action="new_page"]',
|
||||
|
||||
@@ -8,10 +8,10 @@ odoo.define("website_blog.tour", function (require) {
|
||||
tour.register("blog", {
|
||||
url: "/",
|
||||
}, [{
|
||||
trigger: '#new-content-menu > a',
|
||||
trigger: "body:has(#o_new_content_menu_choices.o_hidden) #new-content-menu > a",
|
||||
content: _t("Click here to add new content to your website."),
|
||||
consumeVisibleOnly: true,
|
||||
position: 'bottom',
|
||||
|
||||
}, {
|
||||
trigger: "a[data-action=new_blog_post]",
|
||||
content: _t("Select this menu item to create a new blog post."),
|
||||
|
||||
@@ -7,9 +7,10 @@ odoo.define("website_sale.tour_shop", function (require) {
|
||||
// return the steps, used for backend and frontend
|
||||
|
||||
return [{
|
||||
trigger: "#new-content-menu > a",
|
||||
trigger: "body:has(#o_new_content_menu_choices.o_hidden) #new-content-menu > a",
|
||||
content: _t("Let's create your first product."),
|
||||
extra_trigger: ".js_sale",
|
||||
consumeVisibleOnly: true,
|
||||
position: "bottom",
|
||||
}, {
|
||||
trigger: "a[data-action=new_product]",
|
||||
|
||||
@@ -8,8 +8,9 @@ var tour = require('web_tour.tour');
|
||||
tour.register('slides_tour', {
|
||||
url: '/slides',
|
||||
}, [{
|
||||
trigger: '#new-content-menu > a',
|
||||
trigger: "body:has(#o_new_content_menu_choices.o_hidden) #new-content-menu > a",
|
||||
content: Markup(_t("Welcome on your course's home page. It's still empty for now. Click on \"<b>New</b>\" to write your first course.")),
|
||||
consumeVisibleOnly: true,
|
||||
position: 'bottom',
|
||||
}, {
|
||||
trigger: 'a[data-action="new_slide_channel"]',
|
||||
|
||||
Reference in New Issue
Block a user