move basic stuff into ZeroVue config which is loaded by vue on startup

This commit is contained in:
2020-04-11 17:45:39 +02:00
parent 2838eeadab
commit 2799f62be8
7 changed files with 203 additions and 79 deletions
+2 -2
View File
@@ -117,7 +117,7 @@
font-size: var(--font-size);
padding: 0 var(--padding);
height: 50px;
color: var(--color-fg-reverse-mid);
color: var(--color-fg);
position: relative;
transition: color 0.2s ease;
@@ -147,7 +147,7 @@
height: 100%;
align-items: center;
position: relative;
color: var(--color-fg-mid);
color: var(--color-fg);
&:hover
{
+2 -14
View File
@@ -2,8 +2,6 @@ import { extend as _extend, each as _each } from 'underscore';
export default {
cache: zero.translations,
localize(key, options)
{
let params = _extend({
@@ -24,19 +22,9 @@ export default {
}
key = hasAtSign ? key.slice(1) : key;
let value = this.cache;
const value = zero.translations[key];
for (let part of key.split('.'))
{
if (!value[part])
{
break;
}
value = value[part];
}
if (!value || value === this.cache || typeof value !== 'string')
if (!value || typeof value !== 'string')
{
return '[' + key + ']';
}
+20 -52
View File
@@ -12,14 +12,14 @@
<nav class="app-nav-inner">
<template v-for="section in sections">
<router-link :to="getLink(section)" class="app-nav-item" :class="{ 'has-children': hasChildren(section) }">
<router-link :to="section.url" class="app-nav-item" :class="{ 'has-children': hasChildren(section) }">
<i class="app-nav-item-icon" :class="section.icon" :style="{ color: false && section.color ? section.color : null }"></i>
{{section.name | localize}}
<i v-if="hasChildren(section)" class="app-nav-item-arrow fth-chevron-down"></i>
</router-link>
<transition name="app-nav-children">
<div class="app-nav-children" v-if="hasChildren(section) && $route.path.indexOf('/' + section.alias) > -1">
<router-link v-for="child in section.children" v-bind:key="child.alias" :to="getLink(section, child)" class="app-nav-child">
<router-link v-for="child in section.children" v-bind:key="child.alias" :to="child.url" class="app-nav-child">
{{child.name | localize}}
</router-link>
</div>
@@ -40,51 +40,39 @@
<script>
import ApplicationsApi from 'zeroresources/applications.js'
import SectionsApi from 'zeroresources/sections.js'
import { map as _map } from 'underscore';
export default {
name: 'app-navigation',
data: () => ({
applications: [],
applications: zero.applications,
applicationItems: [],
sections: []
sections: zero.sections
}),
mounted ()
{
//console.info(this.$router.history.current.path);
SectionsApi.getAll().then(items =>
this.applicationItems = _map(this.applications, item =>
{
this.sections = items;
return {
application: item,
active: item.name === "Brothers", // TODO correct active application
name: item.name
};
});
ApplicationsApi.getAll().then(items =>
{
this.applications = items;
this.applicationItems = _map(items, item =>
this.applicationItems.push({
type: 'separator'
});
this.applicationItems.push({
name: 'Add new application...',
icon: 'fth-plus',
action(item, dropdown)
{
return {
application: item,
active: item.name === "Brothers", // TODO correct active application
name: item.name
};
});
this.applicationItems.push({
type: 'separator'
});
this.applicationItems.push({
name: 'Add new application...',
icon: 'fth-plus',
action(item, dropdown)
{
console.info('add');
}
});
console.info('add');
}
});
},
@@ -96,26 +84,6 @@
return section.children && section.children.length > 0;
},
getName(section)
{
return section.alias.charAt(0).toUpperCase() + section.alias.slice(1);
},
getLink(section, child)
{
//if (section.alias === "dashboard" && !child)
//{
// return '/';
//}
if (!child)
{
return '/' + section.alias;
}
return '/' + section.alias + '/' + child.alias;
},
applicationChanged(item, dropdown)
{
console.info('change');