mirror of https://github.com/OCA/web.git
[FIX] web_responsive: AppDrawer in Chromium
parent
2190779e6e
commit
461ba3156c
|
@ -218,7 +218,6 @@
|
||||||
.o-app-icon {
|
.o-app-icon {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 7rem;
|
max-width: 7rem;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search input for menus
|
// Search input for menus
|
||||||
|
|
|
@ -74,6 +74,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
events: _.extend({
|
events: _.extend({
|
||||||
"keydown .search-input input": "_searchResultsNavigate",
|
"keydown .search-input input": "_searchResultsNavigate",
|
||||||
"input .search-input input": "_searchMenusSchedule",
|
"input .search-input input": "_searchMenusSchedule",
|
||||||
|
"click .search-input input": "_searchMenusClicked",
|
||||||
"click .o-menu-search-result": "_searchResultChosen",
|
"click .o-menu-search-result": "_searchResultChosen",
|
||||||
"shown.bs.dropdown": "_searchFocus",
|
"shown.bs.dropdown": "_searchFocus",
|
||||||
"hidden.bs.dropdown": "_searchReset",
|
"hidden.bs.dropdown": "_searchReset",
|
||||||
|
@ -195,6 +196,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
*/
|
*/
|
||||||
_searchResultChosen: function (event) {
|
_searchResultChosen: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
var $result = $(event.currentTarget),
|
var $result = $(event.currentTarget),
|
||||||
text = $result.text().trim(),
|
text = $result.text().trim(),
|
||||||
data = $result.data(),
|
data = $result.data(),
|
||||||
|
@ -211,6 +213,13 @@ odoo.define('web_responsive', function (require) {
|
||||||
});
|
});
|
||||||
// Update navbar menus
|
// Update navbar menus
|
||||||
core.bus.trigger("change_menu_section", app.menuID);
|
core.bus.trigger("change_menu_section", app.menuID);
|
||||||
|
|
||||||
|
// Prevents anim more app-icon if user click other before action
|
||||||
|
// is fully loaded
|
||||||
|
this.$el.find('.o-menu-item-waiting').removeClass(
|
||||||
|
'o-menu-item-waiting');
|
||||||
|
$(event.currentTarget).addClass('o-menu-item-waiting');
|
||||||
|
$(document.body).addClass('o-cursor-waiting');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -266,6 +275,11 @@ odoo.define('web_responsive', function (require) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Prevent hide AppDrawer
|
||||||
|
_searchMenusClicked: function (ev) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
},
|
||||||
|
|
||||||
// Load view indicator
|
// Load view indicator
|
||||||
_onAppsMenuItemClicked: function (ev) {
|
_onAppsMenuItemClicked: function (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -408,54 +422,79 @@ odoo.define('web_responsive', function (require) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide AppMenu & remove waiting anim when loaded action
|
// Hide AppDrawer or Menu and remove waiting anim when loaded action
|
||||||
ActionManager.include({
|
ActionManager.include({
|
||||||
|
wc_long_running_timer: false,
|
||||||
doAction: function (action, options) {
|
doAction: function (action, options) {
|
||||||
|
var self = this;
|
||||||
return this._super.apply(this, arguments).always(function () {
|
return this._super.apply(this, arguments).always(function () {
|
||||||
if (options && 'action_menu_id' in options) {
|
var removeWaitingCursor = function () {
|
||||||
// Need hide AppMenu?
|
clearTimeout(self.wc_long_running_timer);
|
||||||
var $app_menu = $('.o_menu_apps .dropdown');
|
self.wc_long_running_timer = false;
|
||||||
if (!$app_menu.length) {
|
$(document.body).removeClass('o-cursor-waiting');
|
||||||
return;
|
};
|
||||||
|
|
||||||
|
var $app_menu = $('.o_menu_apps .dropdown.show');
|
||||||
|
var closeAppDrawer = function ($elm, classname) {
|
||||||
|
$elm.removeClass(classname);
|
||||||
|
removeWaitingCursor();
|
||||||
|
// Now uses this way because Odoo 12.0 uses
|
||||||
|
// bootstrap 4.1
|
||||||
|
// TODO: Change to use "hide" method in modern
|
||||||
|
// bootstrap versions (>4.1)
|
||||||
|
if ($app_menu.hasClass('show')) {
|
||||||
|
$app_menu.dropdown('toggle');
|
||||||
}
|
}
|
||||||
var $app = $app_menu.find('.o_app.active');
|
};
|
||||||
var app_menu_id = $app.data('menuId');
|
|
||||||
if (app_menu_id === options.action_menu_id) {
|
// Fallback, ~3secs appears the BlockUI
|
||||||
// Now uses this way because Odoo 12.0 uses
|
if (!self.wc_long_running_timer) {
|
||||||
// bootstrap 4.1
|
self.wc_long_running_timer = setTimeout(function () {
|
||||||
// TODO: Change to use "hide" method in modern
|
removeWaitingCursor();
|
||||||
// bootstrap versions (>4.1)
|
}, 3000);
|
||||||
if ($app_menu.hasClass('show')) {
|
}
|
||||||
$app_menu.dropdown('toggle');
|
|
||||||
|
// Need hide AppMenu? (AppDrawer)
|
||||||
|
if ($app_menu.length) {
|
||||||
|
if (options && 'action_menu_id' in options) {
|
||||||
|
// App Icon
|
||||||
|
var $item_app = $app_menu.find('.o_app.active');
|
||||||
|
if ($item_app.length) {
|
||||||
|
var app_menu_id = $item_app.data('menuId');
|
||||||
|
if (app_menu_id === options.action_menu_id) {
|
||||||
|
closeAppDrawer($item_app, 'o-app-waiting');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Menu Search
|
||||||
|
var $item = $app_menu.find('.o-menu-item-waiting');
|
||||||
|
if ($item.length) {
|
||||||
|
var action_id = $item.data('actionId');
|
||||||
|
if (action_id === action.id) {
|
||||||
|
closeAppDrawer($item, 'o-menu-item-waiting');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document.body).removeClass('o-cursor-waiting');
|
|
||||||
$app_menu.find('.o-app-waiting').removeClass(
|
|
||||||
'o-app-waiting');
|
|
||||||
}
|
}
|
||||||
} else if (action) {
|
}
|
||||||
// Need hide Menu?
|
|
||||||
var $menu = $('.o_menu_sections');
|
// Need hide Menu?
|
||||||
if (!$menu.length) {
|
var $menu = $('.o_menu_sections');
|
||||||
|
if ($menu.length) {
|
||||||
|
var $item_menu = $menu.find('.o-menu-item-waiting');
|
||||||
|
if (!$item_menu.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var $item = $menu.find('.o-menu-item-waiting');
|
var item_action_id = $item_menu.data('actionId');
|
||||||
if (!$item.length) {
|
if (item_action_id === action.id) {
|
||||||
return;
|
$item_menu.removeClass('o-menu-item-waiting');
|
||||||
}
|
removeWaitingCursor();
|
||||||
var action_id = $item.data('actionId');
|
|
||||||
if (action_id === action.id) {
|
|
||||||
$item.removeClass('o-menu-item-waiting');
|
|
||||||
|
|
||||||
$menu.find('li.show').each(
|
$menu.find('li.show').each(
|
||||||
function (i, el) {
|
function (i, el) {
|
||||||
if ($.contains(el, $item[0])) {
|
if ($.contains(el, $item_menu[0])) {
|
||||||
$(el).find('.dropdown-toggle')
|
$(el).find('.dropdown-toggle')
|
||||||
.dropdown('toggle');
|
.dropdown('toggle');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document.body).removeClass('o-cursor-waiting');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue