From 00ab49cd1a89ea59c3f4bcddf2ac499b49a6d862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Wed, 12 Jun 2019 02:33:12 +0200 Subject: [PATCH] [IMP] web_responsive: AppMenu wait for load view --- .../static/src/css/web_responsive.scss | 23 +++++++++++++++ .../static/src/js/web_responsive.js | 28 ++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/web_responsive/static/src/css/web_responsive.scss b/web_responsive/static/src/css/web_responsive.scss index 22082126..44c84507 100644 --- a/web_responsive/static/src/css/web_responsive.scss +++ b/web_responsive/static/src/css/web_responsive.scss @@ -1,6 +1,29 @@ /* Copyright 2018 Tecnativa - Jairo Llopis * 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 { border: none; box-shadow: none; diff --git a/web_responsive/static/src/js/web_responsive.js b/web_responsive/static/src/js/web_responsive.js index 387bdaf4..17b793a0 100644 --- a/web_responsive/static/src/js/web_responsive.js +++ b/web_responsive/static/src/js/web_responsive.js @@ -4,6 +4,7 @@ odoo.define('web_responsive', function (require) { 'use strict'; + var ActionManager = require('web.ActionManager'); var AbstractWebClient = require("web.AbstractWebClient"); var AppsMenu = require("web.AppsMenu"); 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({ @@ -358,7 +367,24 @@ odoo.define('web_responsive', function (require) { } else { 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'); + } + }); + }, }); /**