minor
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
el-button
|
el-button
|
||||||
v-icon(name='times' color='red')
|
v-icon(name='times' color='red')
|
||||||
h5 {{edit?$t('common.edit_event'):$t('common.add_event')}}
|
h5 {{edit?$t('common.edit_event'):$t('common.add_event')}}
|
||||||
|
|
||||||
el-form
|
el-form
|
||||||
no-ssr
|
no-ssr
|
||||||
el-tabs.mb-2(v-model='activeTab')
|
el-tabs.mb-2(v-model='activeTab')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
el-card#eventDetail(v-loading='!loaded')
|
el-card#eventDetail(v-loading='!loaded')
|
||||||
//- close button
|
//- close button
|
||||||
nuxt-link.float-right(to='/')
|
nuxt-link.float-right(to='/')
|
||||||
el-button(type='danger' plain circle)
|
el-button(type='danger' plain)
|
||||||
v-icon(name='times')
|
v-icon(name='times')
|
||||||
|
|
||||||
div(v-if='!event')
|
div(v-if='!event')
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
h5.text-center {{event.title}}
|
h5.text-center {{event.title}}
|
||||||
div.nextprev
|
div.nextprev
|
||||||
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
|
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
|
||||||
el-button( round type='success')
|
el-button(round type='success')
|
||||||
v-icon(name='chevron-left')
|
v-icon(name='chevron-left')
|
||||||
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
|
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
|
||||||
el-button(round type='success')
|
el-button(round type='success')
|
||||||
@@ -89,6 +89,15 @@ export default {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async fetch ({ $axios, store }) {
|
||||||
|
try {
|
||||||
|
const now = new Date()
|
||||||
|
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
|
||||||
|
return store.commit('setEvents', events)
|
||||||
|
} catch(e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
},
|
||||||
async asyncData ( { $axios, params }) {
|
async asyncData ( { $axios, params }) {
|
||||||
const event = await $axios.$get(`/event/${params.id}`)
|
const event = await $axios.$get(`/event/${params.id}`)
|
||||||
const loaded = !event.image_path
|
const loaded = !event.image_path
|
||||||
|
|||||||
@@ -82,15 +82,18 @@ const eventController = {
|
|||||||
res.json(place)
|
res.json(place)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// TODO retrieve next/prev event also
|
||||||
|
// select id, start_datetime, title from events where start_datetime > (select start_datetime from events where id=89) order by start_datetime limit 20;
|
||||||
|
// weigth is not updated
|
||||||
async get(req, res) {
|
async get(req, res) {
|
||||||
const id = req.params.event_id
|
const id = req.params.event_id
|
||||||
const event = await Event.findByPk(id, { include:
|
const event = await Event.findByPk(id, {
|
||||||
[
|
include: [
|
||||||
Tag,
|
Tag,
|
||||||
Comment,
|
Comment,
|
||||||
{ model: Place, attributes: ['name', 'address'] }
|
{ model: Place, attributes: ['name', 'address'] }
|
||||||
],
|
],
|
||||||
order: [ [Comment, 'id', 'DESC'], [Tag, 'weigth', 'DESC'] ]
|
order: [ [Comment, 'id', 'DESC'], [Tag, 'weigth', 'DESC'] ]
|
||||||
})
|
})
|
||||||
if (event) {
|
if (event) {
|
||||||
res.json(event)
|
res.json(event)
|
||||||
@@ -184,8 +187,6 @@ const eventController = {
|
|||||||
[Tag, 'weigth', 'DESC']
|
[Tag, 'weigth', 'DESC']
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
// { model: User, required: false },
|
|
||||||
// { type: Comment, required: false, attributes: ['']
|
|
||||||
{ model: Tag, required: false, attributes: ['tag', 'weigth', 'color'] },
|
{ model: Tag, required: false, attributes: ['tag', 'weigth', 'color'] },
|
||||||
{ model: Place, required: false, attributes: ['id', 'name', 'address'] }
|
{ model: Place, required: false, attributes: ['id', 'name', 'address'] }
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user