From b9440822b4da56aa3a85dc8ff8c1494041f402b5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 19 Apr 2019 20:17:05 +0000 Subject: [PATCH] --- ayanova/src/App.vue | 2 +- ayanova/src/api/gzmenu.js | 20 +++++++++++++++++--- ayanova/src/views/About.vue | 14 +++++++------- ayanova/src/views/inventory-widget-edit.vue | 3 ++- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index ce9963b5..c5efd214 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -119,7 +119,7 @@ export default { }); this.$gzevent.$on("menu-click", function handleMenuClick(menuitem) { - that.$gzmenu.handleClick(that, menuitem); + that.$gzmenu.handleAppClick(that, menuitem); }); }, beforeDestroy() { diff --git a/ayanova/src/api/gzmenu.js b/ayanova/src/api/gzmenu.js index 295bdd0b..3233edd8 100644 --- a/ayanova/src/api/gzmenu.js +++ b/ayanova/src/api/gzmenu.js @@ -83,11 +83,11 @@ export default { } }, /////////////////////////////// - // CLICK HANDLER + // APP (GLOBAL) CLICK HANDLER // // Deal with a menu change request // called from App.vue - handleClick(that, menuitem) { + handleAppClick(that, menuitem) { //Key will start with the string "app:" if it's a global application command that should be handled here, //otherwise it's a local command for a local form only //If there is any extended information required for the command it will be in the data property of the menu item @@ -112,10 +112,24 @@ export default { break; default: alert( - "gzmenu:handleClick - unrecognized command [" + menuitem.key + "]" + "gzmenu:handleAppClick - unrecognized command [" + + menuitem.key + + "]" ); } } + }, + /////////////////////////////// + // CONFIRM RELEVANT CLICK + // + // confirm the click is relevant + // to a contextual caller + // called by all forms except app.vue + isRelevantClick(menuitem) { + if (!menuitem.disabled && !menuitem.key.startsWith("app:")) { + return true; + } + return false; } //new functions above here }; diff --git a/ayanova/src/views/About.vue b/ayanova/src/views/About.vue index dcda82ea..819012bc 100644 --- a/ayanova/src/views/About.vue +++ b/ayanova/src/views/About.vue @@ -107,11 +107,11 @@ /* Xeslint-disable */ import aboutInfo from "../api/aboutinfo"; -function clickHandler(item) { - if (!item.disabled && !item.key.startsWith("app:")) { - alert("about.vue::context click: " + item.key); - } -} +// function clickHandler(item) { +// if (this.$gzmenu.isRelevantClick(item)) { +// alert("about.vue::context click: " + item.key); +// } +// } export default { beforeCreate() { @@ -148,7 +148,7 @@ export default { } ] }); - this.$gzevent.$on("menu-click", clickHandler); + // this.$gzevent.$on("menu-click", clickHandler); this.clientInfo.version = aboutInfo.version; this.$gzapi @@ -161,7 +161,7 @@ export default { }); }, beforeDestroy() { - this.$gzevent.$off("menu-click", clickHandler); + // this.$gzevent.$off("menu-click", clickHandler); }, data() { return { diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 32a6e0ce..1f14e67e 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -131,7 +131,7 @@