mirror of https://github.com/OCA/web.git
[IMP] web_responsive: Small refactor 'isWaiting'
parent
196bb166b2
commit
b662b64a7c
|
@ -5,7 +5,7 @@
|
||||||
{
|
{
|
||||||
"name": "Web Responsive",
|
"name": "Web Responsive",
|
||||||
"summary": "Responsive web client, community-supported",
|
"summary": "Responsive web client, community-supported",
|
||||||
"version": "12.0.1.1.2",
|
"version": "12.0.1.1.3",
|
||||||
"category": "Website",
|
"category": "Website",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"author": "LasLabs, Tecnativa, Alexandre Díaz, "
|
"author": "LasLabs, Tecnativa, Alexandre Díaz, "
|
||||||
|
|
|
@ -15,6 +15,14 @@ odoo.define('web_responsive', function (require) {
|
||||||
var RelationalFields = require('web.relational_fields');
|
var RelationalFields = require('web.relational_fields');
|
||||||
var Chatter = require('mail.Chatter');
|
var Chatter = require('mail.Chatter');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function to know if are waiting
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function isWaiting () {
|
||||||
|
return $('.oe_wait').length !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce menu data to a searchable format understandable by fuzzy.js
|
* Reduce menu data to a searchable format understandable by fuzzy.js
|
||||||
*
|
*
|
||||||
|
@ -115,7 +123,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent the menu from being opened twice
|
* Prevent the menu from being opened twice
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_onAppsMenuItemClicked: function (ev) {
|
_onAppsMenuItemClicked: function (ev) {
|
||||||
|
@ -283,15 +291,15 @@ odoo.define('web_responsive', function (require) {
|
||||||
* Control if AppDrawer can be closed
|
* Control if AppDrawer can be closed
|
||||||
*/
|
*/
|
||||||
_hideAppsMenu: function () {
|
_hideAppsMenu: function () {
|
||||||
return $('.oe_wait').length === 0 && !this.$('input').is(':focus');
|
return !isWaiting() && !this.$('input').is(':focus');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
BasicController.include({
|
BasicController.include({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the AppDrawer if the data set is dirty and a discard dialog is opened
|
* Close the AppDrawer if the data set is dirty and a discard dialog is opened
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
canBeDiscarded: function (recordID) {
|
canBeDiscarded: function (recordID) {
|
||||||
|
@ -326,7 +334,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
if (
|
if (
|
||||||
this.$menu_toggle.is(":visible") &&
|
this.$menu_toggle.is(":visible") &&
|
||||||
this.$section_placeholder.is(":visible") &&
|
this.$section_placeholder.is(":visible") &&
|
||||||
$('.oe_wait').length === 0
|
!isWaiting()
|
||||||
) {
|
) {
|
||||||
this.$section_placeholder.collapse("hide");
|
this.$section_placeholder.collapse("hide");
|
||||||
}
|
}
|
||||||
|
@ -338,7 +346,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
_hideMenuSection: function () {
|
_hideMenuSection: function () {
|
||||||
return $('.oe_wait').length === 0;
|
return !isWaiting();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -358,7 +366,7 @@ odoo.define('web_responsive', function (require) {
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_onMouseOverMenu: function () {
|
_onMouseOverMenu: function () {
|
||||||
if ($('.oe_wait').length === 0) {
|
if (!isWaiting()) {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue