active navi

This commit is contained in:
Sebastian Frank 2017-08-29 21:38:33 +02:00
parent 901b918dbb
commit a759e65ead
No known key found for this signature in database
GPG Key ID: DC2BC5C506EBF6F3
3 changed files with 21 additions and 55 deletions

View File

@ -8,7 +8,10 @@
"name": "Login", "name": "Login",
"to": "/login", "to": "/login",
"icon": "fa-home", "icon": "fa-home",
"content": "<login-form></login-form>" "content": "<login-form></login-form>",
"show": {
"never": true
}
}, },
{ {
"name": "Dashboard", "name": "Dashboard",

View File

@ -4,61 +4,12 @@
<div class="inner"> <div class="inner">
<nav class="mainnav"> <nav class="mainnav">
<ul> <ul>
<li v-for="(item, i) in items" :key="i"> <router-link tag="li" v-for="(item, i) in items" :key="i" v-if="showIf(item.show)" :to="item.to" active-class="active" exact>
<router-link :to="item.to"> <a>
<i :class="['icon', item.icon]"></i> <i :class="['icon', item.icon]"></i>
<div class="title">{{ item.name }}</div> <div class="title">{{ item.name }}</div>
</router-link> </a>
</li> </router-link>
<hr>
<li><a href="#">
<i class="icon icon-images" aria-hidden="true"></i>
<div class="title">Medien</div>
</a></li>
<li><a href="#">
<i class="icon icon-document-text" aria-hidden="true"></i>
<div class="title">Seiten</div>
</a></li>
<li class="active">
<a href="#"><i class="icon icon-paper-airplane" aria-hidden="true"></i>
<div class="title">Beiträge</div></a>
<!-- Sub Navigation -->
<div class="subnav">
<div class="subnav_headline">Kategorie</div>
<ul>
<li class="active"><a href="#">News</a></li>
<li><a href="#">Veranstaltungen</a></li>
<li><a href="#">Mitarbeiter</a></li>
</ul>
</div>
</li>
<li><a href="#">
<i class="icon icon-cube" aria-hidden="true"></i>
<div class="title">Module</div>
</a></li>
<li><a href="#">
<i class="icon icon-navigate" aria-hidden="true"></i>
<div class="title">Navigation</div>
</a></li>
<li><a href="#">
<i class="icon icon-chatbox" aria-hidden="true"></i>
<div class="title">Sprachen</div>
</a></li>
<li><a href="#">
<i class="icon icon-pie-graph" aria-hidden="true"></i>
<div class="title">SEO & Pagespeed</div>
</a></li>
<li><a href="#">
<i class="icon icon-contacts" aria-hidden="true"></i>
<div class="title">Benutzer</div>
</a></li>
<li><a href="#">
<i class="icon icon-gear" aria-hidden="true"></i>
<div class="title">Settings</div>
</a></li>
</ul> </ul>
</nav> </nav>
</div> </div>
@ -277,6 +228,18 @@ export default {
return [ ]; return [ ];
} }
} }
},
methods: {
showIf(conf) {
console.log(conf);
// show if not configured
if (!conf) {
return true;
}
if (conf.never) {
return false;
}
}
} }
} }
</script> </script>

View File

@ -177,7 +177,7 @@ Axios.get('conf/init.json')
alert('invalid data in init.json'); alert('invalid data in init.json');
return; return;
} }
const navigation = results.data.navigation.map(({name, to, icon}) => {return {name, to, icon}}); const navigation = results.data.navigation.map(({name, to, icon, show}) => {return {name, to, icon, show}});
store.commit("setNavigation", navigation); store.commit("setNavigation", navigation);