mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
use new webcomponents to embed events/list
This commit is contained in:
parent
d39e23c2b4
commit
ee96c73fbf
2 changed files with 20 additions and 25 deletions
|
@ -2,20 +2,19 @@
|
||||||
v-card
|
v-card
|
||||||
v-card-title(v-text="$t('common.embed_title')")
|
v-card-title(v-text="$t('common.embed_title')")
|
||||||
v-card-text
|
v-card-text
|
||||||
v-row
|
v-alert.mb-3.mt-1(type='info' show-icon) {{$t('common.embed_help')}}
|
||||||
v-col.col-12
|
v-alert.pa-5.my-4.blue-grey.darken-4.text-body-1.lime--text.text--lighten-3 {{code.script}}<br/>{{code.el}}<br/><br/>
|
||||||
v-alert.mb-1.mt-1(type='info' show-icon) {{$t('common.embed_help')}}
|
v-btn.float-end(text color='primary'
|
||||||
v-text-field(v-model='code')
|
|
||||||
v-btn(slot='prepend' text color='primary'
|
|
||||||
v-clipboard:copy='code'
|
v-clipboard:copy='code'
|
||||||
v-clipboard:success='copyLink') {{$t("common.copy")}}
|
v-clipboard:success='copyLink') {{$t("common.copy")}}
|
||||||
v-icon.ml-1 mdi-content-copy
|
v-icon.ml-1 mdi-content-copy
|
||||||
|
p.mx-auto
|
||||||
v-col.mt-2(v-html='code')
|
.mx-auto
|
||||||
|
gancio-event(:id='event.id' :baseurl='settings.baseurl')
|
||||||
v-card-actions
|
v-card-actions
|
||||||
v-spacer
|
v-spacer
|
||||||
v-btn(color='warning' @click="$emit('close')") {{$t("common.cancel")}}
|
v-btn(text color='warning' @click="$emit('close')") {{$t("common.cancel")}}
|
||||||
v-btn(v-clipboard:copy='code' v-clipboard:success='copyLink' color="primary") {{$t("common.copy")}}
|
v-btn(text v-clipboard:copy='code' v-clipboard:success='copyLink' color="primary") {{$t("common.copy")}}
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
@ -28,10 +27,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
code () {
|
code () {
|
||||||
const style = "style='border: 0; width: 100%; height: 215px;'"
|
const script = `<script src='${this.settings.baseurl}/gancio-events.es.js'/>`
|
||||||
const src = `${this.settings.baseurl}/embed/${this.event.slug || this.event.id}`
|
const el = `<gancio-event id='${this.event.id}' baseurl='${this.settings.baseurl}'></gancio-event>`
|
||||||
const code = `<iframe ${style} src="${src}"></iframe>`
|
return { script, el }
|
||||||
return code
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -56,10 +56,7 @@
|
||||||
v-text-field(v-model='list.title' :label='$t("common.title")')
|
v-text-field(v-model='list.title' :label='$t("common.title")')
|
||||||
v-text-field(v-model='list.maxEvents' type='number' min='1' :label='$t("common.max_events")')
|
v-text-field(v-model='list.maxEvents' type='number' min='1' :label='$t("common.max_events")')
|
||||||
v-col.float-right(:span='12')
|
v-col.float-right(:span='12')
|
||||||
List(
|
gancio-events(:baseurl='settings.baseurl' :maxlength='list.maxEvents && Number(list.maxEvents)' :title='list.title')
|
||||||
:title='list.title'
|
|
||||||
:maxEvents='Number(list.maxEvents)'
|
|
||||||
:events='events')
|
|
||||||
v-text-field.mb-1(type='textarea' v-model='listScript' readonly )
|
v-text-field.mb-1(type='textarea' v-model='listScript' readonly )
|
||||||
v-btn(slot='prepend' text
|
v-btn(slot='prepend' text
|
||||||
color='primary' v-clipboard:copy='listScript' v-clipboard:success='copyLink.bind(this,"list")') {{$t('common.copy')}}
|
color='primary' v-clipboard:copy='listScript' v-clipboard:success='copyLink.bind(this,"list")') {{$t('common.copy')}}
|
||||||
|
@ -99,7 +96,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
type: 'rss',
|
type: 'rss',
|
||||||
notification: { email: '' },
|
notification: { email: '' },
|
||||||
list: { title: 'Gancio', maxEvents: 3 },
|
list: { title: 'Gancio', maxEvents: 1 },
|
||||||
filters: { tags: [], places: [], show_recurrent: false },
|
filters: { tags: [], places: [], show_recurrent: false },
|
||||||
events: []
|
events: []
|
||||||
}
|
}
|
||||||
|
@ -111,14 +108,10 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
domain () {
|
|
||||||
const URL = url.parse(this.settings.baseurl)
|
|
||||||
return URL.hostname
|
|
||||||
},
|
|
||||||
listScript () {
|
listScript () {
|
||||||
const params = []
|
const params = []
|
||||||
if (this.list.title) {
|
if (this.list.title) {
|
||||||
params.push(`title=${this.list.title}`)
|
params.push(`title="${this.list.title}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.filters.places.length) {
|
if (this.filters.places.length) {
|
||||||
|
@ -130,9 +123,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.filters.show_recurrent) {
|
if (this.filters.show_recurrent) {
|
||||||
params.push('show_recurrent=true')
|
params.push('show_recurrent')
|
||||||
}
|
}
|
||||||
return `<iframe style='border: 0px; width: 100%;' src="${this.settings.baseurl}/embed/list?${params.join('&')}"></iframe>`
|
|
||||||
|
if (this.list.maxEvents) {
|
||||||
|
params.push('maxlength=' + this.list.maxEvents)
|
||||||
|
}
|
||||||
|
return `<script src="${this.settings.baseurl}/gancio-events.es.js'><gancio-events ${params.join(' ')}></gancio-events>`
|
||||||
},
|
},
|
||||||
link () {
|
link () {
|
||||||
const typeMap = ['rss', 'ics', 'list']
|
const typeMap = ['rss', 'ics', 'list']
|
||||||
|
|
Loading…
Reference in a new issue