minor while edit event datetime

This commit is contained in:
lesion 2019-08-07 01:26:14 +02:00
parent 18be5664fd
commit b413742c45
7 changed files with 36 additions and 13 deletions

View file

@ -4,7 +4,7 @@ div#list
el-timeline
el-timeline-item(
v-for='event in events'
:key='event.start_datetime'
:key='`${event.id}_${event.start_datetime}`'
:timestamp='event|when'
placement='top' icon='el-icon-arrow-down' size='large'
)

View file

@ -8,3 +8,14 @@
div(v-html='$t("about")')
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: mapState(['settings']),
head () {
return {
title: `${this.settings.title} - ${this.$t('common.info')}`
}
}
}
</script>

View file

@ -193,21 +193,22 @@ export default {
data.event.place.name = event.place.name
data.event.place.address = event.place.address || ''
if (event.multidate) {
data.date = { start: new Date(event.start_datetime), end: new Date(event.end_datetime) }
data.date = { start: new Date(event.start_datetime*1000), end: new Date(event.end_datetime*1000) }
data.event.type = 'multidate'
} else if (event.recurrent ) {
data.event.type = 'recurrent'
data.event.recurrent = JSON.parse(event.recurrent)
} else {
data.event.type = 'normal'
data.date = new Date(event.start_datetime)
data.date = new Date(event.start_datetime*1000)
}
data.time.start = moment(event.start_datetime).format('HH:mm')
data.time.end = moment(event.end_datetime).format('HH:mm')
data.time.start = moment.unix(event.start_datetime).format('HH:mm')
data.time.end = moment.unix(event.end_datetime).format('HH:mm')
data.event.title = event.title
data.event.description = event.description.replace(/(<([^>]+)>)/ig, '')
data.event.id = event.id
data.event.recurrent = {}
if (event.tags) {
data.event.tags = event.tags.map(t => t.tag)
}
@ -254,11 +255,13 @@ export default {
date_start.isBefore(e.start_datime) && date_end.isAfter(e.start_datetime) :
date_start.isSame(e.start_datetime, 'day') || date_start.isSame(e.end_datetime) ||
date_start.isAfter(e.start_datetime) && date_start.isBefore(e.end_datetime))
} else if (this.event.type === 'recurrent' ) {
} else {
const date = moment(this.date)
return this.events.filter(e =>
!e.multidate ?
date.isSame(moment(e.start_datetime), 'day') :
!e.recurrent && date.isSame(moment(e.start_datetime), 'day') :
moment(e.start_datetime).isSame(date, 'day') ||
moment(e.start_datetime).isBefore(date) && moment(e.end_datetime).isAfter(date)
)
@ -334,9 +337,9 @@ export default {
if (this.event.type !== 'recurrent' || !this.date || !this.date.length) return
const type = this.event.recurrent.type
if (type === 'ordinal')
return map(this.date, d => moment(d).date() )
return map(this.date, d => moment(d).date())
else if (type === 'weekday')
return map(this.date, moment(d).day()+1 )
return map(this.date, moment(d).day()+1)
},
next () {
this.activeTab = String(Number(this.activeTab)+1)
@ -402,7 +405,6 @@ export default {
end_datetime = end_datetime.add(1, 'day')
}
formData.append('recurrent', JSON.stringify(recurrent))
}
if (this.event.image) {

View file

@ -94,6 +94,9 @@ export default {
open: true,
}
},
head () {
return { title: `${this.settings.title} - ${this.$t('common.admin')}` }
},
async mounted () {
const code = this.$route.query.code

View file

@ -23,6 +23,13 @@ export default {
password: '',
}
},
name: 'Settings',
computed: mapState(['settings']),
head () {
return {
title: `${this.settings.title} - ${this.$t('common.settings')}`
}
},
async asyncData ({ $axios, params }) {
const user = await $axios.$get('/auth/user')
user.mastodon_auth = ''

View file

@ -47,7 +47,7 @@ module.exports = (sequelize, DataTypes) => {
attributedTo: `${config.baseurl}/federation/u/${username}`,
to: 'https://www.w3.org/ns/activitystreams#Public',
cc: follower ? follower: [],
content: this.title
content: `<b>${this.title}</b> @${this.place.name} <br/>${this.description.length > 200 ? this.description.substr(0, 200) + '...' : this.description} - ${this.tags.map(t => '#' + t.tag).join(' ')} <br/>${config.baseurl}/event/${this.id}`
}
}
}

View file

@ -7,7 +7,7 @@ const httpSignature = require('http-signature')
const actorCache = []
const Helpers = {
async signAndSend(message, user, to) {//, domain, req, res, targetOrigin) {
async signAndSend(message, user, to) {
// get the URI of the actor object and append 'inbox' to it
const toInbox = to + '/inbox'