Add Thinglink block
This commit is contained in:
parent
9837248881
commit
1c2e0fc88b
|
|
@ -43,6 +43,7 @@
|
||||||
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
|
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
|
||||||
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
|
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
|
||||||
import GeniallyBlock from '@/components/content-blocks/GeniallyBlock';
|
import GeniallyBlock from '@/components/content-blocks/GeniallyBlock';
|
||||||
|
import ThinglinkBlock from '@/components/content-blocks/ThinglinkBlock';
|
||||||
import SubtitleBlock from '@/components/content-blocks/SubtitleBlock';
|
import SubtitleBlock from '@/components/content-blocks/SubtitleBlock';
|
||||||
import ContentListBlock from '@/components/content-blocks/ContentListBlock';
|
import ContentListBlock from '@/components/content-blocks/ContentListBlock';
|
||||||
import Assignment from '@/components/content-blocks/assignment/Assignment';
|
import Assignment from '@/components/content-blocks/assignment/Assignment';
|
||||||
|
|
@ -86,6 +87,7 @@
|
||||||
'document_block': DocumentBlock,
|
'document_block': DocumentBlock,
|
||||||
'infogram_block': InfogramBlock,
|
'infogram_block': InfogramBlock,
|
||||||
'genially_block': GeniallyBlock,
|
'genially_block': GeniallyBlock,
|
||||||
|
'thinglink_block': ThinglinkBlock,
|
||||||
'subtitle': SubtitleBlock,
|
'subtitle': SubtitleBlock,
|
||||||
'content_list': ContentListBlock,
|
'content_list': ContentListBlock,
|
||||||
'module_room_slug': ModuleRoomSlug,
|
'module_room_slug': ModuleRoomSlug,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
<template>
|
||||||
|
<div class="thinglink-block">
|
||||||
|
<div class="thinglink-block__wrapper">
|
||||||
|
<iframe class="thinglink-block__iframe"
|
||||||
|
frameborder="0"
|
||||||
|
width="800px"
|
||||||
|
height="600px"
|
||||||
|
:src="src"
|
||||||
|
type="text/html"
|
||||||
|
webkitallowfullscreen
|
||||||
|
mozallowfullscreen
|
||||||
|
scrolling="no"
|
||||||
|
allowscriptaccess="always"
|
||||||
|
allowfullscreen="true"
|
||||||
|
allownetworking="all"></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['value'],
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
src() {
|
||||||
|
return `https://www.thinglink.com/card/${this.value.id}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
openFullscreen() {
|
||||||
|
this.$store.dispatch('showFullscreenInfographic', {
|
||||||
|
id: this.value.id,
|
||||||
|
type: 'thinglink-block'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "@/styles/_variables.scss";
|
||||||
|
|
||||||
|
// Styling and structure taken from original iframe
|
||||||
|
.thinglink-block {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: $large-spacing;
|
||||||
|
|
||||||
|
&__wrapper {
|
||||||
|
position: relative;
|
||||||
|
padding-bottom: 75%;
|
||||||
|
padding-top: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__iframe {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__link {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -4,7 +4,7 @@ from wagtail.core.fields import StreamField
|
||||||
from wagtail.images.blocks import ImageChooserBlock
|
from wagtail.images.blocks import ImageChooserBlock
|
||||||
|
|
||||||
from books.blocks import LinkBlock, VideoBlock, DocumentBlock, SectionTitleBlock, InfogramBlock, \
|
from books.blocks import LinkBlock, VideoBlock, DocumentBlock, SectionTitleBlock, InfogramBlock, \
|
||||||
GeniallyBlock, InstrumentTextBlock, SubtitleBlock
|
GeniallyBlock, InstrumentTextBlock, SubtitleBlock, ThinglinkBlock
|
||||||
from core.wagtail_utils import StrictHierarchyPage
|
from core.wagtail_utils import StrictHierarchyPage
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,6 +20,7 @@ class BasicKnowledge(StrictHierarchyPage):
|
||||||
('section_title', SectionTitleBlock()),
|
('section_title', SectionTitleBlock()),
|
||||||
('infogram_block', InfogramBlock()),
|
('infogram_block', InfogramBlock()),
|
||||||
('genially_block', GeniallyBlock()),
|
('genially_block', GeniallyBlock()),
|
||||||
|
('thinglink_block', ThinglinkBlock()),
|
||||||
('subtitle', SubtitleBlock()),
|
('subtitle', SubtitleBlock()),
|
||||||
], null=True, blank=True)
|
], null=True, blank=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,10 @@ class GeniallyBlock(blocks.StructBlock):
|
||||||
id = blocks.TextBlock()
|
id = blocks.TextBlock()
|
||||||
|
|
||||||
|
|
||||||
|
class ThinglinkBlock(blocks.StructBlock):
|
||||||
|
id = blocks.TextBlock()
|
||||||
|
|
||||||
|
|
||||||
class SectionTitleBlock(blocks.StructBlock):
|
class SectionTitleBlock(blocks.StructBlock):
|
||||||
text = blocks.TextBlock()
|
text = blocks.TextBlock()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ from wagtail.core.fields import StreamField
|
||||||
from wagtail.images.blocks import ImageChooserBlock
|
from wagtail.images.blocks import ImageChooserBlock
|
||||||
|
|
||||||
from books.blocks import TextBlock, BasicKnowledgeBlock, LinkBlock, VideoBlock, DocumentBlock, \
|
from books.blocks import TextBlock, BasicKnowledgeBlock, LinkBlock, VideoBlock, DocumentBlock, \
|
||||||
ImageUrlBlock, AssignmentBlock, InfogramBlock, GeniallyBlock, SubtitleBlock, SurveyBlock, ModuleRoomSlugBlock
|
ImageUrlBlock, AssignmentBlock, InfogramBlock, GeniallyBlock, SubtitleBlock, SurveyBlock, ModuleRoomSlugBlock, \
|
||||||
|
ThinglinkBlock
|
||||||
from books.utils import get_type_and_value
|
from books.utils import get_type_and_value
|
||||||
from core.wagtail_utils import StrictHierarchyPage
|
from core.wagtail_utils import StrictHierarchyPage
|
||||||
from surveys.models import Survey
|
from surveys.models import Survey
|
||||||
|
|
@ -50,6 +51,7 @@ class ContentBlock(StrictHierarchyPage):
|
||||||
('document_block', DocumentBlock()),
|
('document_block', DocumentBlock()),
|
||||||
('infogram_block', InfogramBlock()),
|
('infogram_block', InfogramBlock()),
|
||||||
('genially_block', GeniallyBlock()),
|
('genially_block', GeniallyBlock()),
|
||||||
|
('thinglink_block', ThinglinkBlock()),
|
||||||
('subtitle', SubtitleBlock()),
|
('subtitle', SubtitleBlock()),
|
||||||
('module_room_slug', ModuleRoomSlugBlock())
|
('module_room_slug', ModuleRoomSlugBlock())
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue