[lint] linting
This commit is contained in:
@@ -118,7 +118,6 @@ import List from '@/components/List'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
name: 'newEvent',
|
||||
components: { List },
|
||||
validate ({ store }) {
|
||||
@@ -241,6 +240,7 @@ export default {
|
||||
} else if (freq === '1d') {
|
||||
return this.$t('event.recurrent_each_day')
|
||||
}
|
||||
return
|
||||
},
|
||||
todayEvents () {
|
||||
if (this.event.type === 'multidate') {
|
||||
@@ -250,11 +250,11 @@ export default {
|
||||
return this.events.filter(e =>
|
||||
!e.multidate
|
||||
? date_start.isSame(moment.unix(e.start_datetime), 'day') ||
|
||||
date_start.isBefore(moment.unix(e.start_dateime)) && date_end.isAfter(moment.unix(e.start_datetime))
|
||||
(date_start.isBefore(moment.unix(e.start_dateime)) && date_end.isAfter(moment.unix(e.start_datetime)))
|
||||
: date_start.isSame(moment.unix(e.start_datetime), 'day') || date_start.isSame(moment.unix(e.end_datetime)) ||
|
||||
date_start.isAfter(moment.unix(e.start_datetime)) && date_start.isBefore(moment.unix(e.end_datetime)))
|
||||
(date_start.isAfter(moment.unix(e.start_datetime)) && date_start.isBefore(moment.unix(e.end_datetime))))
|
||||
} else if (this.event.type === 'recurrent') {
|
||||
|
||||
return []
|
||||
} else {
|
||||
const date = moment(this.date)
|
||||
return this.events.filter(e =>
|
||||
@@ -292,13 +292,17 @@ export default {
|
||||
switch (Number(this.activeTab)) {
|
||||
case 0 + t:
|
||||
return true
|
||||
break
|
||||
case 1 + t:
|
||||
return this.event.title.length > 0
|
||||
break
|
||||
case 2 + t:
|
||||
return this.event.place.name.length > 0 &&
|
||||
this.event.place.address.length > 0
|
||||
break
|
||||
case 3 + t:
|
||||
if (this.date && this.time.start) { return true }
|
||||
break
|
||||
case 4 + t:
|
||||
return this.event.place.name.length > 0 &&
|
||||
this.event.place.address.length > 0 &&
|
||||
@@ -312,7 +316,7 @@ export default {
|
||||
recurrentDays () {
|
||||
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()) } else if (type === 'weekday') { return map(this.date, moment(d).day() + 1) }
|
||||
if (type === 'ordinal') { return map(this.date, d => moment(d).date()) } else if (type === 'weekday') { return map(this.date, d => moment(d).day() + 1) }
|
||||
},
|
||||
next () {
|
||||
this.activeTab = String(Number(this.activeTab) + 1)
|
||||
@@ -424,4 +428,4 @@ export default {
|
||||
#picker {
|
||||
max-width: 400px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import { Message, MessageBox } from 'element-ui'
|
||||
import { mapState } from 'vuex'
|
||||
import { Message } from 'element-ui'
|
||||
import Users from '../components/admin/Users'
|
||||
import Places from '../components/admin/Places'
|
||||
import Settings from '../components/admin/Settings'
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
paginatedEvents () {
|
||||
return this.events.slice((this.eventPage - 1) * this.perPage,
|
||||
this.eventPage * this.perPage)
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
preview (id) {
|
||||
|
||||
@@ -16,21 +16,20 @@
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import Event from '../../components/Event'
|
||||
import moment from 'dayjs'
|
||||
import get from 'lodash/get'
|
||||
|
||||
export default {
|
||||
layout: 'event_iframe',
|
||||
components: { Event },
|
||||
data: {
|
||||
loading: true
|
||||
data () {
|
||||
return {
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
async asyncData ({ $axios, params, error, store }) {
|
||||
try {
|
||||
const [ id, start_datetime ] = params.event_id.split('_')
|
||||
const event = await $axios.$get(`/event/${id}`)
|
||||
event.start_datetime = start_datetime ? Number(start_datetime) : event.start_datetime
|
||||
event.end_datetime = event.end_datetime
|
||||
return { event, id: Number(id) }
|
||||
} catch (e) {
|
||||
error({ statusCode: 404, message: 'Event not found' })
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
List(:events="events" :title='title')
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import List from '../../components/List'
|
||||
import moment from 'dayjs'
|
||||
import get from 'lodash/get'
|
||||
|
||||
export default {
|
||||
layout: 'iframe',
|
||||
@@ -19,7 +16,6 @@ export default {
|
||||
const title = query.title
|
||||
const tags = query.tags
|
||||
const places = query.places
|
||||
const now = new Date()
|
||||
|
||||
let params = []
|
||||
if (places) { params.push(`places=${places}`) }
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
small.mr-3 🔖 {{event.likes.length}}
|
||||
small ✊ {{event.boost.length}}<br/>
|
||||
|
||||
strong(v-if='settings.enable_comments') {{$tc('common.comments', event.comments.length)}} -
|
||||
strong(v-if='settings.enable_comments') {{$tc('common.comments', event.comments.length)}} -
|
||||
small {{$t('event.interact_with_me_at')}} <u>{{fedi_user}}@{{settings.baseurl|url2host}}</u>
|
||||
|
||||
.card-header(v-if='settings.enable_comments' v-for='comment in event.comments' :key='comment.id')
|
||||
@@ -61,37 +61,40 @@
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapActions, mapGetters } from 'vuex'
|
||||
import { MessageBox } from 'element-ui'
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import EventAdmin from './eventAdmin'
|
||||
import moment from 'dayjs'
|
||||
|
||||
export default {
|
||||
name: 'Event',
|
||||
transition: null,
|
||||
components: { EventAdmin },
|
||||
data () {
|
||||
return {
|
||||
copied: false
|
||||
}
|
||||
},
|
||||
components: { EventAdmin },
|
||||
head () {
|
||||
if (!this.event) { return {} }
|
||||
const tags_feed = this.event.tags.map(tag => ({ rel: 'alternate', type: 'application/rss+xml',
|
||||
title: `${this.settings.title} events tagged ${tag}`, href: this.settings.baseurl + `/feed/rss?tags=${tag}` }))
|
||||
const place_feed = { rel: 'alternate', type: 'application/rss+xml',
|
||||
title: `${this.settings.title} events @${this.event.place.name}`, href: this.settings.baseurl + `/feed/rss?places=${this.event.placeId}` }
|
||||
|
||||
const tags_feed = this.event.tags.map(tag => ({ rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
title: `${this.settings.title} events tagged ${tag}`,
|
||||
href: this.settings.baseurl + `/feed/rss?tags=${tag}` }))
|
||||
const place_feed = { rel: 'alternate',
|
||||
type: 'application/rss+xml',
|
||||
title: `${this.settings.title} events @${this.event.place.name}`,
|
||||
href: this.settings.baseurl + `/feed/rss?places=${this.event.placeId}` }
|
||||
|
||||
return {
|
||||
title: `${this.settings.title} - ${this.event.title}`,
|
||||
meta: [
|
||||
// hid is used as unique identifier. Do not use `vmid` for it as it will not work
|
||||
{ hid: 'description',
|
||||
name: 'description',
|
||||
content: this.event.description.replace("\n",'').slice(0, 1000) },
|
||||
content: this.event.description.replace('\n', '').slice(0, 1000) },
|
||||
{ hid: 'og-description',
|
||||
name: 'og:description',
|
||||
content: this.event.description.replace("\n",'').slice(0, 100) },
|
||||
content: this.event.description.replace('\n', '').slice(0, 100) },
|
||||
{ hid: 'og-title', property: 'og:title', content: this.event.title },
|
||||
{ hid: 'og-url', property: 'og:url', content: `${this.settings.baseurl}/event/${this.event.id}` },
|
||||
{ property: 'og:type', content: 'event' },
|
||||
@@ -99,18 +102,18 @@ export default {
|
||||
{ property: 'og:site_name', content: this.settings.title },
|
||||
{ property: 'og:updated_time', content: moment.unix(this.event.start_datetime).format() },
|
||||
{ property: 'article:published_time', content: moment.unix(this.event.start_datetime).format() },
|
||||
{ property: 'article:section', content: 'event'},
|
||||
{ property: 'twitter:card', content: 'summary'},
|
||||
{ property: 'article:section', content: 'event' },
|
||||
{ property: 'twitter:card', content: 'summary' },
|
||||
{ property: 'twitter:title', content: this.event.title },
|
||||
{ property: 'twitter:image', content: `${this.settings.baseurl}${this.imgPath}` },
|
||||
{ property: 'twitter:description', content: this.event.description.replace("\n",'').slice(0, 100) }
|
||||
{ property: 'twitter:description', content: this.event.description.replace('\n', '').slice(0, 100) }
|
||||
],
|
||||
link: [
|
||||
{ rel: 'image_src', href: `${this.settings.baseurl}${this.imgPath}` },
|
||||
{ rel: 'alternate', type: 'application/rss+xml', title: this.settings.title, href: this.settings.baseurl + '/feed/rss' },
|
||||
...tags_feed,
|
||||
place_feed
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
async asyncData ({ $axios, params, error, store }) {
|
||||
@@ -118,7 +121,6 @@ export default {
|
||||
const [ id, start_datetime ] = params.id.split('_')
|
||||
const event = await $axios.$get(`/event/${id}`)
|
||||
event.start_datetime = start_datetime ? Number(start_datetime) : event.start_datetime
|
||||
event.end_datetime = event.end_datetime
|
||||
const now = new Date()
|
||||
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
|
||||
store.commit('setEvents', events)
|
||||
@@ -168,11 +170,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
copyLink () {
|
||||
this.copied=true
|
||||
setTimeout(() => this.copied=false, 3000)
|
||||
this.copied = true
|
||||
setTimeout(() => { this.copied = false }, 3000)
|
||||
},
|
||||
comment_filter (value) {
|
||||
return value.replace(/<a.*href="([^">]+).*>(?:.(?!\<\/a\>))*.<\/a>/, (orig, url) => {
|
||||
return value.replace(/<a.*href="([^">]+).*>(?:.(?!<\/a>))*.<\/a>/, (orig, url) => {
|
||||
// get extension
|
||||
const ext = url.slice(-4)
|
||||
if (['.mp3', '.ogg'].includes(ext)) {
|
||||
@@ -181,7 +183,7 @@ export default {
|
||||
return orig
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -247,7 +249,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 768px) {
|
||||
#eventDetail {
|
||||
.menu {
|
||||
|
||||
@@ -44,4 +44,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -53,11 +53,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
import Calendar from '@/components/Calendar'
|
||||
import List from '@/components/List'
|
||||
import Search from '@/components/Search'
|
||||
|
||||
import { intersection } from 'lodash'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
@@ -68,12 +65,6 @@ export default {
|
||||
title: `${this.settings.title} - ${this.$t('common.export')}`
|
||||
}
|
||||
},
|
||||
async asyncData ({ $axios, params, store }) {
|
||||
// get metadata just in case we are not coming from home
|
||||
if (store.state.tags.length) return
|
||||
const { tags, places } = await $axios.$get('/event/meta')
|
||||
store.commit('update', { tags, places })
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
type: 'rss',
|
||||
@@ -81,6 +72,12 @@ export default {
|
||||
list: { title: 'Gancio' }
|
||||
}
|
||||
},
|
||||
async asyncData ({ $axios, params, store }) {
|
||||
// get metadata just in case we are not coming from home
|
||||
if (store.state.tags.length) { return }
|
||||
const { tags, places } = await $axios.$get('/event/meta')
|
||||
store.commit('update', { tags, places })
|
||||
},
|
||||
methods: {
|
||||
copy (msg) {
|
||||
this.$copyText(msg).then(e => console.error('ok ', e)).catch(e => console.error('err ', e))
|
||||
|
||||
@@ -13,11 +13,8 @@ import { mapState } from 'vuex'
|
||||
export default {
|
||||
name: 'Index',
|
||||
computed: mapState(['settings']),
|
||||
mounted (ctx) {
|
||||
moment.tz.setDefault(this.settings.instance_timezone)
|
||||
},
|
||||
async fetch ({ store, $axios }) {
|
||||
try {
|
||||
try {
|
||||
moment.tz.setDefault(store.state.settings.instance_timezone)
|
||||
const now = new Date()
|
||||
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
|
||||
@@ -28,6 +25,9 @@ export default {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
mounted (ctx) {
|
||||
moment.tz.setDefault(this.settings.instance_timezone)
|
||||
},
|
||||
components: { Nav, Home }
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default {
|
||||
methods: {
|
||||
async change_password () {
|
||||
try {
|
||||
const res = await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
|
||||
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
|
||||
Message({
|
||||
showClose: true,
|
||||
type: 'success',
|
||||
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
},
|
||||
async asyncData ({ $axios, params }) {
|
||||
const user = await $axios.$get('/auth/user')
|
||||
return { user, username_editable: user.username.length===0 }
|
||||
return { user, username_editable: user.username.length === 0 }
|
||||
},
|
||||
computed: {
|
||||
...mapState(['settings']),
|
||||
@@ -77,8 +77,8 @@ export default {
|
||||
cancelButtonText: this.$t('common.cancel'),
|
||||
type: 'error'
|
||||
}).then(async () => {
|
||||
this.user = await this.$axios.$put('/user', { ...this.user, password: this.password })
|
||||
}).catch( e => {
|
||||
this.user = await this.$axios.$put('/user', { ...this.user, password: this.password })
|
||||
}).catch(e => {
|
||||
Message({ message: e, showClose: true, type: 'warning' })
|
||||
})
|
||||
},
|
||||
|
||||
@@ -49,4 +49,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user