add active app, remove useless controllers

This commit is contained in:
Simon Vieille
2020-03-28 23:05:03 +01:00
parent f6bc16580f
commit a0fed31780
4 changed files with 16 additions and 66 deletions
+15 -8
View File
@@ -9,9 +9,9 @@
</div>
<ul class="side-menu-apps-list">
<li v-for="app in apps" class="side-menu-app">
<li v-for="app in apps" v-bind:class="{'side-menu-app': true, 'is-active': app.active}">
<a v-bind:href="app.href">
<img v-bind:src="app.icon" v-bind:alt="app.name" class="side-menu-app-icon">
<span class="side-menu-app-icon" v-html="app.icon"></span>
{{ app.name }}
</a>
@@ -34,18 +34,25 @@ export default {
},
created() {
let that = this
axios.get(generateUrl('apps/side_menu/side_menu/api/apps'))
.then(response => {
this.apps = response.data
})
var links = document.querySelectorAll('#appmenu a')
this.logo = window.getComputedStyle(document.querySelector('#nextcloud .logo'), null)
.getPropertyValue('background-image')
.replace('url("', '')
.replace('")', '')
console.log(this.logo)
for (let element of links) {
let href = element.getAttribute('href')
if (href !== '#') {
that.apps.push({
href: href,
name: element.querySelector('span').innerHTML,
icon: element.querySelector('svg').outerHTML,
active: element.classList.contains('active')
})
}
}
}
}
</script>