This commit is contained in:
les
2019-09-11 19:12:24 +02:00
parent 93baf01a55
commit 2fe956d117
65 changed files with 762 additions and 721 deletions

View File

@@ -19,10 +19,10 @@ import { intersection, sample, take, get } from 'lodash'
export default {
name: 'Calendar',
data () {
const month = moment().month()+1
const month = moment().month() + 1
const year = moment().year()
return {
page: { month, year},
page: { month, year }
}
},
watch: {
@@ -35,8 +35,8 @@ export default {
...mapActions(['updateEvents']),
click (day) {
const element = document.getElementById(day.day)
if (element) element.scrollIntoView(); //Even IE6 supports this
},
if (element) { element.scrollIntoView() } // Even IE6 supports this
}
},
computed: {
...mapGetters(['filteredEventsWithPast']),
@@ -45,17 +45,17 @@ export default {
// TODO: should be better
attributes () {
const colors = ['green', 'orange', 'yellow', 'teal', 'indigo', 'blue', 'red', 'purple', 'pink', 'grey']
const tags = take(this.tags, 10).map(t=>t.tag)
const tags = take(this.tags, 10).map(t => t.tag)
let attributes = []
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'green' }})
attributes.push({ key: 'today', dates: new Date(), highlight: { color: 'green' } })
const that = this
function getColor(event) {
function getColor (event) {
const color = { class: event.past && !that.filters.show_past_events ? 'past-event vc-rounded-full' : 'vc-rounded-full', color: 'blue' }
const tag = get(event, 'tags[0]')
if (!tag) return color
if (!tag) { return color }
const idx = tags.indexOf(tag)
if (idx<0) return color
if (idx < 0) { return color }
color.color = colors[idx]
return color
}
@@ -65,16 +65,19 @@ export default {
.map(e => {
const color = getColor(e)
return {
key: e.id,
key: e.id,
dot: color,
dates: new Date(e.start_datetime*1000)
}}))
dates: new Date(e.start_datetime * 1000)
}
}))
attributes = attributes.concat(this.filteredEventsWithPast
.filter(e => e.multidate)
.map( e => ({ key: e.id, highlight: getColor(e), dates: {
start: new Date(e.start_datetime*1000), end: new Date(e.end_datetime*1000) }})))
.map(e => ({ key: e.id,
highlight: getColor(e),
dates: {
start: new Date(e.start_datetime * 1000), end: new Date(e.end_datetime * 1000) } })))
return attributes
}
}

View File

