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