Skip to content

Commit

Permalink
[IMP] Website: Leave Create Screen
Browse files Browse the repository at this point in the history
The purpose of this commit is to hide the Create menu when the user click on any area other than the link icons.

TaskID: 1860196
PR: #25389
  • Loading branch information
sjo-odoo committed Jun 21, 2018
1 parent 9cc4c45 commit 67c2f0a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/website/static/src/js/menu/new_content.js
Expand Up @@ -15,6 +15,7 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
}),
events: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.prototype.events || {}, {
'click > a': '_onMenuToggleClick',
'click #o_new_content_menu_choices, #o_new_content_menu_choices > ul, #o_new_content_menu_choices > ul >li': '_onBackgroundClick',
}),

/**
Expand Down Expand Up @@ -73,6 +74,16 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
ev.preventDefault();
this.$newContentMenuChoices.toggleClass('o_hidden');
},
/**
* When clicked on area other than the icon link it hides the Create Screen
* @private
* @param {Event} ev
*/
_onBackgroundClick: function (ev) {
if (ev.target === ev.currentTarget) {
this.$newContentMenuChoices.toggleClass('o_hidden');
}
},
});

websiteNavbarData.websiteNavbarRegistry.add(NewContentMenu, '.o_new_content_menu');
Expand Down

0 comments on commit 67c2f0a

Please sign in to comment.