Browse Source

[IMP] web_responsive: AppMenu wait for load view

pull/1279/merge
Alexandre Díaz 6 years ago
committed by OCA-git-bot
parent
commit
00ab49cd1a
  1. 23
      web_responsive/static/src/css/web_responsive.scss
  2. 28
      web_responsive/static/src/js/web_responsive.js

23
web_responsive/static/src/css/web_responsive.scss

@ -1,6 +1,29 @@
/* Copyright 2018 Tecnativa - Jairo Llopis /* Copyright 2018 Tecnativa - Jairo Llopis
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
// AppMenu icon waiting indicator anim
@keyframes o-app-icon-bounce-animation {
0% {
transform-origin: bottom center;
}
25% {
transform: translateY(-20px);
}
50% {
transform: translateY(0px);
}
75% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
transform-origin: bottom center;
}
}
.o-app-icon-waiting {
animation: 1.3s infinite cubic-bezier(.65,.05,.36,1) o-app-icon-bounce-animation;
}
@mixin full-screen-dropdown { @mixin full-screen-dropdown {
border: none; border: none;
box-shadow: none; box-shadow: none;

28
web_responsive/static/src/js/web_responsive.js

@ -4,6 +4,7 @@
odoo.define('web_responsive', function (require) { odoo.define('web_responsive', function (require) {
'use strict'; 'use strict';
var ActionManager = require('web.ActionManager');
var AbstractWebClient = require("web.AbstractWebClient"); var AbstractWebClient = require("web.AbstractWebClient");
var AppsMenu = require("web.AppsMenu"); var AppsMenu = require("web.AppsMenu");
var config = require("web.config"); var config = require("web.config");
@ -264,6 +265,14 @@ odoo.define('web_responsive', function (require) {
}, },
}); });
}, },
// Load view indicator
_onAppsMenuItemClicked: function (ev) {
ev.preventDefault();
ev.stopPropagation();
$(ev.currentTarget).find('img').addClass('o-app-icon-waiting');
this._super.apply(this, arguments);
},
}); });
Menu.include({ Menu.include({
@ -358,7 +367,24 @@ odoo.define('web_responsive', function (require) {
} else { } else {
this._super.apply(this, arguments); this._super.apply(this, arguments);
} }
}
},
});
// Hide AppMenu & remove waiting anim when loaded action
ActionManager.include({
doAction: function () {
return this._super.apply(this, arguments).then(function () {
var $app_menu = $('.o_menu_apps .dropdown');
if ($app_menu.length) {
if ($app_menu.hasClass('show')) {
$app_menu.dropdown('toggle');
}
$app_menu.find('img.o-app-icon-waiting').removeClass(
'o-app-icon-waiting');
}
});
},
}); });
/** /**

Loading…
Cancel
Save