more on slugify

This commit is contained in:
les
2021-04-14 01:30:51 +02:00
parent 1edf6b1799
commit 6dfa77e55a
8 changed files with 31 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
<template lang="pug">
nuxt-link.embed_event(:to='`/event/${id}`' target='_blank' :class='{ withImg: event.image_path }')
nuxt-link.embed_event(:to='`/event/${event.slug || event.id}`' target='_blank' :class='{ withImg: event.image_path }')
//- image
img.float-left(:src='`/media/thumb/${event.image_path || "logo.png"}`')
@@ -18,7 +18,7 @@ export default {
async asyncData ({ $axios, params, error, store }) {
try {
const event = await $axios.$get(`/event/${params.event_id}`)
return { event, id: Number(params.event_id) }
return { event }
} catch (e) {
error({ statusCode: 404, message: 'Event not found' })
}

View File

@@ -54,7 +54,7 @@ v-container
template(v-slot:activator="{on, attrs} ")
v-btn.ml-2(large icon v-on='on' color='primary'
v-clipboard:success='copyLink'
v-clipboard:copy='`${settings.baseurl}/event/${event.id}`')
v-clipboard:copy='`${settings.baseurl}/event/${event.slug || event.id}`')
v-icon mdi-content-copy
v-tooltip(bottom) {{$t('common.embed')}}
template(v-slot:activator="{on, attrs} ")
@@ -63,7 +63,7 @@ v-container
v-tooltip(bottom) {{$t('common.add_to_calendar')}}
template(v-slot:activator="{on, attrs} ")
v-btn.ml-2(large icon v-on='on' color='primary'
:href='`/api/event/${event.id}.ics`')
:href='`/api/event/${event.slug || event.id}.ics`')
v-icon mdi-calendar-export
.p-description.text-body-1(v-if='event.image_path' v-html='event.description')
@@ -191,7 +191,7 @@ export default {
{
hid: 'og-url',
property: 'og:url',
content: `${this.settings.baseurl}/event/${this.event.id}`
content: `${this.settings.baseurl}/event/${this.event.slug || this.event.id}`
},
{ property: 'og:type', content: 'event' },
{

View File

@@ -6,7 +6,7 @@ v-card
v-col.col-12
v-alert.mb-1.mt-1(type='info' show-icon) {{$t('common.embed_help')}}
v-text-field(v-model='code')
v-btn(slot='prepend' plain text color='primary'
v-btn(slot='prepend' text color='primary'
v-clipboard:copy='code'
v-clipboard:success='copyLink') {{$t("common.copy")}}
v-icon.ml-1 mdi-content-copy
@@ -23,13 +23,13 @@ import { mapState } from 'vuex'
export default {
name: 'EmbedEvent',
props: {
event: { type: Object, default: () => ({})}
event: { type: Object, default: () => ({}) }
},
computed: {
...mapState(['settings']),
code () {
const style = "style='border: 0; width: 100%; height: 215px;'"
const src = `${this.settings.baseurl}/embed/${this.event.id}`
const src = `${this.settings.baseurl}/embed/${this.event.slug || this.event.id}`
const code = `<iframe ${style} src="${src}"></iframe>`
return code
}