gancio-upstream/components/Nav.vue

91 lines
2.2 KiB
Vue
Raw Normal View History

2019-04-03 00:25:12 +02:00
<template lang="pug">
2020-01-13 11:18:10 +01:00
div#nav
2020-02-10 00:46:44 +01:00
nuxt-link#logo(:to='$route.name==="index"?"/about":"/"')
2020-01-13 11:18:10 +01:00
img(src='/favicon.ico')
span.ml-1.hidden-xs-only {{settings.title}}
small.hidden-sm-only {{settings.description}}
2019-05-30 12:04:14 +02:00
2020-01-13 11:18:10 +01:00
el-menu#menu(mode='horizontal' router )
el-menu-item(v-if='could_add' index='/add')
i.el-icon-plus
span.hidden-xs-only {{$t('common.add_event')}}
2019-05-30 12:04:14 +02:00
2020-01-13 11:18:10 +01:00
//- nuxt-link(to='/export')
el-menu-item(index='/export')
i.el-icon-share
span.hidden-xs-only {{$t('common.share')}}
2019-05-30 12:04:14 +02:00
2020-01-13 11:18:10 +01:00
el-menu-item(v-if='!$auth.loggedIn' index='/login')
i.el-icon-user
span.hidden-xs-only {{$t('common.login')}}
2020-01-27 00:47:03 +01:00
2020-01-13 11:18:10 +01:00
el-submenu(v-if='$auth.loggedIn' index=3)
template(slot='title')
i.el-icon-user
span.hidden-xs-only {{$t('common.user')}}
el-menu-item(divided index='/settings')
i.el-icon-s-tools
span {{$t('common.settings')}}
el-menu-item(v-if='$auth.user.is_admin' index='/admin')
i.el-icon-s-operation
span {{$t('common.admin')}}
el-menu-item(@click='logout')
i.el-icon-switch-button
span {{$t('common.logout')}}
2019-05-30 12:04:14 +02:00
2020-01-13 11:18:10 +01:00
el-menu-item(type='text' v-clipboard:copy='`${settings.baseurl}/feed/rss`' v-clipboard:success='copyLink')
v-icon(color='orange' name='rss')
2019-11-03 00:53:24 +01:00
2019-04-03 00:25:12 +02:00
</template>
<script>
2019-05-30 12:04:14 +02:00
import { Message } from 'element-ui'
2019-06-25 01:05:38 +02:00
import { mapState } from 'vuex'
2019-05-30 12:04:14 +02:00
2019-04-03 00:25:12 +02:00
export default {
name: 'Nav',
2019-06-25 01:05:38 +02:00
computed: {
could_add () {
return (this.$auth.loggedIn || this.settings.allow_anon_event)
},
2019-09-11 19:12:24 +02:00
...mapState(['filters', 'settings'])
2019-06-25 01:05:38 +02:00
},
2019-05-30 12:04:14 +02:00
methods: {
2019-11-06 11:21:44 +01:00
copyLink () {
Message({ message: this.$t('common.feed_url_copied'), type: 'success', showClose: true })
},
2019-05-30 12:04:14 +02:00
logout () {
2019-11-06 11:21:44 +01:00
Message({ showClose: true, message: this.$t('common.logout_ok'), type: 'success' })
2019-05-30 12:04:14 +02:00
this.$auth.logout()
}
}
2019-04-03 00:25:12 +02:00
}
</script>
2020-01-13 11:18:10 +01:00
<style lang='less'>
2019-05-30 12:04:14 +02:00
2020-01-13 11:18:10 +01:00
#logo {
2020-01-13 11:30:42 +01:00
img {
2020-01-15 23:31:46 +01:00
max-height: 60px;
2020-01-13 11:30:42 +01:00
}
2020-01-15 23:31:46 +01:00
line-height: 60px;
2020-01-13 11:18:10 +01:00
float: left;
color: white;
font-size: 1.5em;
font-weight: 600;
text-decoration: none;
small {
font-size: 0.5em;
}
2019-05-30 12:04:14 +02:00
}
2020-01-13 11:18:10 +01:00
#menu {
float: right;
border-bottom: none;
.el-menu-item {
padding: 0px 15px;
}
2019-09-19 16:23:46 +02:00
}
2020-01-13 11:18:10 +01:00
2019-05-30 12:04:14 +02:00
</style>