Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Widgets/Menu.vue
Show All 15 Lines | <nav :id="mode + '-menu'" class="navbar navbar-expand-lg navbar-light"> | ||||
:class="'nav-link link-' + item.index" | :class="'nav-link link-' + item.index" | ||||
active-class="active" | active-class="active" | ||||
:to="item.to" | :to="item.to" | ||||
:exact="item.exact" | :exact="item.exact" | ||||
> | > | ||||
{{ item.title }} | {{ item.title }} | ||||
</router-link> | </router-link> | ||||
</li> | </li> | ||||
<li class="nav-item" v-if="!loggedIn && !$root.isAdmin"> | <li class="nav-item" v-if="!loggedIn && $root.isUser"> | ||||
<router-link class="nav-link link-signup" active-class="active" :to="{name: 'signup'}">Signup</router-link> | <router-link class="nav-link link-signup" active-class="active" :to="{name: 'signup'}">Signup</router-link> | ||||
</li> | </li> | ||||
<li class="nav-item" v-if="loggedIn"> | <li class="nav-item" v-if="loggedIn"> | ||||
<router-link class="nav-link link-dashboard" active-class="active" :to="{name: 'dashboard'}">Cockpit</router-link> | <router-link class="nav-link link-dashboard" active-class="active" :to="{name: 'dashboard'}">Cockpit</router-link> | ||||
</li> | </li> | ||||
<li class="nav-item" v-if="loggedIn"> | <li class="nav-item" v-if="loggedIn"> | ||||
<router-link class="nav-link menulogin link-logout" active-class="active" :to="{name: 'logout'}">Logout</router-link> | <router-link class="nav-link menulogin link-logout" active-class="active" :to="{name: 'logout'}">Logout</router-link> | ||||
</li> | </li> | ||||
Show All 34 Lines | export default { | ||||
window.config.menu.forEach(item => { | window.config.menu.forEach(item => { | ||||
if (!item.location || !item.title) { | if (!item.location || !item.title) { | ||||
console.error("Invalid menu entry", item) | console.error("Invalid menu entry", item) | ||||
return | return | ||||
} | } | ||||
// TODO: Different menu for different loggedIn state | // TODO: Different menu for different loggedIn state | ||||
if (window.isAdmin && !item.admin) { | if ( | ||||
return | (window.isAdmin && !item.admin) | ||||
} else if (!window.isAdmin && item.admin === 'only') { | || (!window.isAdmin && item.admin === 'only') | ||||
|| (window.isReseller && !item.reseller) | |||||
|| (!window.isReseller && item.reseller === 'only') | |||||
) { | |||||
return | return | ||||
} | } | ||||
if (!item.footer || this.mode == 'footer') { | if (!item.footer || this.mode == 'footer') { | ||||
if (item.location.match(/^https?:/)) { | if (item.location.match(/^https?:/)) { | ||||
item.href = item.location | item.href = item.location | ||||
} else { | } else { | ||||
item.to = { path: item.location } | item.to = { path: item.location } | ||||
Show All 14 Lines |