Add vimeo video to topic
This commit is contained in:
parent
1ebfacfbdb
commit
117e8bf0d8
|
|
@ -19,6 +19,7 @@
|
||||||
import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard';
|
import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard';
|
||||||
import FullscreenImage from '@/components/FullscreenImage';
|
import FullscreenImage from '@/components/FullscreenImage';
|
||||||
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
import FullscreenInfographic from '@/components/FullscreenInfographic';
|
||||||
|
import FullscreenVideo from '@/components/FullscreenVideo';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
|
|
@ -36,7 +37,8 @@
|
||||||
EditObjectiveGroupWizard,
|
EditObjectiveGroupWizard,
|
||||||
NewProjectEntryWizard,
|
NewProjectEntryWizard,
|
||||||
FullscreenImage,
|
FullscreenImage,
|
||||||
FullscreenInfographic
|
FullscreenInfographic,
|
||||||
|
FullscreenVideo
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<template>
|
||||||
|
<modal class="fullscreen-video" :hide-header="true" :fullscreen="true">
|
||||||
|
<iframe :src="src"
|
||||||
|
width="2000"
|
||||||
|
height="1000"
|
||||||
|
class="fullscreen-video__embed"
|
||||||
|
frameborder="0" webkitallowfullscreen
|
||||||
|
mozallowfullscreen allowfullscreen></iframe>
|
||||||
|
</modal>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Modal from '@/components/Modal';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Modal
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
vimeoId() {
|
||||||
|
return this.$store.state.vimeoId;
|
||||||
|
},
|
||||||
|
src() {
|
||||||
|
return `https://player.vimeo.com/video/${this.vimeoId}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.fullscreen-video {
|
||||||
|
&__embed {
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
height: 95vh;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -5,6 +5,7 @@ query Topic($slug: String!){
|
||||||
title
|
title
|
||||||
teaser
|
teaser
|
||||||
description
|
description
|
||||||
|
vimeoId
|
||||||
modules {
|
modules {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
<p class="topic__teaser">
|
<p class="topic__teaser">
|
||||||
{{topic.teaser}}
|
{{topic.teaser}}
|
||||||
</p>
|
</p>
|
||||||
|
<div v-if="topic.vimeoId" class="topic__video-link" @click="openVideo">
|
||||||
|
<span class="topic__video-link-description">Video schauen</span>
|
||||||
|
</div>
|
||||||
<div class="topic__modules">
|
<div class="topic__modules">
|
||||||
<module-teaser v-for="module in modules" :key="module.id" v-bind="module"></module-teaser>
|
<module-teaser v-for="module in modules" :key="module.id" v-bind="module"></module-teaser>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -39,6 +42,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
openVideo() {
|
||||||
|
this.$store.dispatch('showFullscreenVideo', this.topic.vimeoId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
topic: {
|
topic: {
|
||||||
|
|
@ -60,6 +69,16 @@
|
||||||
color: $color-darkgrey-1;
|
color: $color-darkgrey-1;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
@include lead-paragraph;
|
@include lead-paragraph;
|
||||||
|
margin-bottom: $large-spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__video-link {
|
||||||
|
margin-bottom: $large-spacing;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__video-link-description {
|
||||||
|
@include heading-3;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__modules {
|
&__modules {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ export default new Vuex.Store({
|
||||||
infographic: {
|
infographic: {
|
||||||
id: 0,
|
id: 0,
|
||||||
type: ''
|
type: ''
|
||||||
}
|
},
|
||||||
|
vimeoId: null
|
||||||
},
|
},
|
||||||
|
|
||||||
getters: {},
|
getters: {},
|
||||||
|
|
@ -51,6 +52,7 @@ export default new Vuex.Store({
|
||||||
id: 0,
|
id: 0,
|
||||||
type: ''
|
type: ''
|
||||||
});
|
});
|
||||||
|
commit('setVimeoId', null);
|
||||||
},
|
},
|
||||||
resetContentBlockPosition({commit}) {
|
resetContentBlockPosition({commit}) {
|
||||||
commit('setContentBlockPosition', {});
|
commit('setContentBlockPosition', {});
|
||||||
|
|
@ -102,6 +104,10 @@ export default new Vuex.Store({
|
||||||
commit('setInfographic', payload);
|
commit('setInfographic', payload);
|
||||||
dispatch('showModal', 'fullscreen-infographic');
|
dispatch('showModal', 'fullscreen-infographic');
|
||||||
},
|
},
|
||||||
|
showFullscreenVideo({commit, dispatch}, payload) {
|
||||||
|
commit('setVimeoId', payload);
|
||||||
|
dispatch('showModal', 'fullscreen-video');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
@ -149,6 +155,9 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
setInfographic(state, payload) {
|
setInfographic(state, payload) {
|
||||||
state.infographic = payload;
|
state.infographic = payload;
|
||||||
|
},
|
||||||
|
setVimeoId(state, payload) {
|
||||||
|
state.vimeoId = payload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.0.6 on 2019-03-11 15:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('books', '0008_auto_20190301_0954'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='topic',
|
||||||
|
name='vimeo_id',
|
||||||
|
field=models.CharField(default=None, max_length=200, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -18,11 +18,13 @@ class Topic(StrictHierarchyPage):
|
||||||
order = models.PositiveIntegerField(null=False, blank=False, help_text='Order of the topic')
|
order = models.PositiveIntegerField(null=False, blank=False, help_text='Order of the topic')
|
||||||
teaser = models.TextField()
|
teaser = models.TextField()
|
||||||
description = RichTextField(features=DEFAULT_RICH_TEXT_FEATURES)
|
description = RichTextField(features=DEFAULT_RICH_TEXT_FEATURES)
|
||||||
|
vimeo_id = models.CharField(max_length=200, null=True, default=None)
|
||||||
|
|
||||||
content_panels = [
|
content_panels = [
|
||||||
FieldPanel('title', classname="full title"),
|
FieldPanel('title', classname="full title"),
|
||||||
FieldPanel('order'),
|
FieldPanel('order'),
|
||||||
FieldPanel('teaser'),
|
FieldPanel('teaser'),
|
||||||
|
FieldPanel('vimeo_id'),
|
||||||
FieldPanel('description'),
|
FieldPanel('description'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ class TopicNode(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Topic
|
model = Topic
|
||||||
only_fields = [
|
only_fields = [
|
||||||
'slug', 'title', 'meta_title', 'teaser', 'description',
|
'slug', 'title', 'meta_title', 'teaser', 'description', 'vimeo_id'
|
||||||
]
|
]
|
||||||
filter_fields = {
|
filter_fields = {
|
||||||
'slug': ['exact', 'icontains', 'in'],
|
'slug': ['exact', 'icontains', 'in'],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue