This commit is contained in:
@@ -131,45 +131,6 @@ export default {
|
|||||||
var that = this;
|
var that = this;
|
||||||
this.$gzevent.$on("menu-change", function(ctx) {
|
this.$gzevent.$on("menu-change", function(ctx) {
|
||||||
gzmenu.handleMenuChange(that, 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
|
}); //END OF EVENT
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
@@ -178,35 +139,37 @@ export default {
|
|||||||
// (used to update a key in place more efficiently)
|
// (used to update a key in place more efficiently)
|
||||||
//
|
//
|
||||||
this.$gzevent.$on("menu-replace-item", function(newItem) {
|
this.$gzevent.$on("menu-replace-item", function(newItem) {
|
||||||
if (!that.appBar.menuItems || !newItem) {
|
gzmenu.handleReplaceMenuItem(that, newItem);
|
||||||
return;
|
// 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++) {
|
// //Find the key that is in the collection and replace it
|
||||||
if (that.appBar.menuItems[i].key == newItem.key) {
|
// for (var i = 0; i < that.appBar.menuItems.length; i++) {
|
||||||
//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
|
// if (that.appBar.menuItems[i].key == newItem.key) {
|
||||||
//automatically adds the setters and getters that trigger reactivity
|
// //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
|
||||||
//If it was set directly on the array it wouldn't update the UI
|
// //automatically adds the setters and getters that trigger reactivity
|
||||||
that.$set(that.appBar.menuItems, i, newItem);
|
// //If it was set directly on the array it wouldn't update the UI
|
||||||
return;
|
// that.$set(that.appBar.menuItems, i, newItem);
|
||||||
}
|
// return;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
}); //END OF EVENT
|
}); //END OF EVENT
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
//CLICK EVENT HANDLER
|
//CLICK EVENT HANDLER
|
||||||
//
|
//
|
||||||
this.$gzevent.$on("menu-click", function(item) {
|
this.$gzevent.$on("menu-click", function(menuitem) {
|
||||||
if (!item.disabled && item.key.startsWith("app:")) {
|
gzmenu.handleClick(that, menuitem);
|
||||||
if (item.key.startsWith("app:help:")) {
|
// if (!item.disabled && item.key.startsWith("app:")) {
|
||||||
// "https://www.ayanova.com/AyaNova7webHelp/" +
|
// if (item.key.startsWith("app:help:")) {
|
||||||
var helpurl =
|
// // "https://www.ayanova.com/AyaNova7webHelp/" +
|
||||||
that.$store.state.helpUrl + item.key.replace("app:help:", "");
|
// var helpurl =
|
||||||
window.open(helpurl, "_blank");
|
// that.$store.state.helpUrl + item.key.replace("app:help:", "");
|
||||||
} else {
|
// window.open(helpurl, "_blank");
|
||||||
alert("STUB: App.vue::menu click: " + item.key);
|
// } else {
|
||||||
}
|
// alert("STUB: App.vue::menu click: " + item.key);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|||||||
@@ -48,6 +48,43 @@ export default {
|
|||||||
icon: "question-circle",
|
icon: "question-circle",
|
||||||
key: "app:help:" + that.appBar.helpUrl
|
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
|
//new functions above here
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user