diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-10-04 19:43:42 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-10-10 15:29:31 +0000 |
| commit | a943d8a71214cdf289375f0318cd3d34e7dec3a0 (patch) | |
| tree | 1d5c4fcce9f9caec759db19ee9656c26a7ab9829 /addons/web_settings_dashboard/static/src/js/dashboard.js | |
| parent | 5822d3cbdb19288271a2b36613c44a678fa14cc1 (diff) | |
[FIX] web_settings_dashboard: load a translation
Before this commit, there was an issue when trying to load
a translation from the 'Settings' application.
- Go to 'Settings'
- Click on 'Load a translation'
> It redirects to 1st app (community) or home menu (enterprise)
This is not a big issue in enterprise, because the modal is
that let the user load a translation is still prompted.
This is however not the case in the community version.
This issue is caused by 'Load a translation' being a `<a>` with
`href='#'`. The purpose of the `href='#'` is to have the pointer
cursor on mouse hover. However, when clicking a `<a>` with `href`,
the browser changes the URL in the address bar with the content of
the `href`, which for the value `'#'` is linked to the top of the
main page. In community, this redirects to the 1st installed app
(usually 'Apps' or 'Discuss'), whereas in enterprise it redirects
to the home menu.
This commit fixes this issue by preventing the default browser
behaviour when clicking on "Load a translation", so that it does
not change the URL in the address bar.
Closes #27434
Closes #27442
Diffstat (limited to 'addons/web_settings_dashboard/static/src/js/dashboard.js')
| -rw-r--r-- | addons/web_settings_dashboard/static/src/js/dashboard.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/addons/web_settings_dashboard/static/src/js/dashboard.js b/addons/web_settings_dashboard/static/src/js/dashboard.js index 4eaf10aab53..2065769bdc0 100644 --- a/addons/web_settings_dashboard/static/src/js/dashboard.js +++ b/addons/web_settings_dashboard/static/src/js/dashboard.js @@ -346,10 +346,22 @@ var DashboardTranslations = Widget.extend({ template: 'DashboardTranslations', events: { - 'click .o_load_translations': 'on_load_translations' + 'click .o_load_translations': '_onLoadTranslations' }, - on_load_translations: function () { + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * Called when clicking on "Load a translation" button. It prompts a dialog + * to load a translation. + * + * @private + * @param {MouseEvent} ev + */ + _onLoadTranslations: function (ev) { + ev.preventDefault(); this.do_action('base.action_view_base_language_install'); } |
