s/element/vuetify :D

This commit is contained in:
les
2020-07-25 21:41:22 +02:00
parent 59811e580c
commit 2758541df0
33 changed files with 1762 additions and 1340 deletions

View File

@@ -1,5 +1,16 @@
<template lang="pug">
.announcement.announcement.text-white(body-style='padding: 0px;')
v-alert(border='left' dismissible color="deep-orange accent-2" dark close-text='antani') {{announcement.title}}
//- v-list-item(link nuxt :to='`/announcement/${announcement.id}`')
//- v-list-item-icon
//- v-icon mdi-alert
//- v-list-item-content
//- v-list-item-title
//- h2 {{announcement.title}}
//- v-list-item-subtitle(v-html='announcement.announcement')
//- v-list-item
//- v-btn(nuxt :to='`/announcement/${announcement.id}`') {{announcement.title}}
//- .announcement.announcement.text-white(body-style='padding: 0px;')
nuxt-link(:to='`/announcement/${announcement.id}`')
.title <i class='el-icon-info'/> {{announcement.title}}
@@ -23,23 +34,23 @@ export default {
}
</script>
<style lang='less'>
.announcement {
padding: 2%;
background-color: #511;
margin: 1rem 0;
border-radius: 5px;
a:hover {
text-decoration: none;
}
.title {
font-size: 1.2em;
color: white;
transition: color .2s;
&:hover {
color: #fbd6b5;
}
}
border: 2px solid #ff4500ba;
// box-shadow: inset 0px 0px 10px 0px orangered;
}
// .announcement {
// padding: 2%;
// background-color: #511;
// margin: 1rem 0;
// border-radius: 5px;
// a:hover {
// text-decoration: none;
// }
// .title {
// font-size: 1.2em;
// color: white;
// transition: color .2s;
// &:hover {
// color: #fbd6b5;
// }
// }
// border: 2px solid #ff4500ba;
// // box-shadow: inset 0px 0px 10px 0px orangered;
// }
</style>

View File

