This commit is contained in:
@@ -57,13 +57,12 @@
|
||||
</template>
|
||||
</v-list>-->
|
||||
<!-- MAIN MENU -->
|
||||
<v-list v-if="appBar.isMain">
|
||||
<v-list v-if="appBar.isMain">
|
||||
<v-list-tile
|
||||
v-for="item in appBar.mainMenuItems"
|
||||
:key="item.key"
|
||||
@click="$gzevent.$emit('main-menu-click',item.key)"
|
||||
@click="$gzevent.$emit('menu-click',item.key)"
|
||||
>
|
||||
<v-divider v-if="item.divider" :key="index" :inset="item.inset"></v-divider>
|
||||
<v-list-tile-action>
|
||||
<v-icon v-if="item.icon">{{ "fa-" + item.icon }}</v-icon>
|
||||
</v-list-tile-action>
|
||||
@@ -75,11 +74,10 @@
|
||||
<!-- CONTEXT MENU -->
|
||||
<v-list v-if="!appBar.isMain">
|
||||
<v-list-tile
|
||||
v-for="item in appBar.contextItems"
|
||||
v-for="item in appBar.contextMenuItems"
|
||||
:key="item.key"
|
||||
@click="$gzevent.$emit('context-menu-click',item.key)"
|
||||
@click="$gzevent.$emit('menu-click',item.key)"
|
||||
>
|
||||
|
||||
<v-list-tile-action>
|
||||
<v-icon v-if="item.icon">{{ "fa-" + item.icon }}</v-icon>
|
||||
</v-list-tile-action>
|
||||
@@ -124,12 +122,8 @@ export default {
|
||||
isMain: true,
|
||||
icon: "",
|
||||
title: "",
|
||||
contextItems: [],
|
||||
mainMenuItems: [
|
||||
{ title: "Log off", icon: "sign-out-alt", key: "app:logout" },
|
||||
{ title: "Help", key: "app:help" },
|
||||
{ divider: true }
|
||||
]
|
||||
contextMenuItems: [],
|
||||
mainMenuItems: []
|
||||
},
|
||||
items: [
|
||||
{ header: "Today" },
|
||||
@@ -157,17 +151,36 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
//subscribe to context menu changes
|
||||
//subscribe to menu changes
|
||||
var that = this;
|
||||
this.$gzevent.$on("menu-change", function(ctx) {
|
||||
that.appBar.isMain = ctx.isMain;
|
||||
that.appBar.icon = ctx.icon;
|
||||
that.appBar.title = ctx.title;
|
||||
that.appBar.contextItems = ctx.contextItems ? ctx.contextItems : [];
|
||||
if (!ctx.isMain) {
|
||||
//context menu so handle accordingly
|
||||
that.appBar.contextMenuItems = ctx.contextMenuItems
|
||||
? ctx.contextMenuItems
|
||||
: [];
|
||||
} else {
|
||||
//main menu, put in the standard items that always show
|
||||
that.appBar.mainMenuItems = [
|
||||
{ title: "Log off", icon: "sign-out-alt", key: "app:logout" },
|
||||
{ title: "Help", key: "app:help" }
|
||||
];
|
||||
//If other items specified add them above the standard ones
|
||||
if (ctx.mainMenuItems) {
|
||||
that.appBar.mainMenuItems = ctx.mainMenuItems.concat(
|
||||
that.appBar.mainMenuItems
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$gzevent.$on("main-menu-click", function(key) {
|
||||
alert("App.vue::main-menu click: " + key);
|
||||
this.$gzevent.$on("menu-click", function(key) {
|
||||
if (key.startsWith("app:")) {
|
||||
alert("App.vue::menu click: " + key);
|
||||
}
|
||||
});
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
@@ -131,7 +131,9 @@
|
||||
<script>
|
||||
/* xeslint-disable */
|
||||
function clickHandler(key) {
|
||||
alert("inventory-widget-edit.vue::context click: " + key);
|
||||
if (!key.startsWith("app:")) {
|
||||
alert("inventory-widget-edit.vue::context click: " + key);
|
||||
}
|
||||
}
|
||||
export default {
|
||||
beforeCreate() {
|
||||
@@ -177,18 +179,18 @@ export default {
|
||||
isMain: false,
|
||||
icon: "fa-splotch",
|
||||
title: this.$gzlocale.get("Widget"),
|
||||
contextItems: [
|
||||
{ title: "stub view log", icon: "glasses", key: "log" },
|
||||
{ title: "Click Me 2", key: "2" },
|
||||
{ title: "Click Me 3", key: "3" },
|
||||
{ title: "Click Me 4", key: "4" }
|
||||
contextMenuItems: [
|
||||
{ title: "DUPLICATE", icon: "clone", key: "duplicate" },
|
||||
{ title: "SAVE", icon: "save", key: "save" },
|
||||
{ title: "DELETE", icon: "trash-alt", key: "delete" },
|
||||
{ title: "HELP", key: "app:help:inventory-widget-edit" }
|
||||
]
|
||||
});
|
||||
this.$gzevent.$on("context-menu-click", clickHandler);
|
||||
this.$gzevent.$on("menu-click", clickHandler);
|
||||
this.getDataFromApi();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$gzevent.$off("context-menu-click", clickHandler);
|
||||
this.$gzevent.$off("menu-click", clickHandler);
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
|
||||
Reference in New Issue
Block a user