Skip to content

Commit

Permalink
[FIX] website: fix url picker editor dropdown
Browse files Browse the repository at this point in the history
This commit fixes 2 issues with the position of the dropdown with the
suggested links in the url picker input of the snippet options. (e.g.
redirect url input of the countdown snippet) and the one for the input
of the link editor.

1- Before this commit the dropdown went over the input while editing the
url.

2- Before this commit the position of the dropdown (when above the
input) was a little too low if there were images in the dropdown. It was
because the images are loaded after the positioning of the dropdown and
no height was defined for these images.

task-2900529

X-original-commit: 5edc915
  • Loading branch information
bvr-odoo authored and qsm-odoo committed Sep 29, 2022
1 parent bba6233 commit 5d2466c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion addons/website/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def get_suggested_link(self, needle, limit=10):
for name, url, mod in current_website.get_suggested_controllers():
if needle.lower() in name.lower() or needle.lower() in url.lower():
module_sudo = mod and request.env.ref('base.module_%s' % mod, False).sudo()
icon = mod and "<img src='%s' width='24px' class='mr-2 rounded' /> " % (module_sudo and module_sudo.icon or mod) or ''
icon = mod and "<img src='%s' width='24px' height='24px' class='mr-2 rounded' /> " % (module_sudo and module_sudo.icon or mod) or ''
suggested_controllers.append({
'value': url,
'label': '%s%s (%s)' % (icon, url, name),
Expand Down
4 changes: 2 additions & 2 deletions addons/website/static/src/js/editor/snippets.options.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ const UrlPickerUserValueWidget = InputUserValueWidget.extend({
this.inputEl.classList.add('text-left');
const options = {
position: {
collision: 'flip fit',
collision: 'flip flipfit',
},
classes: {
"ui-autocomplete": 'o_website_ui_autocomplete'
},
}
};
wUtils.autocompleteWithPages(this, $(this.inputEl), options);
},

Expand Down
4 changes: 2 additions & 2 deletions addons/website/static/src/js/editor/widget_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ weWidgets.LinkTools.include({
var def = await this._super.apply(this, arguments);
const options = {
position: {
collision: 'flip fit',
collision: 'flip flipfit',
},
classes: {
"ui-autocomplete": 'o_website_ui_autocomplete'
},
}
};
wUtils.autocompleteWithPages(this, this.$('input[name="url"]'), options);
this._adaptPageAnchor();
return def;
Expand Down

0 comments on commit 5d2466c

Please sign in to comment.