@@ -1,9 +1,9 @@
<template lang='pug'>
.editor(:class='{ "with-border": border }')
editor-menu-bubble(:editor='editor' :keep-in-bounds='true' v-slot='{ commands, isActive, getMarkAttrs, menu }')
el-button-group.menububble(:class="{ 'is-active': menu.isActive }" :style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`")
el-popover(trigger='hover' placement='bottom-start')
el-button.float-left(slot='reference' size='mini') <v-icon name='question'/>
v-button-group.menububble(:class="{ 'is-active': menu.isActive }" :style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`")
v-popover(trigger='hover' placement='bottom-start')
v-btn.float-left(slot='reference' size='mini') <v-icon name='question'/>
template
span This editor supports inline <code>markdown</code>
div <v-icon name='heading'/> Title Start a line with <code>#</code>
@@ -20,7 +20,7 @@
<v-icon name='bold' />
//- el-button(size='mini' :class='{ "is-active": isActive.italic() }' @click='commands.italic') <v-icon name='italic'/>
//- el-button(size='mini' :class='{ "is-active": isActive.underline() }' @click='commands.underline') <v-icon name='underline'/>
el-button(size='mini' :class='{ "is-active": isActive.link() }' @click='commands.link({href: ""}); $refs.link.focus(); linkActive=true') <v-icon name='link'/>
v-btn(size='mini' :class='{ "is-active": isActive.link() }' @click='commands.link({href: ""}); $refs.link.focus(); linkActive=true') <v-icon name='link'/>
input(:value='isActive.link() && getMarkAttrs("link") && getMarkAttrs("link").href || ""' ref='link' :class='{ "is-active": isActive.link() || linkActive }'
placeholder='https://' @keypress.enter='commands.link({ href: $event.target.value})')
//- el-button(size='mini' :class='{ "is-active": isActive.strike() }' @click='commands.strike') <v-icon name='strikethrough'/>
@@ -112,65 +112,65 @@ export default {
</script>
<style lang='less'>
.editor {
position: relative;
overflow-y: auto;
padding-top: 1.7em;
scrollbar-width: thin;
// .editor {
// position: relative;
// overflow-y: auto;
// padding-top: 1.7em;
// scrollbar-width: thin;
&.with-border {
border: 1px solid #ddd;
border-radius: 5px;
}
// &.with-border {
// border: 1px solid #ddd;
// border-radius: 5px;
// }
.content {
padding: 0px 5px 0px 5px;
flex: 1;
scrollbar-width: thin;
overflow-y: auto;
}
// .content {
// padding: 0px 5px 0px 5px;
// flex: 1;
// scrollbar-width: thin;
// overflow-y: auto;
// }
.menububble {
position: absolute;
display: flex;
overflow: hidden;
opacity: 0;
z-index: 1;
background: #dddddd;
transform: translateX(-50%);
border-radius: 3px;
padding: 0.07rem;
transition: opacity 0.2s, visibility 0.2s, left .2s, bottom .2s;
visibility: hidden;
// .menububble {
// position: absolute;
// display: flex;
// overflow: hidden;
// opacity: 0;
// z-index: 1;
// background: #dddddd;
// transform: translateX(-50%);
// border-radius: 3px;
// padding: 0.07rem;
// transition: opacity 0.2s, visibility 0.2s, left .2s, bottom .2s;
// visibility: hidden;
&.is-active {
opacity: 1;
visibility: visible;
}
input {
padding: 0;
margin: 1px;
display: block;
border: 0;
color: #444;
font-size: .8em;
border-radius: 3px;
line-height: 100%;
transition: width .2s;
padding-left: 5px;
flex-grow: 1;
}
// &.is-active {
// opacity: 1;
// visibility: visible;
// }
// input {
// padding: 0;
// margin: 1px;
// display: block;
// border: 0;
// color: #444;
// font-size: .8em;
// border-radius: 3px;
// line-height: 100%;
// transition: width .2s;
// padding-left: 5px;
// flex-grow: 1;
// }
.fa-icon {
width: auto;
font-size: 10px;
height: 1.4em; /* or any other relative font sizes */
/* You would have to include the following two lines to make this work in Safari */
// max-width: 100%;
max-height: 100%;
}
// .fa-icon {
// width: auto;
// font-size: 10px;
// height: 1.4em; /* or any other relative font sizes */
// /* You would have to include the following two lines to make this work in Safari */
// // max-width: 100%;
// max-height: 100%;
// }
}
}
// }
// }
</style>

View File

@@ -1,26 +1,57 @@
<template lang="pug">
.card.event.h-event.mt-1.text-white
v-card.h-event.mt-1
nuxt-link(:to='`/event/${event.id}`')
el-image(v-if='showImage && event.image_path'
lazy :src='`/media/thumb/${event.image_path}`')
.float-right
i.text-danger.el-icon-refresh(v-if='event.parentId')
.badge.text-info(v-if='settings.enable_resources && event.resources && event.resources.length') {{event.resources.length}}
//- title
.p-name.p-summary.title {{event.title}}
v-img(:src="`/media/thumb/${event.image_path}`" height="250" position="top top" class="white--text align-end")
v-list-item
v-list-item-content
v-list-item-title.headline {{ event.title }}
v-list-item-subtitle
time(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <v-icon>mdi-date</v-icon> {{ event|when }}
v-list-item-subtitle
span <v-icon>md-location-outline</v-icon> {{event.place.name}}
.card-body
//- div.d-flex.justify-content-between
//- when
time.d-block.dt-start.mt-0(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'/> {{event|when}}
//- place
.p-location.mt-1.text-warning(plain size='mini' round type='text' @click='addPlace') <i class='el-icon-location-outline'/> {{event.place.name}}
//- v-card-text
//- description
//- .p-description.description.mt-3(v-html='description')
v-card-actions
v-btn(text color='primary' nuxt :to='`/event/${event.id}`') {{$t('common.read')}}
v-spacer
v-btn(icon)
v-icon mdi-bookmark
v-btn(icon color='yellow')
v-icon mdi-share-variant
.card-footer(v-if='event.tags.length')
el-button.ml-1(type='text' plain round size='mini' v-for='tag in event.tags' :key='tag' @click='addTag(tag)') {{tag}}
//- <!-- //- v-card.event.h-event.mt-1(max-width="400")
//- p ciao
//- nuxt-link(:to='`/event/${event.id}`')
//- v-list-item
//- v-list-item-content
//- v-list-item-title(v-text='event.title')
//- v-list-item-subtitle
//- //- when
//- time.d-block.dt-start.mt-0(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'/> {{event|when}}
//- //- place
//- .p-location.mt-1.text-warning(plain size='mini' round type='text' @click='addPlace') <i class='el-icon-location-outline'/> {{event.place.name}}
//- v-img(v-if='showImage && event.image_path' height="194"
//- lazy :src='`/media/thumb/${event.image_path}`')
//- .float-right
//- i.text-danger.el-icon-refresh(v-if='event.parentId')
//- .badge.text-info(v-if='settings.enable_resources && event.resources && event.resources.length') {{event.resources.length}}
//- //- title
//- .p-name.p-summary.title {{event.title}}
//- .card-body
//- //- div.d-flex.justify-content-between
//- //- when
//- time.d-block.dt-start.mt-0(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'/> {{event|when}}
//- //- place
//- .p-location.mt-1.text-warning(plain size='mini' round type='text' @click='addPlace') <i class='el-icon-location-outline'/> {{event.place.name}}
//- //- description
//- //- .p-description.description.mt-3(v-html='description')
//- .card-footer(v-if='event.tags.length')
//- v-btn.ml-1(type='text' plain rounded size='mini' v-for='tag in event.tags' :key='tag' @click='addTag(tag)') {{tag}} -->
</template>
<script>
import { mapState, mapActions } from 'vuex'
@@ -66,3 +97,65 @@ export default {
}
}
</script>
<style lang="less" scoped>
.h-event {
width: 300px;
max-width: 450px;
flex-grow: 1;
margin: .2em;
background-color: #202020;
overflow: hidden;
}
// a:hover {
// text-decoration: none;
// .title {
// border-bottom: 1px solid #888;
// color: white;
// }
// }
// .title {
// margin-left: 1rem;
// margin-top: 1rem;
// margin-right: 1rem;
// border-bottom: 1px solid #333;
// transition: border-color .5s;
// font-size: 1.2em;
// max-height: 3em;
// overflow: hidden;
// color: white;
// font-weight: bold;
// }
// .card-footer {
// max-height: 4.5em;
// overflow: hidden;
// padding: .25rem 0.5rem;
// line-height: 1.8rem;
// min-height: 2.2rem;
// }
// .card-body {
// overflow: hidden;
// }
// .description {
// color: #999;
// font-size: 0.8em;
// overflow: hidden;
// max-height: 100%;
// }
// .el-image { width: 100% }
// .v-image {
// .v-image__image {
// height: 250px;
// }
// height: 250px;
// background-position: top;
// // width: 100%;
// // object-fit: cover;
// // object-position: top;
// }
// }
</style>

15
components/Footer.vue Normal file
View File

@@ -0,0 +1,15 @@
<template lang="pug">
v-footer(app absolute)
v-btn(text href='https://gancio.org') Gancio {{settings.version}}
v-btn(v-if='settings.enable_federation' text rel='me' @click.prevent='showFollowMe=true') follow me
v-btn(nuxt to='/about' text) about
v-btn(href='https://blog.gancio.org' text) blog
v-btn(href='https://framagit.org/les/gancio' text) source
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: mapState(['settings'])
}
</script>

View File

@@ -1,5 +1,5 @@
<template lang="pug">
section#home
v-container#home(fluid)
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
#calbar.row.mt-2.mb-2
.col-xl-7.col-lg-7.col-sm-6.col-xs-12
@@ -10,7 +10,6 @@
Search(past-filter recurrent-filter)
#events
//- Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
Event(v-for='event in events' :key='event.id' :event='event')
</template>
@@ -27,6 +26,7 @@ export default {
components: { Calendar, Event, Search, Announcement },
computed: {
events () {
console.error('dentro computed di events in HOME!')
return this.in_past ? this.filteredEventsWithPast : this.filteredEvents
},
...mapGetters(['filteredEvents', 'filteredEventsWithPast']),
@@ -51,10 +51,14 @@ export default {
}
</script>
<style lang='less'>
#calbar {
max-width: 1000px;
// margin: 0 auto;
}
// #calbar {
// max-width: 1000px;
// // margin: 0 auto;
// }
// #home {
// max-width: 1600px;
// }
#events {
max-width: 1600px;
margin: 0 auto;

View File

@@ -1,53 +1,123 @@
<template lang="pug">
el-header#header
nuxt-link#logo(:to='$route.name==="index"?"/about":"/"')
img(src='/favicon.ico')
span.ml-1.hidden-xs-only {{settings.title}}
small.hidden-sm-only {{settings.description}}
v-app-bar(app)
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')}}
//- logo, title and description
v-list-item(:to='$route.name==="index"?"/about":"/"')
v-list-item-avatar(tile)
v-img(src='/logo.png')
v-list-item-content.d-none.d-sm-flex
v-list-item-title
h2 {{settings.title}}
v-list-item-subtitle {{settings.description}}
//- nuxt-link(to='/export')
el-menu-item(index='/export')
i.el-icon-share
span.hidden-xs-only {{$t('common.share')}}
v-spacer
el-submenu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length' index=4)
template(slot='title')
i.el-icon-guide
span.hidden-xs-only {{$t('common.places')}}
el-menu-item(v-for='instance in settings.trusted_instances' :key='instance.name')
a(:href='instance.url' target='_link')
img.mr-1(:src='`${instance.url}/favicon.ico`' style='height: 25px;')
span.ml-1 {{instance.label || instance.name}}
v-tooltip(bottom) {{$t('common.add')}}
template(v-slot:activator='{ on }')
v-btn(v-if='could_add' icon nuxt to='/add' v-on='on')
v-icon mdi-calendar-plus
el-menu-item(v-if='!$auth.loggedIn' index='/login')
i.el-icon-user
span.hidden-xs-only {{$t('common.login')}}
v-tooltip(bottom) {{$t('common.share')}}
template(v-slot:activator='{ on }')
v-btn(icon nuxt to='/export' v-on='on')
v-icon mdi-share-variant
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')}}
v-menu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length'
offset-y bottom open-on-hover transition="slide-y-transition")
template(v-slot:activator="{ on, attrs }")
v-btn(icon v-bind='attrs' v-on='on')
v-icon mdi-map-marker-path
v-list
v-list-item(v-for='instance in settings.trusted_instances'
:key='instance.name'
:href='instance.url'
two-line)
v-list-item-avatar
v-img(:src='`${instance.url}/favicon.ico`')
v-list-item-content
v-list-item-title {{instance.name}}
v-list-item-subtitle {{instance.label}}
el-menu-item(type='text' v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
v-icon(color='orange' name='rss')
v-btn(v-if='!$auth.loggedIn' icon nuxt to='/login')
v-icon mdi-login
v-menu(v-else
offset-y bottom open-on-hover transition="slide-y-transition")
template(v-slot:activator="{ on, attrs }")
v-btn(icon v-bind='attrs' v-on='on')
v-icon mdi-dots-vertical
v-list
v-list-item(nuxt to='/settings')
v-list-item-icon
v-icon mdi-cog
v-list-item-content
v-list-item-title {{$t('common.settings')}}
v-list-item(v-if='$auth.user.is_admin' nuxt to='/admin')
v-list-item-icon
v-icon mdi-account
v-list-item-content
v-list-item-title {{$t('common.admin')}}
v-list-item(@click='logout')
v-list-item-icon
v-icon mdi-logout
v-list-item-content
v-list-item-title {{$t('common.logout')}}
v-btn(icon v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
v-icon(color='orange') mdi-rss
//- el-menu-item(type='text' v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
//- v-icon(color='orange' name='rss')
//- el-header#header
//- img(src='/favicon.ico')
//- span.ml-1.hidden-xs-only {{settings.title}}
//- small.hidden-sm-only {{settings.description}}
//- 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')}}
//- //- nuxt-link(to='/export')
//- el-menu-item(index='/export')
//- i.el-icon-share
//- span.hidden-xs-only {{$t('common.share')}}
//- el-submenu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length' index=4)
//- template(slot='title')
//- i.el-icon-guide
//- span.hidden-xs-only {{$t('common.places')}}
//- el-menu-item(v-for='instance in settings.trusted_instances' :key='instance.name')
//- a(:href='instance.url' target='_link')
//- img.mr-1(:src='`${instance.url}/favicon.ico`' style='height: 25px;')
//- span.ml-1 {{instance.label || instance.name}}
//- el-menu-item(v-if='!$auth.loggedIn' index='/login')
//- i.el-icon-user
//- span.hidden-xs-only {{$t('common.login')}}
//- 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')}}
//- el-menu-item(type='text' v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
//- v-icon(color='orange' name='rss')
</template>
<script>
import { Message } from 'element-ui'
import { mapState } from 'vuex'
export default {
@@ -72,14 +142,18 @@ export default {
},
could_add () {
return (this.$auth.loggedIn || this.settings.allow_anon_event)
},
}
},
methods: {
copyLink () {
Message({ message: this.$t('common.feed_url_copied'), type: 'success', showClose: true })
this.$root.$emit('message', {
message: this.$t('common.feed_url_copied')
})
},
logout () {
Message({ showClose: true, message: this.$t('common.logout_ok'), type: 'success' })
this.$root.$emit('message', {
message: this.$t('common.logout_ok')
})
this.$auth.logout()
},
async createTrustedInstance () {
@@ -110,32 +184,32 @@ export default {
</script>
<style lang='less'>
#header {
display: inline;
#logo {
img {
max-height: 60px;
}
float: left;
line-height: 60px;
color: white;
font-size: 1.5em;
font-weight: 600;
text-decoration: none;
small {
font-size: 0.5em;
}
}
// #header {
// display: inline;
// #logo {
// img {
// max-height: 60px;
// }
// float: left;
// line-height: 60px;
// color: white;
// font-size: 1.5em;
// font-weight: 600;
// text-decoration: none;
// small {
// font-size: 0.5em;
// }
// }
#menu {
position: absolute;
right: 10px;
top: 0px;
border-bottom: none;
.el-menu-item {
padding: 0px 15px;
}
}
}
// #menu {
// position: absolute;
// right: 10px;
// top: 0px;
// border-bottom: none;
// .el-menu-item {
// padding: 0px 15px;
// }
// }
// }
</style>

View File

@@ -1,17 +1,17 @@
<template lang="pug">
el-main#search
el-switch.mt-1.mb-2.ml-2.d-block(
v-container
v-switch.mt-0(
v-if='recurrentFilter && settings.allow_recurrent_event'
:active-text="$t('event.show_recurrent')"
inset color='primary'
:label="$t('event.show_recurrent')"
v-model='showRecurrent')
el-switch.mt-1.mb-2.ml-2.d-block(
v-if='pastFilter'
:active-text="$t('event.show_past')"
v-switch.mt-0(
v-if='pastFilter' inset color='primary'
:label="$t('event.show_past')"
v-model='showPast')
el-autocomplete.mb-1#searchInput.inline-input(:placeholder='$t("common.filter")' prefix-icon='el-icon-search'
highlight-first-item
v-autocomplete#searchInput.mt-0(:placeholder='$t("common.filter")'
v-model='search' :debounce='200'
:fetch-suggestions='querySearch' clearable
@select='addFilter')
@@ -20,9 +20,9 @@
i.float-right.el-icon-place(v-if='item.type==="place"')
i.float-right.el-icon-collection-tag(v-if='item.type==="tag"')
#filters
el-button.mr-1.bg-dark(type='text' round plain v-for='t in filters.tags' size='mini'
v-vtn.mr-1.bg-dark(type='text' round plain v-for='t in filters.tags' size='mini'
:key='t' @click='removeTag(t)') {{t}}
el-button.mr-1.bg-dark.text-warning(type='text' round plain v-for='p in selectedPlaces' size='mini'
v-btn.mr-1.bg-dark.text-warning(type='text' round plain v-for='p in selectedPlaces' size='mini'
:key='p.id' @click='removePlace(p.id)') {{p.name}}
</template>
@@ -91,36 +91,36 @@ export default {
}
</script>
<style lang='less'>
#search {
#searchInput {
border: none;
border-radius: 0px;
border-bottom: 2px solid lightgray;
color: white;
background-color: #111;
}
// #search {
// #searchInput {
// border: none;
// border-radius: 0px;
// border-bottom: 2px solid lightgray;
// color: white;
// background-color: #111;
// }
.el-switch__label {
color: #aaa;
}
// .el-switch__label {
// color: #aaa;
// }
.el-switch__label.is-active {
color: lightgreen;
}
// .el-switch__label.is-active {
// color: lightgreen;
// }
.el-switch__core {
background-color: #555;
border-color: #777;
}
// .el-switch__core {
// background-color: #555;
// border-color: #777;
// }
.is-checked .el-switch__core {
background-color: lightgreen;
}
// .is-checked .el-switch__core {
// background-color: lightgreen;
// }
#filters {
line-height: 2rem;
}
}
// #filters {
// line-height: 2rem;
// }
// }
</style>

39
components/Snackbar.vue Normal file
View File

@@ -0,0 +1,39 @@
<template lang='pug'>
v-snackbar(
v-model="active"
:color="color"
:bottom="bottom"
:top="top"
:left="left"
:right="right"
:timeout="timeout")
v-icon.mr-3(color="white") {{icon}}
span {{ message }}
template(v-slot:action="{ }")
v-icon(size="16" @click="active = false") mdi-close-circle
</template>
<script>
export default {
data () {
return {
icon: 'md-alert',
color: 'primary',
bottom: true,
top: false,
left: false,
right: true,
active: false,
timeout: 5000,
message: ''
}
},
created () {
this.$root.$on('message', snackbar => {
this.active = true
this.message = snackbar.message
this.color = snackbar.color || 'primary'
})
}
}
</script>

View File

@@ -1,26 +1,22 @@
<template lang='pug'>
div
p(v-html="$t('admin.announcement_description')")
br
el-input(v-model='announcement.title' :placeholder='$t("common.title")')
v-container
v-subheader(v-html="$t('admin.announcement_description')")
v-text-field(v-model='announcement.title' :placeholder='$t("common.title")')
Editor.mt-2(v-model='announcement.announcement' border no-save style='max-height: 400px;')
el-button.mt-2.float-right(@click='save' type='success' plain) {{$t(`common.${editing?'save':'send'}`)}}
v-btn.mt-2(@click='save' type='success' plain) {{$t(`common.${editing?'save':'send'}`)}}
el-table(:data='announcements' small)
el-table-column(:label="$t('common.title')" width='250')
template(slot-scope='data')
span(slot='reference') {{data.row.title}}
v-data-table(:items='announcements')
el-table-column(:label="$t('common.actions')")
template(slot-scope='data')
el-button-group
el-button(size='mini' type='primary'
@click='edit(data.row)') {{$t('common.edit')}}
el-button(size='mini'
:type='data.row.visible?"warning":"success"'
@click='toggle(data.row)') {{data.row.visible?$t('common.deactivate'):$t('common.activate')}}
el-button(size='mini' type='danger'
@click='remove(data.row)') {{$t('common.delete')}}
//- el-table-column(:label="$t('common.actions')")
//- template(slot-scope='data')
//- el-button-group
//- el-button(size='mini' type='primary'
//- @click='edit(data.row)') {{$t('common.edit')}}
//- el-button(size='mini'
//- :type='data.row.visible?"warning":"success"'
//- @click='toggle(data.row)') {{data.row.visible?$t('common.deactivate'):$t('common.activate')}}
//- el-button(size='mini' type='danger'
//- @click='remove(data.row)') {{$t('common.delete')}}
</template>
<script>

View File

@@ -1,47 +1,72 @@
<template lang="pug">
el-main
el-switch.d-block(v-model='enable_federation' :active-text="$t('admin.enable_federation')")
small.text-secondary {{$t('admin.enable_federation_help')}}
v-container
v-switch(v-model='enable_federation'
:label="$t('admin.enable_federation')"
persistent-hint
inset
:hint="$t('admin.enable_federation_help')"
)
template(v-if='enable_federation')
el-switch.d-block.mt-4(v-model='enable_resources' :active-text="$t('admin.enable_resources')")
small.text-secondary {{$t('admin.enable_resources_help')}}
v-switch.mt-4(v-model='enable_resources'
:label="$t('admin.enable_resources')"
:hint="$t('admin.enable_resources_help')"
persistent-hint inset)
el-switch.d-block.mt-4(v-model='hide_boosts' :active-text="$t('admin.hide_boost_bookmark')")
small.text-secondary {{$t('admin.hide_boost_bookmark_help')}}
v-switch.mt-4(v-model='hide_boosts'
:label="$t('admin.hide_boost_bookmark')"
:hint="$t('admin.hide_boost_bookmark_help')"
persistent-hint inset)
div.mt-4 {{$t('admin.instance_name')}}
el-input(v-model='instance_name' placeholder='Instance name' @blur='save("instance_name", instance_name)')
small.d-block.text-secondary {{$t('admin.instance_name_help')}} (<u>@{{instance_name}}@{{settings.baseurl|url2host}}</u>)
//- div.mt-4 {{$t('admin.instance_name')}}
v-text-field.mt-5(v-model='instance_name'
:label="$t('admin.instance_name')"
:hint="`${$t('admin.instance_name_help')} (@${instance_name}@${settings.baseurl|url2host})`"
placeholder='Instance name' persistent-hint
@blur='save("instance_name", instance_name)')
el-switch.d-block.mt-4(v-model='enable_trusted_instances' :active-text="$t('admin.enable_trusted_instances')")
small.text-secondary {{$t('admin.trusted_instances_help')}}
v-switch.mt-4(v-model='enable_trusted_instances'
:label="$t('admin.enable_trusted_instances')"
persistent-hint inset
:hint="$t('admin.trusted_instances_help')")
template(v-if='enable_trusted_instances')
div.mt-4 {{$t('admin.instance_place')}}
el-input(v-model='instance_place' @blur='save("instance_place", instance_place)')
small.d-block.text-secondary {{$t('admin.instance_place_help')}}
v-text-field.mt-4(v-model='instance_place'
:label="$t('admin.instance_place')"
persistent-hint
:hint="$t('admin.instance_place_help')"
@blur='save("instance_place", instance_place)'
)
div.mt-4 {{$t('admin.add_trusted_instance')}}
el-input(v-model='instance_url' :placeholder="$t('common.url')")
el-button(slot='append' @click='createTrustedInstance') {{$t('common.send')}}
//- div.mt-4 {{$t('admin.add_trusted_instance')}}
v-text-field.mt-4(v-model='instance_url'
:full-width='false'
persistent-hint
:hint="$t('admin.add_trusted_instance')"
:label="$t('common.url')"
append-outer-icon="mdi-send"
@click:append-outer='createTrustedInstance'
)
el-table(:data='settings.trusted_instances')
el-table-column(:label="$t('common.name')")
template(slot-scope='data')
span {{data.row.name}}
el-table-column(:label="$t('common.url')")
template(slot-scope='data')
span {{data.row.url}}
el-table-column(:label="$t('common.place')")
template(slot-scope='data')
span {{data.row.label}}
el-table-column(:label="$t('common.actions')")
template(slot-scope='data')
el-button(size='mini'
type='danger'
@click='deleteInstance(data.row)') {{$t('admin.delete_user')}}
v-data-table.mt-4(
:headers='headers'
:items='settings.trusted_instances'
)
//- el-table-column(:label="$t('common.name')")
//- template(slot-scope='data')
//- span {{data.row.name}}
//- el-table-column(:label="$t('common.url')")
//- template(slot-scope='data')
//- span {{data.row.url}}
//- el-table-column(:label="$t('common.place')")
//- template(slot-scope='data')
//- span {{data.row.label}}
//- el-table-column(:label="$t('common.actions')")
//- template(slot-scope='data')
//- el-button(size='mini'
//- type='danger'
//- @click='deleteInstance(data.row)') {{$t('admin.delete_user')}}
</template>
<script>
@@ -51,11 +76,12 @@ import axios from 'axios'
export default {
name: 'Federation',
data ({ $store }) {
data ({ $store, $options }) {
return {
instance_url: '',
instance_name: $store.state.settings.instance_name,
instance_place: $store.state.settings.instance_place
instance_place: $store.state.settings.instance_place,
url2host: $options.filters.url2host
}
},
computed: {
@@ -77,6 +103,9 @@ export default {
set (value) { this.setSetting({ key: 'enable_trusted_instances', value }) }
}
},
mounted () {
console.error(this.$options.filters)
},
methods: {
...mapActions(['setSetting']),
async createTrustedInstance () {

View File

@@ -1,44 +1,33 @@
<template lang='pug'>
div
p(v-html="$t('admin.place_description')")
el-form.mb-2(inline label-width='120px')
el-form-item(:label="$t('common.name')")
el-input.mr-1(:placeholder='$t("common.name")' v-model='place.name')
el-form-item(:label="$t('common.address')")
el-input.mr-1(:placeholder='$t("common.address")' v-model='place.address')
el-button(variant='primary' @click='savePlace') {{$t('common.save')}}
v-container
v-subheader(v-html="$t('admin.place_description')")
v-form.mb-2
//- el-form-item(:label="$t('common.name')")
//- el-input.mr-1(:placeholder='$t("common.name")' v-model='place.name')
v-text-field(
:label="$t('common.name')"
v-model='place.name'
:placeholder='$t("common.name")')
el-table(:data='paginatedPlaces' small)
el-table-column(:label="$t('common.name')" width='200')
template(slot-scope='data') {{data.row.name}}
el-table-column(:label="$t('common.address')" width='400')
template(slot-scope='data') {{data.row.address}}
el-table-column(:label="$t('common.actions')" width='200')
template(slot-scope='data')
el-button(size='mini'
type='success'
@click='place = data.row') {{$t('common.edit')}}
v-text-field(
:label="$t('common.address')"
v-model='place.address'
:placeholder='$t("common.address")')
client-only
el-pagination(v-if='places.length>perPage' :page-size='perPage' :currentPage.sync='placePage' :total='places.length')
v-btn(@click='savePlace') {{$t('common.save')}}
v-data-table(
:items='places')
</template>
<script>
import { mapState } from 'vuex'
export default {
data () {
return {
perPage: 10,
placePage: 1,
place: { name: '', address: '', id: null }
}
},
computed: {
...mapState(['places']),
paginatedPlaces () {
return this.places.slice((this.placePage - 1) * this.perPage,
this.placePage * this.perPage)
}
},
computed: mapState(['places']),
methods: {
placeSelected (items) {
if (items.length === 0) {
@@ -51,7 +40,7 @@ export default {
this.place.id = item.id
},
async savePlace () {
const place = await this.$axios.$put('/place', this.place)
await this.$axios.$put('/place', this.place)
}
}
}

View File

@@ -1,50 +1,73 @@
<template lang="pug">
el-main
v-container
//- select timezone
div {{$t('admin.select_instance_timezone')}}
el-select(v-model='instance_timezone' filterable
@input.native='queryTz=$event.target.value' @change='queryTz=""'
default-first-option placeholder='Timezone, type to search')
el-option(v-for='timezone in filteredTimezones' :key='timezone.value' :value='timezone.value')
span.float-left {{timezone.value}}
small.float-right.text-danger {{timezone.offset}}
small.d-block.text-secondary {{$t('admin.instance_timezone_description')}}
v-autocomplete(v-model='instance_timezone'
:label="$t('admin.select_instance_timezone')"
:hint="$t('admin.instance_timezone_description')"
:items="filteredTimezones"
persistent-hint
item-text='value'
item-value='value'
placeholder='Timezone, type to search')
template(v-slot:item='{ item }')
v-list-item-content
v-list-item-title {{item.value}}
v-list-item-subtitle {{item.offset}}
div.mt-4 {{$t('admin.instance_locale')}}
el-select(v-model='instance_locale')
el-option(v-for='locale in Object.keys(locales)' :key='locale' :label='locales[locale]' :value='locale')
small.d-block.text-secondary {{$t('admin.instance_locale_description')}}
v-select.mt-5(
v-model='instance_locale'
:label="$t('admin.instance_locale')"
:hint="$t('admin.instance_locale_description')"
persistent-hint
item-text='locale'
item-value='locale'
:items='locales'
)
div.mt-4 {{$t('common.title')}}
el-input(v-model='title' @blur='save("title", title)')
small.d-block.text-secondary {{$t('admin.title_description')}}
v-text-field.mt-5(v-model='title'
:label="$t('common.title')"
:hint="$t('admin.title_description')"
@blur='save("title", title)'
persistent-hint
)
div.mt-4 {{$t('common.description')}}
el-input(v-model='description' @blur='save("description", description)')
small.d-block.text-secondary {{$t('admin.description_description')}}
v-text-field.mt-5(v-model='description'
:label="$t('common.description')"
:hint="$t('admin.description_description')"
persistent-hint
@blur='save("description", description)')
div.mt-4 {{$t('admin.favicon')}}
el-upload(ref='upload'
:action='`${settings.baseurl}/api/settings/logo`'
:on-success="forceLogoReload"
name='logo'
:show-file-list="true"
accept='image/png'
:limit='1'
:multiple='false')
el-button-group
el-button(size='small' type='primary' plain) Select file
el-button(size='small' type='success' plain @click='resetLogo') Reset
.el-upload__tip(slot='tip') png files with a size less than 500kb
el-image(:src='`${settings.baseurl}/favicon.ico?${logoKey}`')
el-switch.d-block.mt-4(v-model='allow_registration'
:active-text="$t('admin.allow_registration_description')")
el-switch.d-block.mt-4(v-model='allow_anon_event' :active-text="$t('admin.allow_anon_event')")
v-file-input.mt-5(ref='upload'
:label="$t('admin.favicon')"
:action='`${settings.baseurl}/api/settings/logo`'
:on-success="forceLogoReload"
name='logo'
:show-file-list="true"
accept='image/png'
:limit='1'
:multiple='false')
//- el-button-group
el-button(size='small' type='primary' plain) Select file
el-button(size='small' type='success' plain @click='resetLogo') Reset
v-img(:src='`${settings.baseurl}/favicon.ico?${logoKey}`')
el-switch.d-block.mt-4(v-model='allow_recurrent_event' :active-text="$t('admin.allow_recurrent_event')")
v-switch.mt-5(v-model='allow_registration'
inset
:label="$t('admin.allow_registration_description')")
el-switch.d-block.mt-4(v-if='allow_recurrent_event'
v-model='recurrent_event_visible' :active-text="$t('admin.recurrent_event_visible')")
v-switch.mt-4(v-model='allow_anon_event'
inset
:label="$t('admin.allow_anon_event')")
v-switch.mt-4(v-model='allow_recurrent_event'
inset
:label="$t('admin.allow_recurrent_event')")
v-switch.mt-4(v-if='allow_recurrent_event'
v-model='recurrent_event_visible'
inset
:label="$t('admin.recurrent_event_visible')")
</template>
<script>
@@ -57,7 +80,6 @@ export default {
name: 'Settings',
data ({ $store }) {
return {
queryTz: '',
title: $store.state.settings.title,
description: $store.state.settings.description,
locales,
@@ -92,10 +114,7 @@ export default {
},
filteredTimezones () {
const current_timezone = moment.tz.guess()
const query = this.queryTz.toLowerCase()
const ret = _(moment.tz.names())
.filter(tz => tz !== current_timezone && (!query || tz.toLowerCase().includes(query)))
.take(10)
.unshift(current_timezone)
.map(tz => ({ value: tz, offset: moment().tz(tz).format('z Z') }))
.value()

View File

@@ -1,41 +1,54 @@
<template lang="pug">
div
//- ADD NEW USER
el-collapse
el-collapse-item
template(slot='title')
el-button(type='text' mini size='mini') <v-icon name='plus'/> {{$t('common.new_user')}}
el-form(inline @submit.native.prevent='create_user')
el-form-item(:label="$t('common.email')")
el-input(v-model='new_user.email')
el-form-item(:label="$t('common.admin')")
el-switch(v-model='new_user.is_admin')
el-button.float-right(@click='create_user' type='success' plain) {{$t('common.send')}}
el-alert.mb-1(type='info' show-icon :closable='false') {{$t('admin.user_add_help')}}
v-container
//- USERS LIST
el-table(:data='paginatedUsers' small)
el-table-column(label='Email' width='220')
template(slot-scope='data')
el-popover(trigger='hover' :content='data.row.description' width='400')
span(slot='reference') {{data.row.email}}
el-table-column(:label="$t('common.actions')")
template(slot-scope='data')
div(v-if='data.row.id!==$auth.user.id')
el-button-group
el-button(size='mini'
:type='data.row.is_active?"warning":"success"'
@click='toggle(data.row)') {{data.row.is_active?$t('common.deactivate'):$t('common.activate')}}
el-button(size='mini'
:type='data.row.is_admin?"danger":"warning"'
@click='toggleAdmin(data.row)') {{data.row.is_admin?$t('admin.remove_admin'):$t('common.admin')}}
el-button(size='mini'
type='danger'
@click='delete_user(data.row)') {{$t('admin.delete_user')}}
div(v-else)
span {{$t('common.me')}}
client-only
el-pagination(:page-size='perPage' :currentPage.sync='userPage' v-if='perPage<users_.length' :total='users_.length')
//- ADD NEW USER
v-dialog(v-model='newUser' width='500')
template(v-slot:activator="{ on }")
v-btn(text v-on='on') <v-icon>mdi-plus</v-icon> {{$t('common.new_user')}}
v-card
v-card-title <v-icon name='plus'/> {{$t('common.new_user')}}
v-card-text
v-form(inline @submit.native.prevent='create_user')
v-text-field(v-model='new_user.email'
:label="$t('common.email')")
v-switch(v-model='new_user.is_admin' :label="$t('common.admin')" inset)
v-alert(type='info' :closable='false') {{$t('admin.user_add_help')}}
v-card-actions
v-btn(@click='create_user' color='success' plain) {{$t('common.send')}}
//- USERS LIST
v-data-table(
:headers='headers'
:items='users')
template(v-slot:item.actions='{item}')
v-btn(text small @click='toggle(item)'
:color='item.is_active?"warning":"success"') {{item.is_active?$t('common.deactivate'):$t('common.activate')}}
v-btn(text small @click='toggleAdmin(item)'
:color='item.is_admin?"warning":"error"') {{item.is_admin?$t('common.remove_admin'):$t('common.admin')}}
v-btn(text small @click='deleteUser(item)'
:color='danger') {{$t('admin.delete_user')}}
//- el-table-column(label='Email' width='220')
//- template(slot-scope='data')
//- el-popover(trigger='hover' :content='data.row.description' width='400')
//- span(slot='reference') {{data.row.email}}
//- el-table-column(:label="$t('common.actions')")
//- template(slot-scope='data')
//- div(v-if='data.row.id!==$auth.user.id')
//- el-button-group
//- el-button(size='mini'
//- :type='data.row.is_active?"warning":"success"'
//- @click='toggle(data.row)') {{data.row.is_active?$t('common.deactivate'):$t('common.activate')}}
//- el-button(size='mini'
//- :type='data.row.is_admin?"danger":"warning"'
//- @click='toggleAdmin(data.row)') {{data.row.is_admin?$t('admin.remove_admin'):$t('common.admin')}}
//- el-button(size='mini'
//- type='danger'
//- @click='delete_user(data.row)') {{$t('admin.delete_user')}}
//- div(v-else)
//- span {{$t('common.me')}}
//- v-pagination(:page-size='perPage' :currentPage.sync='userPage' v-if='perPage<users_.length' :total='users_.length')
</template>
<script>
@@ -44,27 +57,24 @@ import { mapState } from 'vuex'
export default {
name: 'Users',
props: ['users'],
props: {
users: { type: Array, default: () => [] }
},
data () {
return {
perPage: 10,
userPage: 1,
new_user: {
email: '',
is_admin: false
},
users_: this.users
}
},
computed: {
...mapState(['settings']),
paginatedUsers () {
return this.users_.slice((this.userPage - 1) * this.perPage,
this.userPage * this.perPage)
headers: [
{ value: 'email', text: 'Email' },
{ value: 'actions', text: 'Actions', align: 'right' }
]
}
},
computed: mapState(['settings']),
methods: {
delete_user (user) {
deleteUser (user) {
MessageBox.confirm(this.$t('admin.delete_user_confirm'),
this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),