[FIX] website: new content links not triggered
Clicking outside the new content options should close the overlay. Every options are triggering a JS event (mostly opening a modal) that works fine. But the 'New Job offer' options is simply a href link which is not going through anymore since there was a call to `preventDefault`. opw-1860196
This commit is contained in:
@@ -14,7 +14,8 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
|
||||
new_page: '_createNewPage',
|
||||
}),
|
||||
events: _.extend({}, websiteNavbarData.WebsiteNavbarActionWidget.prototype.events || {}, {
|
||||
'click > a, #o_new_content_menu_choices': '_onMenuToggleClick',
|
||||
'click > a': '_onMenuToggleClick',
|
||||
'click > #o_new_content_menu_choices': '_onBackgroundClick',
|
||||
}),
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,6 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
|
||||
|
||||
/**
|
||||
* Called when the menu's toggle button is clicked -> Opens the menu.
|
||||
* Or when there is a click outside the menu's options -> Closes the menu
|
||||
*
|
||||
* @private
|
||||
* @param {Event} ev
|
||||
@@ -74,6 +74,15 @@ var NewContentMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
|
||||
ev.preventDefault();
|
||||
this.$newContentMenuChoices.toggleClass('o_hidden');
|
||||
},
|
||||
/**
|
||||
* Called when a click outside the menu's options occurs -> Closes the menu
|
||||
*
|
||||
* @private
|
||||
* @param {Event} ev
|
||||
*/
|
||||
_onBackgroundClick: function (ev) {
|
||||
this.$newContentMenuChoices.addClass('o_hidden');
|
||||
},
|
||||
});
|
||||
|
||||
websiteNavbarData.websiteNavbarRegistry.add(NewContentMenu, '.o_new_content_menu');
|
||||
|
||||
Reference in New Issue
Block a user