2018-08-28 22:50:22 +02:00
|
|
|
<template>
|
2018-11-06 16:53:32 +01:00
|
|
|
<div id="app">
|
2018-12-25 16:03:51 +01:00
|
|
|
<nav class="navbar is-dark is-fixed-top" role="navigation" aria-label="main navigation" v-if="user.authenticated">
|
|
|
|
<div class="navbar-brand">
|
|
|
|
<router-link :to="{name: 'home'}" class="navbar-item logo">
|
|
|
|
<img src="/images/logo-full-white.svg"/>
|
|
|
|
</router-link>
|
2018-09-09 17:23:06 +02:00
|
|
|
</div>
|
|
|
|
</nav>
|
2018-12-25 16:03:51 +01:00
|
|
|
<div v-if="user.authenticated">
|
|
|
|
<a @click="mobileMenuActive = true" class="mobilemenu-show-button" v-if="!mobileMenuActive"><icon icon="bars"></icon></a>
|
|
|
|
<a @click="mobileMenuActive = false" class="mobilemenu-hide-button" v-if="mobileMenuActive"><icon icon="times"></icon></a>
|
|
|
|
<div class="app-container">
|
|
|
|
<div class="namespace-container" :class="{'is-active': mobileMenuActive}">
|
|
|
|
<div class="menu top-menu">
|
|
|
|
<ul class="menu-list user">
|
|
|
|
<li>
|
|
|
|
<img :src="gravatar()" class="is-rounded" alt=""/>
|
|
|
|
<span class="username">{{user.infos.username}}</span>
|
|
|
|
<a @click="logout()" class="logout-icon">
|
|
|
|
<span class="icon is-medium">
|
|
|
|
<icon icon="power-off" size="2x"/>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2018-11-06 16:53:32 +01:00
|
|
|
</div>
|
2018-12-25 16:03:51 +01:00
|
|
|
<div class="menu top-menu">
|
|
|
|
<ul class="menu-list">
|
|
|
|
<li>
|
|
|
|
<router-link :to="{ name: 'home'}">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="calendar"/>
|
|
|
|
</span>
|
|
|
|
Overview
|
|
|
|
</router-link>
|
|
|
|
</li>
|
2018-12-25 23:41:55 +01:00
|
|
|
<li>
|
|
|
|
<router-link :to="{ name: 'showTasksInRange', params: {type: 'month'}}">
|
|
|
|
<span class="icon">
|
|
|
|
<icon :icon="['far', 'calendar-alt']"/>
|
|
|
|
</span>
|
|
|
|
Next Month
|
|
|
|
</router-link>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<router-link :to="{ name: 'showTasksInRange', params: {type: 'week'}}">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="calendar-week"/>
|
|
|
|
</span>
|
|
|
|
Next Week
|
|
|
|
</router-link>
|
|
|
|
</li>
|
2018-12-25 16:03:51 +01:00
|
|
|
<li>
|
|
|
|
<router-link :to="{ name: 'listTeams'}">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="users"/>
|
|
|
|
</span>
|
|
|
|
Teams
|
|
|
|
</router-link>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<router-link :to="{ name: 'newNamespace'}">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="layer-group"/>
|
|
|
|
</span>
|
|
|
|
New Namespace
|
|
|
|
</router-link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2018-09-07 08:42:17 +02:00
|
|
|
</div>
|
2018-12-25 16:03:51 +01:00
|
|
|
<aside class="menu namespaces-lists">
|
2019-03-02 11:25:10 +01:00
|
|
|
<div class="spinner" :class="{ 'is-loading': namespaceService.loading}"></div>
|
2018-12-25 16:03:51 +01:00
|
|
|
<template v-for="n in namespaces">
|
|
|
|
<div :key="n.id">
|
|
|
|
<router-link v-tooltip.right="'Settings'" :to="{name: 'editNamespace', params: {id: n.id} }" class="nsettings" v-if="n.id > 0">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="cog"/>
|
|
|
|
</span>
|
|
|
|
</router-link>
|
|
|
|
<router-link v-tooltip="'Add a new list in the ' + n.name + ' namespace'" :to="{ name: 'newList', params: { id: n.id} }" class="nsettings" :key="n.id + 'newList'" v-if="n.id > 0">
|
|
|
|
<span class="icon">
|
|
|
|
<icon icon="plus"/>
|
|
|
|
</span>
|
|
|
|
</router-link>
|
|
|
|
<div class="menu-label">
|
|
|
|
{{n.name}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<ul class="menu-list" :key="n.id + 'child'">
|
|
|
|
<li v-for="l in n.lists" :key="l.id">
|
|
|
|
<router-link :to="{ name: 'showList', params: { id: l.id} }">{{l.title}}</router-link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</template>
|
|
|
|
</aside>
|
|
|
|
</div>
|
|
|
|
<div class="app-content" :class="{'fullpage-overlay': fullpage}">
|
|
|
|
<a class="mobile-overlay" v-if="mobileMenuActive" @click="mobileMenuActive = false"></a>
|
|
|
|
<transition name="fade">
|
|
|
|
<router-view/>
|
|
|
|
</transition>
|
2018-09-07 08:42:17 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-25 16:03:51 +01:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<div class="container has-text-centered">
|
|
|
|
<div class="column is-4 is-offset-4">
|
|
|
|
<img src="/images/logo-full.svg"/>
|
|
|
|
<router-view/>
|
2018-11-01 22:34:29 +01:00
|
|
|
</div>
|
2018-09-07 08:42:17 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-25 16:03:51 +01:00
|
|
|
<notifications position="bottom left" />
|
2018-09-06 19:46:09 +02:00
|
|
|
</div>
|
2018-08-28 22:50:22 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-03-02 11:25:10 +01:00
|
|
|
import auth from './auth'
|
2018-09-08 21:43:16 +02:00
|
|
|
import message from './message'
|
2019-03-02 11:25:10 +01:00
|
|
|
import router from './router'
|
|
|
|
import NamespaceService from './services/namespace'
|
2018-09-07 08:42:17 +02:00
|
|
|
|
2019-03-02 11:25:10 +01:00
|
|
|
export default {
|
|
|
|
name: 'app',
|
2018-09-07 08:42:17 +02:00
|
|
|
|
2019-03-02 11:25:10 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
user: auth.user,
|
|
|
|
namespaces: [],
|
2019-03-03 13:50:06 +01:00
|
|
|
namespaceService: NamespaceService,
|
2018-12-25 16:03:51 +01:00
|
|
|
mobileMenuActive: false,
|
|
|
|
fullpage: false,
|
2018-12-25 23:41:55 +01:00
|
|
|
currentDate: new Date(),
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|
|
|
|
},
|
2018-11-01 22:34:29 +01:00
|
|
|
beforeMount() {
|
2019-03-02 11:25:10 +01:00
|
|
|
// Password reset
|
|
|
|
if(this.$route.query.userPasswordReset !== undefined) {
|
2018-11-01 22:34:29 +01:00
|
|
|
localStorage.removeItem('passwordResetToken') // Delete an eventually preexisting old token
|
|
|
|
localStorage.setItem('passwordResetToken', this.$route.query.userPasswordReset)
|
2019-03-02 11:25:10 +01:00
|
|
|
router.push({name: 'passwordReset'})
|
2018-11-01 22:34:29 +01:00
|
|
|
}
|
2019-03-02 11:25:10 +01:00
|
|
|
// Email verification
|
|
|
|
if(this.$route.query.userEmailConfirm !== undefined) {
|
|
|
|
localStorage.removeItem('emailConfirmToken') // Delete an eventually preexisting old token
|
|
|
|
localStorage.setItem('emailConfirmToken', this.$route.query.userEmailConfirm)
|
|
|
|
router.push({name: 'login'})
|
2018-11-01 23:58:59 +01:00
|
|
|
}
|
2018-11-01 22:34:29 +01:00
|
|
|
},
|
2019-03-02 11:25:10 +01:00
|
|
|
created() {
|
|
|
|
if (this.user.authenticated) {
|
2019-03-03 13:50:06 +01:00
|
|
|
this.namespaceService = new NamespaceService()
|
2019-03-02 11:25:10 +01:00
|
|
|
this.loadNamespaces()
|
2018-09-08 21:24:10 +02:00
|
|
|
}
|
2019-03-02 11:25:10 +01:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
// call the method again if the route changes
|
|
|
|
'$route': 'doStuffAfterRoute'
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
logout() {
|
|
|
|
auth.logout()
|
|
|
|
},
|
2018-09-09 17:23:06 +02:00
|
|
|
gravatar() {
|
2019-03-02 11:25:10 +01:00
|
|
|
return 'https://www.gravatar.com/avatar/' + this.user.infos.avatar + '?s=50'
|
|
|
|
},
|
|
|
|
loadNamespaces() {
|
2019-03-03 13:50:06 +01:00
|
|
|
this.namespaceService.getAll()
|
2019-03-02 11:25:10 +01:00
|
|
|
.then(r => {
|
|
|
|
this.$set(this, 'namespaces', r)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
message.error(e, this)
|
|
|
|
})
|
2018-09-09 17:23:06 +02:00
|
|
|
},
|
2018-09-09 16:17:56 +02:00
|
|
|
loadNamespacesIfNeeded(e){
|
2019-03-02 11:25:10 +01:00
|
|
|
if (this.user.authenticated && e.name === 'home') {
|
|
|
|
this.loadNamespaces()
|
|
|
|
}
|
2018-09-09 16:17:56 +02:00
|
|
|
},
|
2018-12-25 16:03:51 +01:00
|
|
|
doStuffAfterRoute(e) {
|
|
|
|
this.fullpage = false;
|
|
|
|
this.loadNamespacesIfNeeded(e)
|
|
|
|
this.mobileMenuActive = false
|
|
|
|
},
|
|
|
|
setFullPage() {
|
|
|
|
this.fullpage = true;
|
|
|
|
},
|
2019-03-02 11:25:10 +01:00
|
|
|
},
|
|
|
|
}
|
2018-08-28 22:50:22 +02:00
|
|
|
</script>
|