mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
new place page
This commit is contained in:
parent
122510699e
commit
3569b668f0
3 changed files with 57 additions and 1 deletions
|
@ -8,7 +8,7 @@
|
|||
v-card-text.body.pt-0.pb-0
|
||||
time.dt-start.subtitle-1(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")' itemprop="startDate" :content="event.start_datetime|unixFormat('YYYY-MM-DDTHH:mm')") <v-icon v-text='mdiCalendar'></v-icon> {{ event|when }}
|
||||
.d-none.dt-end(itemprop="endDate" :content="event.end_datetime|unixFormat('YYYY-MM-DDTHH:mm')") {{event.end_datetime|unixFormat('YYYY-MM-DD HH:mm')}}
|
||||
a.place.d-block.p-location.pl-0(text color='primary' @click="$emit('placeclick', event.place.id)" itemprop="location" :content="event.place.name") <v-icon v-text='mdiMapMarker'></v-icon> {{event.place.name}}
|
||||
nuxt-link.place.d-block.p-location.pl-0(text color='primary' :to='`/p/${event.place.name}`' itemprop="location" :content="event.place.name") <v-icon v-text='mdiMapMarker'></v-icon> {{event.place.name}}
|
||||
.d-none(itemprop='location.address') {{event.place.address}}
|
||||
|
||||
v-card-actions.pt-0.actions.justify-space-between
|
||||
|
|
37
pages/p/_place.vue
Normal file
37
pages/p/_place.vue
Normal file
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<v-container id='home' fluid>
|
||||
<div class="mt-3 mb-1 ml-1">
|
||||
<v-btn text color='primary' to='/'><v-icon v-text='mdiChevronLeft'/></v-btn>
|
||||
</div>
|
||||
|
||||
<h1 class='d-block text-h4 font-weight-black text-center text-uppercase mt-5 mx-auto w-100 text-underline'><u>{{place.name}}</u></h1>
|
||||
<span class="d-block text-subtitle text-center w-100 mb-14">{{place.address}}</span>
|
||||
|
||||
<!-- Events -->
|
||||
<div class="mb-2 mt-1 pl-1 pl-sm-2" id="events">
|
||||
<Event :event='event' v-for='(event, idx) in events' :lazy='idx>2' :key='event.id'></Event>
|
||||
</div>
|
||||
</v-container>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import { mdiChevronLeft } from '@mdi/js'
|
||||
import Event from '@/components/Event'
|
||||
|
||||
export default {
|
||||
name: 'Tag',
|
||||
components: { Event },
|
||||
data () {
|
||||
return { mdiChevronLeft }
|
||||
},
|
||||
asyncData ({ $axios, params, error }) {
|
||||
try {
|
||||
const place = params.place
|
||||
return $axios.$get(`/place/${place}/events`)
|
||||
} catch (e) {
|
||||
error({ statusCode: 400, message: 'Error!' })
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
19
server/api/controller/place.js
Normal file
19
server/api/controller/place.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const dayjs = require('dayjs')
|
||||
const Place = require('../models/place')
|
||||
const eventController = require('./event')
|
||||
|
||||
|
||||
module.exports = {
|
||||
async getEvents (req, res) {
|
||||
const name = req.params.placeName
|
||||
const place = await Place.findOne({ where: { name }})
|
||||
if (!place) {
|
||||
log.warn(`Place ${name} not found`)
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
const start = dayjs().unix()
|
||||
const events = await eventController._select({ start, places: `${place.id}`, show_recurrent: true})
|
||||
|
||||
return res.json({ events, place })
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue