[FIX] website: set URL when picking from drop-down menu
Steps: - In website, click on a link to edit it - Type "/" in the LinkTools URL input field - Pick a URL among the suggested ones The chosen URL was supposed to be applied to the link, but it is not. The same applies for the LinkDialog (create a link with the "/link" command). Reason: It might be a little confusing, but the `_onURLInput` method actually means "update UI according to the URL" (more specifically, display/hide the "Open In New Window" and "Autoconvert To Relative Link" buttons). The `__onURLInput` (two underscores) method, on the other hand, is the actual handler for input events in the URL field. In this case, picking a URL from a drop-down menu needs the same treatment as inputting text, that is, the `state.url` property must be set to the new value. task-3552700 closes odoo/odoo#140061 Signed-off-by: Antoine Guenet (age) <age@odoo.com>
This commit is contained in:
@@ -18,6 +18,7 @@ patch(LinkDialog.prototype, {
|
||||
async start() {
|
||||
const options = {
|
||||
body: this.$link && this.$link[0].ownerDocument.body,
|
||||
urlChosen: () => this.__onURLInput(),
|
||||
};
|
||||
const result = await super.start(...arguments);
|
||||
wUtils.autocompleteWithPages(this.rpc.bind(this), this.$el.find('input[name="url"]'), options);
|
||||
|
||||
@@ -94,7 +94,7 @@ patch(LinkTools.prototype, {
|
||||
* @private
|
||||
*/
|
||||
_onAutocompleteClose() {
|
||||
this._onURLInput();
|
||||
this.__onURLInput();
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
|
||||
@@ -289,10 +289,25 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
|
||||
throw new Error("Tour step failed");
|
||||
}
|
||||
}
|
||||
},
|
||||
// 10.Pick a URL with auto-complete
|
||||
{
|
||||
content: "Enter partial URL",
|
||||
trigger: "#o_link_dialog_url_input",
|
||||
run: 'text /contact'
|
||||
},
|
||||
{
|
||||
content: "Pick '/contactus",
|
||||
trigger: "ul.ui-autocomplete li div:contains('/contactus (Contact Us)')",
|
||||
},
|
||||
{
|
||||
content: "Check that links's href and label were updated",
|
||||
trigger: "iframe .s_text_image p a[href='/contactus']:contains('/contactus')",
|
||||
run: () => null,
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
// 10. Add mega menu with Cards template and edit URL on text-selected card.
|
||||
// 11. Add mega menu with Cards template and edit URL on text-selected card.
|
||||
wTourUtils.clickOnElement("menu link", "iframe header .nav-item a"),
|
||||
wTourUtils.clickOnElement("'Edit menu' icon", "iframe .o_edit_menu_popover .fa-sitemap"),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user