@@ -11,7 +11,7 @@
h2 {{event.title}}
//- date / place
.date
.date
div <v-icon name='clock'/> {{event|when('home')}}
div <v-icon name='map-marker-alt' /> {{event.place.name}}
@@ -32,10 +32,10 @@ export default {
showImage: {
type: Boolean,
default: true
},
}
},
computed: {
date () {
date () {
return new Date(this.event.start_datetime).getDate()
},
link () {
@@ -104,7 +104,7 @@ export default {
font-weight: 400;
font-size: 1rem;
color: white;
}
}
}
.tags {

View File

@@ -36,16 +36,16 @@ export default {
// hid is used as unique identifier. Do not use `vmid` for it as it will not work
{ hid: 'description', name: 'description', content: this.settings.description },
{ hid: 'og-description', name: 'og:description', content: this.settings.description },
{ hid: 'og-title', property: 'og:title', content: this.settings.title },
{ hid: 'og-url', property: 'og:url', content: this.settings.baseurl },
{ hid: 'og-title', property: 'og:title', content: this.settings.title },
{ hid: 'og-url', property: 'og:url', content: this.settings.baseurl },
{ property: 'og:image', content: this.settings.baseurl + '/favicon.ico' }
]
}
},
components: { Calendar, Event },
data () {
return { }
},
components: { Calendar, Event },
computed: {
...mapGetters(['filteredEvents']),
...mapState(['events', 'settings'])

View File

@@ -20,17 +20,6 @@ import { mapGetters } from 'vuex'
export default {
name: 'List',
data () {
return { }
},
methods: {
link (event) {
if (event.recurrent) {
return `${event.id}_${event.start_datetime}`
}
return event.id
}
},
props: {
title: {
type: String,
@@ -52,17 +41,28 @@ export default {
},
showTags: {
type: Boolean,
default: true,
default: true
},
showImage: {
type: Boolean,
default: true,
default: true
},
showDescription: {
type: Boolean,
default: true
}
},
data () {
return { }
},
methods: {
link (event) {
if (event.recurrent) {
return `${event.id}_${event.start_datetime}`
}
return event.id
}
}
}
</script>
<style lang='less'>

View File

@@ -50,7 +50,7 @@ export default {
could_add () {
return (this.$auth.loggedIn || this.settings.allow_anon_event)
},
...mapState(['filters', 'settings']),
...mapState(['filters', 'settings'])
},
methods: {
logout () {

View File

@@ -19,10 +19,10 @@
active-text='anche passati'
inactive-color='lightgreen'
v-model='showPast'
)
)
client-only
el-select.search(v-model='filter'
multiple
multiple
filterable collapse-tags default-first-option
:placeholder='$t("common.search")')
el-option(v-for='(keyword, id) in keywords' :key='keyword.value'
@@ -31,26 +31,26 @@
</template>
<script>
import {mapState, mapActions} from 'vuex'
import { mapState, mapActions } from 'vuex'
export default {
data () {
return {
onlyMine: false,
}
},
name :'Search',
name: 'Search',
props: {
pastFilter: Boolean,
recurrentFilter: Boolean
},
data () {
return {
onlyMine: false
}
},
methods: mapActions(['setSearchPlaces', 'setSearchTags', 'showPastEvents', 'showRecurrentEvents']),
computed: {
...mapState(['tags', 'places', 'filters', 'settings']),
// TOFIX: optimize
keywords () {
const tags = this.tags.map( t => ({ value: 't' + t.tag, label: t.tag, weigth: t.weigth }))
const places = this.places.map( p => ({ value: 'p' + p.id, label: p.name, weigth: p.weigth }))
return tags.concat(places).sort((a, b) => b.weigth-a.weigth)
const tags = this.tags.map(t => ({ value: 't' + t.tag, label: t.tag, weigth: t.weigth }))
const places = this.places.map(p => ({ value: 'p' + p.id, label: p.name, weigth: p.weigth }))
return tags.concat(places).sort((a, b) => b.weigth - a.weigth)
},
showPast: {
set (value) { this.showPastEvents(value) },
@@ -70,7 +70,7 @@ export default {
get () {
return this.filters.tags.map(t => 't' + t).concat(this.filters.places.map(p => 'p' + p))
}
},
}
}
}
</script>

View File

@@ -16,43 +16,42 @@
template(slot-scope='data')
el-button(size='mini'
type='success'
@click='place = data.row') {{$t('common.edit')}}
@click='place = data.row') {{$t('common.edit')}}
client-only
el-pagination(:page-size='perPage' :currentPage.sync='placePage' :total='places.length')
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data () {
return {
data () {
return {
perPage: 10,
placePage: 0,
place: { name: '', address: '', id: null}
place: { name: '', address: '', id: null }
}
},
computed: {
...mapState(['places']),
paginatedPlaces () {
return this.places.slice((this.placePage-1) * this.perPage,
return this.places.slice((this.placePage - 1) * this.perPage,
this.placePage * this.perPage)
},
}
},
methods: {
placeSelected (items) {
if (items.length === 0 ) {
this.place.name = this.place.address = ''
return
}
const item = items[0]
this.place.name = item.name
this.place.address = item.address
this.place.id = item.id
},
placeSelected (items) {
if (items.length === 0) {
this.place.name = this.place.address = ''
return
}
const item = items[0]
this.place.name = item.name
this.place.address = item.address
this.place.id = item.id
},
async savePlace () {
const place = await this.$axios.$put('/place', this.place)
},
}
}
}
</script>

View File

@@ -55,16 +55,16 @@ export default {
userPage: 1,
new_user: {
email: '',
is_admin: false,
is_admin: false
},
users_: this.users
}
},
computed: {
paginatedUsers () {
return this.users_.slice((this.userPage-1) * this.perPage,
return this.users_.slice((this.userPage - 1) * this.perPage,
this.userPage * this.perPage)
},
}
},
methods: {
async delete_user (user) {
@@ -74,25 +74,25 @@ export default {
cancelButtonText: this.$t('common.cancel'),
type: 'error'
})
.then( () => this.$axios.delete(`/user/${user.id}`) )
.then( () => {
.then(() => this.$axios.delete(`/user/${user.id}`))
.then(() => {
Message({
showClose: true,
type: 'success',
message: this.$t('admin.user_remove_ok')
})
this.users_ = this.users_.filter(u => u.id!==user.id)
this.users_ = this.users_.filter(u => u.id !== user.id)
})
},
async toggle(user) {
async toggle (user) {
user.is_active = !user.is_active
this.$axios.$put('/user', user)
},
async toggleAdmin(user) {
async toggleAdmin (user) {
try {
user.is_admin = !user.is_admin
await this.$axios.$put('/user', user)
} catch(e) {
} catch (e) {
console.error(e)
}
},
@@ -114,7 +114,7 @@ export default {
message: this.$t(e)
})
}
},
}
}
}
</script>