cleaning
This commit is contained in:
@@ -178,8 +178,10 @@ export default {
|
||||
await this.$axios.$post('/event', formData)
|
||||
}
|
||||
this.updateMeta()
|
||||
this.$router.replace('/')
|
||||
this.$root.$message(this.$auth.loggedIn ? 'event.added' : 'event.added_anon', { color: 'success' })
|
||||
this.$router.push('/')
|
||||
this.$nextTick(() => {
|
||||
this.$root.$message(this.$auth.loggedIn ? 'event.added' : 'event.added_anon', { color: 'success' })
|
||||
})
|
||||
} catch (e) {
|
||||
switch (e.request.status) {
|
||||
case 413:
|
||||
|
||||
@@ -29,13 +29,13 @@ v-container
|
||||
.title.text-h5
|
||||
b.p-name {{event.title}}
|
||||
|
||||
time.dt-start.text-h5(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")')
|
||||
time.dt-start.text-h6(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")')
|
||||
v-icon mdi-calendar
|
||||
b.ml-2 {{event|when}}
|
||||
div.subtitle-1 {{event.start_datetime|from}}
|
||||
small(v-if='event.parentId') ({{event|recurrentDetail}})
|
||||
|
||||
.text-h5.p-location
|
||||
.text-h6.p-location
|
||||
v-icon mdi-map-marker
|
||||
b.vcard.ml-2 {{event.place.name}}
|
||||
p.adr {{event.place.address}}
|
||||
@@ -58,7 +58,7 @@ v-container
|
||||
:href='`/api/event/${event.id}.ics`')
|
||||
v-icon mdi-calendar-export
|
||||
|
||||
.p-description.text-h6(v-html='event.description')
|
||||
.p-description.text-body-1.px-5(v-html='event.description')
|
||||
v-chip.p-category.ml-1(v-for='tag in event.tags' color='primary'
|
||||
outlined :key='tag' v-text='tag')
|
||||
|
||||
@@ -258,6 +258,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
keyDown (ev) {
|
||||
if (ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey) { return }
|
||||
if (ev.key === 'ArrowRight' && this.event.next) {
|
||||
this.$router.push(`/event/${this.event.next}`)
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
v-chip(v-if='selectedDay' close @click:close='dayChange({ date: selectedDay})') {{selectedDay}}
|
||||
|
||||
//- Events
|
||||
#events
|
||||
Event(v-for='(event, idx) in events' :key='event.id' :event='event' :show='idx>=firstVisibleItem && idx<=lastVisibleItem'
|
||||
@tagclick='tagClick' @placeclick='placeClick')
|
||||
#events.mt-1
|
||||
//- div.event(v-for='(event, idx) in events' :key='event.id' v-intersect="(entries, observer, isIntersecting) => intersecting[event.id] = isIntersecting")
|
||||
Event(:event='event' v-for='(event, idx) in events' :key='event.id' @tagclick='tagClick' @placeclick='placeClick')
|
||||
|
||||
</template>
|
||||
|
||||
@@ -50,45 +50,17 @@ export default {
|
||||
end: null,
|
||||
filters: { tags: [], places: [], show_recurrent: $store.state.settings.allow_recurrent_event && $store.state.settings.recurrent_event_visible },
|
||||
selectedDay: null,
|
||||
firstVisibleItem: 0,
|
||||
lastVisibleItem: 20
|
||||
// intersecting: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['settings', 'announcements'])
|
||||
},
|
||||
mounted () {
|
||||
let last_known_scroll_position = 0
|
||||
let ticking = false
|
||||
|
||||
document.addEventListener('scroll', e => {
|
||||
last_known_scroll_position = window.scrollY
|
||||
|
||||
if (!ticking) {
|
||||
window.requestAnimationFrame(() => {
|
||||
this.scroll(last_known_scroll_position)
|
||||
ticking = false
|
||||
})
|
||||
|
||||
ticking = true
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// onIntersect (isIntersecting, eventId) {
|
||||
// this.intersecting[eventId] = isIntersecting
|
||||
// },
|
||||
...mapActions(['setFilters']),
|
||||
scroll (y) {
|
||||
const rowHeight = 370
|
||||
const nItems = this.events.length
|
||||
const fullHeight = document.getElementById('events').offsetHeight
|
||||
const nRows = fullHeight / rowHeight
|
||||
const itemPerRow = nItems / nRows
|
||||
const visibleRows = 10
|
||||
this.firstVisibleItem = Math.trunc(((y - 370) / rowHeight) * itemPerRow) - (5 * itemPerRow)
|
||||
this.lastVisibleItem = this.firstVisibleItem + (visibleRows * itemPerRow)
|
||||
|
||||
console.error('Scrolled to ', y, ' nItems', nItems, 'fullHeight', fullHeight, ' itemPerRow', itemPerRow, ' nRow', nRows)
|
||||
console.error('mostro dal ', this.firstVisibleItem, this.lastVisibleItem)
|
||||
},
|
||||
async updateEvents () {
|
||||
this.events = await this.$api.getEvents({
|
||||
start: this.start,
|
||||
|
||||
Reference in New Issue
Block a user