2018-01-09 17:52:26 +01:00
|
|
|
<template>
|
|
|
|
<v-app id="libre-event">
|
|
|
|
<v-navigation-drawer
|
|
|
|
light
|
|
|
|
clipped
|
|
|
|
fixed
|
|
|
|
app
|
|
|
|
v-model="drawer"
|
|
|
|
enable-resize-watcher
|
|
|
|
>
|
|
|
|
<v-list dense>
|
2018-07-09 17:37:22 +02:00
|
|
|
<v-list-group
|
2018-07-11 13:46:19 +02:00
|
|
|
value="false"
|
|
|
|
>
|
2018-11-06 10:30:27 +01:00
|
|
|
<v-list-tile avatar v-if="actor" slot="activator">
|
2018-07-11 13:46:19 +02:00
|
|
|
<v-list-tile-avatar>
|
2018-12-21 15:41:34 +01:00
|
|
|
<img v-if="!actor.avatar"
|
|
|
|
class="img-circle elevation-7 mb-1"
|
|
|
|
src="https://picsum.photos/125/125/"
|
|
|
|
>
|
|
|
|
<img v-else
|
|
|
|
class="img-circle elevation-7 mb-1"
|
|
|
|
:src="actor.avatar"
|
|
|
|
>
|
|
|
|
</v-list-tile-avatar>
|
2018-07-09 14:19:24 +02:00
|
|
|
|
2018-11-06 10:30:27 +01:00
|
|
|
<v-list-tile-content @click="$router.push({name: 'Account', params: { name: actor.username }})">
|
2018-07-11 13:46:19 +02:00
|
|
|
<v-list-tile-title>{{ this.displayed_name }}</v-list-tile-title>
|
|
|
|
</v-list-tile-content>
|
|
|
|
</v-list-tile>
|
2018-07-09 17:37:22 +02:00
|
|
|
|
2018-11-06 10:30:27 +01:00
|
|
|
<v-list-tile avatar v-if="actor">
|
2018-07-11 13:46:19 +02:00
|
|
|
<v-list-tile-avatar>
|
2018-12-21 15:41:34 +01:00
|
|
|
<img
|
|
|
|
class="img-circle elevation-7 mb-1"
|
|
|
|
src="https://picsum.photos/125/125/"
|
|
|
|
>
|
|
|
|
</v-list-tile-avatar>
|
2018-07-09 17:37:22 +02:00
|
|
|
|
2018-07-11 13:46:19 +02:00
|
|
|
<v-list-tile-content>
|
|
|
|
<v-list-tile-title>Autre identité</v-list-tile-title>
|
|
|
|
</v-list-tile-content>
|
|
|
|
</v-list-tile>
|
|
|
|
|
|
|
|
<v-list-tile @click="$router.push({ name: 'Identities' })">
|
|
|
|
<v-list-tile-action>
|
2018-12-21 15:41:34 +01:00
|
|
|
<v-icon>group</v-icon>
|
|
|
|
</v-list-tile-action>
|
2018-07-11 13:46:19 +02:00
|
|
|
<v-list-tile-content>
|
|
|
|
<v-list-tile-title>Identities</v-list-tile-title>
|
|
|
|
</v-list-tile-content>
|
|
|
|
</v-list-tile>
|
2018-07-09 17:37:22 +02:00
|
|
|
</v-list-group>
|
2018-01-09 17:52:26 +01:00
|
|
|
<template v-for="(item, i) in items" v-if="showMenuItem(item.role)">
|
|
|
|
<v-layout
|
|
|
|
row
|
|
|
|
v-if="item.heading"
|
|
|
|
align-center
|
|
|
|
:key="i"
|
|
|
|
>
|
|
|
|
<v-flex xs6>
|
|
|
|
<v-subheader v-if="item.heading">
|
|
|
|
{{ item.heading }}
|
|
|
|
</v-subheader>
|
|
|
|
</v-flex>
|
|
|
|
<v-flex xs6 class="text-xs-center">
|
|
|
|
<a href="#!" class="body-2 black--text">EDIT</a>
|
|
|
|
</v-flex>
|
|
|
|
</v-layout>
|
|
|
|
<v-list-tile v-bind:key="item.route" v-else @click="$router.push({ name: item.route })">
|
|
|
|
<v-list-tile-action>
|
|
|
|
<v-icon>{{ item.icon }}</v-icon>
|
|
|
|
</v-list-tile-action>
|
|
|
|
<v-list-tile-content>
|
|
|
|
<v-list-tile-title>
|
|
|
|
{{ item.text }}
|
|
|
|
</v-list-tile-title>
|
|
|
|
</v-list-tile-content>
|
|
|
|
</v-list-tile>
|
|
|
|
</template>
|
|
|
|
</v-list>
|
|
|
|
</v-navigation-drawer>
|
2018-07-04 14:29:17 +02:00
|
|
|
<NavBar v-bind="{toggleDrawer}"></NavBar>
|
2018-01-09 17:52:26 +01:00
|
|
|
<v-content>
|
2018-07-09 14:19:24 +02:00
|
|
|
<v-container fluid fill-height :class="{'px-0': $vuetify.breakpoint.xsOnly }">
|
|
|
|
<v-layout xs12>
|
2018-07-04 14:29:17 +02:00
|
|
|
<transition name="router">
|
2018-01-09 17:52:26 +01:00
|
|
|
<router-view></router-view>
|
|
|
|
</transition>
|
|
|
|
</v-layout>
|
|
|
|
</v-container>
|
|
|
|
</v-content>
|
2018-07-04 14:29:17 +02:00
|
|
|
<v-speed-dial
|
|
|
|
v-model="fab"
|
2018-01-09 17:52:26 +01:00
|
|
|
bottom
|
|
|
|
right
|
2018-11-06 10:30:27 +01:00
|
|
|
fixed
|
2018-07-04 14:29:17 +02:00
|
|
|
direction="top"
|
2018-11-06 10:30:27 +01:00
|
|
|
open-on-hover
|
2018-07-04 14:29:17 +02:00
|
|
|
transition="scale-transition"
|
2019-01-18 14:47:10 +01:00
|
|
|
v-if="currentUser"
|
2018-01-09 17:52:26 +01:00
|
|
|
>
|
2018-12-21 15:41:34 +01:00
|
|
|
<v-btn
|
2018-07-04 14:29:17 +02:00
|
|
|
slot="activator"
|
|
|
|
v-model="fab"
|
|
|
|
color="blue darken-2"
|
|
|
|
dark
|
|
|
|
fab
|
|
|
|
>
|
|
|
|
<v-icon>add</v-icon>
|
|
|
|
<v-icon>close</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
|
|
fab
|
|
|
|
dark
|
|
|
|
small
|
|
|
|
color="pink"
|
|
|
|
@click="$router.push({name: 'CreateEvent'})"
|
|
|
|
>
|
|
|
|
<v-icon>event</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
|
|
fab
|
|
|
|
dark
|
|
|
|
small
|
|
|
|
color="purple"
|
|
|
|
@click="$router.push({name: 'CreateGroup'})"
|
|
|
|
>
|
|
|
|
<v-icon>group</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
</v-speed-dial>
|
2018-01-09 17:52:26 +01:00
|
|
|
<v-footer class="indigo" app>
|
2018-11-06 10:30:27 +01:00
|
|
|
<span
|
|
|
|
class="white--text"
|
|
|
|
v-translate="{
|
|
|
|
date: new Date().getFullYear(),
|
2018-12-21 15:41:34 +01:00
|
|
|
}">© The Mobilizon Contributors %{date} - Made with Elixir, Phoenix & <a href="https://vuejs.org/">VueJS</a> & <a
|
|
|
|
href="https://www.vuetifyjs.com/">Vuetify</a> with some love and some weeks
|
2018-11-06 10:30:27 +01:00
|
|
|
</span>
|
2018-01-09 17:52:26 +01:00
|
|
|
</v-footer>
|
|
|
|
<v-snackbar
|
|
|
|
:timeout="error.timeout"
|
|
|
|
:error="true"
|
|
|
|
v-model="error.show"
|
|
|
|
>
|
|
|
|
{{ error.text }}
|
|
|
|
<v-btn dark flat @click.native="error.show = false">Close</v-btn>
|
|
|
|
</v-snackbar>
|
|
|
|
</v-app>
|
|
|
|
</template>
|
|
|
|
|
2018-12-21 15:41:34 +01:00
|
|
|
<script lang="ts">
|
2018-12-21 17:10:39 +01:00
|
|
|
import NavBar from '@/components/NavBar.vue';
|
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
2019-01-18 14:47:10 +01:00
|
|
|
import { AUTH_TOKEN, AUTH_USER_ACTOR, AUTH_USER_EMAIL, AUTH_USER_ID } from '@/constants';
|
|
|
|
import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
|
|
|
|
import { ICurrentUser } from '@/types/current-user.model'
|
2018-01-09 17:52:26 +01:00
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
@Component({
|
2019-01-18 14:47:10 +01:00
|
|
|
apollo: {
|
|
|
|
currentUser: {
|
|
|
|
query: CURRENT_USER_CLIENT
|
|
|
|
}
|
|
|
|
},
|
2018-12-21 17:10:39 +01:00
|
|
|
components: {
|
|
|
|
NavBar,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class App extends Vue {
|
|
|
|
drawer = false;
|
|
|
|
fab = false;
|
|
|
|
items = [
|
|
|
|
{
|
|
|
|
icon: 'poll', text: 'Events', route: 'EventList', role: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'group', text: 'Groups', route: 'GroupList', role: null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: 'content_copy', text: 'Categories', route: 'CategoryList', role: 'ROLE_ADMIN',
|
|
|
|
},
|
|
|
|
{ icon: 'settings', text: 'Settings', role: 'ROLE_USER' },
|
|
|
|
{ icon: 'chat_bubble', text: 'Send feedback', role: 'ROLE_USER' },
|
|
|
|
{ icon: 'help', text: 'Help', role: null },
|
|
|
|
{ icon: 'phonelink', text: 'App downloads', role: null },
|
|
|
|
];
|
|
|
|
error = {
|
|
|
|
timeout: 3000,
|
|
|
|
show: false,
|
|
|
|
text: '',
|
|
|
|
};
|
2019-01-18 14:47:10 +01:00
|
|
|
currentUser!: ICurrentUser;
|
2018-12-21 15:41:34 +01:00
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
actor = localStorage.getItem(AUTH_USER_ACTOR);
|
2018-12-21 15:41:34 +01:00
|
|
|
|
2019-01-18 14:47:10 +01:00
|
|
|
mounted () {
|
|
|
|
this.initializeCurrentUser()
|
|
|
|
}
|
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
get displayed_name () {
|
|
|
|
// FIXME: load actor
|
|
|
|
return 'no implemented';
|
|
|
|
// return this.actor.display_name === null ? this.actor.username : this.actor.display_name
|
|
|
|
}
|
2018-12-21 15:41:34 +01:00
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
showMenuItem (elem) {
|
|
|
|
// FIXME: load actor
|
|
|
|
return false;
|
|
|
|
// return elem !== null && this.user && this.user.roles !== undefined ? this.user.roles.includes(elem) : true
|
|
|
|
}
|
2018-12-21 15:41:34 +01:00
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
getUser () {
|
2019-01-18 14:47:10 +01:00
|
|
|
return this.currentUser.id ? this.currentUser : false;
|
2018-12-21 15:41:34 +01:00
|
|
|
}
|
|
|
|
|
2018-12-21 17:10:39 +01:00
|
|
|
toggleDrawer () {
|
|
|
|
this.drawer = !this.drawer;
|
|
|
|
}
|
2019-01-18 14:47:10 +01:00
|
|
|
|
|
|
|
private initializeCurrentUser() {
|
|
|
|
const userId = localStorage.getItem(AUTH_USER_ID);
|
|
|
|
const userEmail = localStorage.getItem(AUTH_USER_EMAIL);
|
|
|
|
const token = localStorage.getItem(AUTH_TOKEN);
|
|
|
|
|
|
|
|
if (userId && userEmail && token) {
|
|
|
|
return this.$apollo.mutate({
|
|
|
|
mutation: UPDATE_CURRENT_USER_CLIENT,
|
|
|
|
variables: {
|
|
|
|
id: userId,
|
|
|
|
email: userEmail,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-12-21 17:10:39 +01:00
|
|
|
}
|
2018-01-09 17:52:26 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2018-12-21 15:41:34 +01:00
|
|
|
.router-enter-active, .router-leave-active {
|
|
|
|
transition-property: opacity;
|
|
|
|
transition-duration: .25s;
|
|
|
|
}
|
2018-07-04 14:29:17 +02:00
|
|
|
|
2018-12-21 15:41:34 +01:00
|
|
|
.router-enter-active {
|
|
|
|
transition-delay: .25s;
|
|
|
|
}
|
2018-07-04 14:29:17 +02:00
|
|
|
|
2018-12-21 15:41:34 +01:00
|
|
|
.router-enter, .router-leave-active {
|
|
|
|
opacity: 0
|
|
|
|
}
|
2018-01-09 17:52:26 +01:00
|
|
|
</style>
|