This commit is contained in:
@@ -131,45 +131,6 @@ export default {
|
||||
var that = this;
|
||||
this.$gzevent.$on("menu-change", function(ctx) {
|
||||
gzmenu.handleMenuChange(that, ctx);
|
||||
|
||||
// that.appBar.isMain = ctx.isMain;
|
||||
// that.appBar.icon = ctx.icon;
|
||||
// that.appBar.title = ctx.title;
|
||||
// //set the help url if presented or default to the top of the index
|
||||
// that.appBar.helpUrl = ctx.helpUrl ? ctx.helpUrl : "index.html";
|
||||
// that.appBar.menuItems = [];
|
||||
|
||||
// //CONTEXT TOP PORTION
|
||||
// //populate the context portion of the menu so handle accordingly
|
||||
// if (ctx.menuItems) {
|
||||
// that.appBar.menuItems = ctx.menuItems;
|
||||
// //DIVIDER
|
||||
// //Insert the devider between context and global items
|
||||
// that.appBar.menuItems.push({ divider: true, inset: false });
|
||||
// }
|
||||
|
||||
// //GLOBAL BOTTOM PORTION
|
||||
|
||||
// //Global sub-heading
|
||||
// //Likely won't want this but here anyway to see
|
||||
// //that.appBar.menuItems.push({ header: "GLOBAL" });
|
||||
|
||||
// //global menu items
|
||||
|
||||
// //Logout
|
||||
// that.appBar.menuItems.push({
|
||||
// title: this.$gzlocale.get("Logout"),
|
||||
// icon: "sign-out-alt",
|
||||
// color: "pink",
|
||||
// key: "app:logout"
|
||||
// });
|
||||
|
||||
// //Insert help item
|
||||
// that.appBar.menuItems.push({
|
||||
// title: this.$gzlocale.get("MenuHelp"),
|
||||
// icon: "question-circle",
|
||||
// key: "app:help:" + that.appBar.helpUrl
|
||||
// });
|
||||
}); //END OF EVENT
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -178,35 +139,37 @@ export default {
|
||||
// (used to update a key in place more efficiently)
|
||||
//
|
||||
this.$gzevent.$on("menu-replace-item", function(newItem) {
|
||||
if (!that.appBar.menuItems || !newItem) {
|
||||
return;
|
||||
}
|
||||
//Find the key that is in the collection and replace it
|
||||
for (var i = 0; i < that.appBar.menuItems.length; i++) {
|
||||
if (that.appBar.menuItems[i].key == newItem.key) {
|
||||
//NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
|
||||
//automatically adds the setters and getters that trigger reactivity
|
||||
//If it was set directly on the array it wouldn't update the UI
|
||||
that.$set(that.appBar.menuItems, i, newItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
gzmenu.handleReplaceMenuItem(that, newItem);
|
||||
// if (!that.appBar.menuItems || !newItem) {
|
||||
// return;
|
||||
// }
|
||||
// //Find the key that is in the collection and replace it
|
||||
// for (var i = 0; i < that.appBar.menuItems.length; i++) {
|
||||
// if (that.appBar.menuItems[i].key == newItem.key) {
|
||||
// //NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
|
||||
// //automatically adds the setters and getters that trigger reactivity
|
||||
// //If it was set directly on the array it wouldn't update the UI
|
||||
// that.$set(that.appBar.menuItems, i, newItem);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}); //END OF EVENT
|
||||
|
||||
//////////////////////////////////
|
||||
//CLICK EVENT HANDLER
|
||||
//
|
||||
this.$gzevent.$on("menu-click", function(item) {
|
||||
if (!item.disabled && item.key.startsWith("app:")) {
|
||||
if (item.key.startsWith("app:help:")) {
|
||||
// "https://www.ayanova.com/AyaNova7webHelp/" +
|
||||
var helpurl =
|
||||
that.$store.state.helpUrl + item.key.replace("app:help:", "");
|
||||
window.open(helpurl, "_blank");
|
||||
} else {
|
||||
alert("STUB: App.vue::menu click: " + item.key);
|
||||
}
|
||||
}
|
||||
this.$gzevent.$on("menu-click", function(menuitem) {
|
||||
gzmenu.handleClick(that, menuitem);
|
||||
// if (!item.disabled && item.key.startsWith("app:")) {
|
||||
// if (item.key.startsWith("app:help:")) {
|
||||
// // "https://www.ayanova.com/AyaNova7webHelp/" +
|
||||
// var helpurl =
|
||||
// that.$store.state.helpUrl + item.key.replace("app:help:", "");
|
||||
// window.open(helpurl, "_blank");
|
||||
// } else {
|
||||
// alert("STUB: App.vue::menu click: " + item.key);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
@@ -48,6 +48,43 @@ export default {
|
||||
icon: "question-circle",
|
||||
key: "app:help:" + that.appBar.helpUrl
|
||||
});
|
||||
},
|
||||
///////////////////////////////
|
||||
// CHANGE HANDLER
|
||||
//
|
||||
// Deal with a menu item update request
|
||||
// called from App.vue
|
||||
handleReplaceMenuItem(that, newItem) {
|
||||
if (!that.appBar.menuItems || !newItem) {
|
||||
return;
|
||||
}
|
||||
//Find the key that is in the collection and replace it
|
||||
for (var i = 0; i < that.appBar.menuItems.length; i++) {
|
||||
if (that.appBar.menuItems[i].key == newItem.key) {
|
||||
//NOTE: since we are adding a new object, it has no reactivity in it so we need to use the Vue.Set to set it which
|
||||
//automatically adds the setters and getters that trigger reactivity
|
||||
//If it was set directly on the array it wouldn't update the UI
|
||||
that.$set(that.appBar.menuItems, i, newItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
///////////////////////////////
|
||||
// CLICK HANDLER
|
||||
//
|
||||
// Deal with a menu change request
|
||||
// called from App.vue
|
||||
handleClick(that, menuitem) {
|
||||
if (!menuitem.disabled && menuitem.key.startsWith("app:")) {
|
||||
if (menuitem.key.startsWith("app:help:")) {
|
||||
// "https://www.ayanova.com/AyaNova7webHelp/" +
|
||||
var helpurl =
|
||||
that.$store.state.helpUrl + menuitem.key.replace("app:help:", "");
|
||||
window.open(helpurl, "_blank");
|
||||
} else {
|
||||
alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
//new functions above here
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user