Add genial.ly block

This commit is contained in:
Ramon Wenger 2019-02-21 09:55:41 +01:00
parent 32f2ddaea5
commit 4f72f804c6
4 changed files with 58 additions and 1 deletions

View File

@ -38,6 +38,7 @@
import LinkBlock from '@/components/content-blocks/LinkBlock';
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
import GeniallyBlock from '@/components/content-blocks/GeniallyBlock';
import Assignment from '@/components/content-blocks/assignment/Assignment';
import Solution from '@/components/content-blocks/Solution';
import AddContentBlockButton from '@/components/AddContentBlockButton';
@ -61,6 +62,7 @@
'link_block': LinkBlock,
'document_block': DocumentBlock,
'infogram_block': InfogramBlock,
'genially_block': GeniallyBlock,
Solution,
Assignment,
Task,

View File

@ -0,0 +1,50 @@
<template>
<div class="genially-block">
<div class="genially-block__wrapper">
<iframe class="genially-block__iframe"
frameborder="0"
width="800px"
height="600px"
:src="src"
type="text/html"
allowscriptaccess="always"
allowfullscreen="true"
scrolling="yes"
allownetworking="all"></iframe>
</div>
</div>
</template>
<script>
export default {
props: ['value'],
computed: {
src() {
return `https://view.genial.ly/${this.value.id}`;
}
}
}
</script>
<style scoped lang="scss">
// Styling and structure taken from original iframe
.genially-block {
width: 100%;
&__wrapper {
position: relative;
padding-bottom: 75%;
padding-top: 0;
height: 0;
}
&__iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
</style>

View File

@ -69,6 +69,10 @@ class InfogramBlock(blocks.StructBlock):
id = blocks.TextBlock()
title = blocks.TextBlock()
class GeniallyBlock(blocks.StructBlock):
id = blocks.TextBlock()
# 'text_block' 'task' 'basic_knowledge' 'student_entry' 'image_block'
#
# url = blocks.URLBlock()

View File

@ -6,7 +6,7 @@ from wagtail.core.fields import StreamField
from wagtail.images.blocks import ImageChooserBlock
from books.blocks import TextBlock, BasicKnowledgeBlock, LinkBlock, VideoBlock, DocumentBlock, \
ImageUrlBlock, AssignmentBlock, InfogramBlock
ImageUrlBlock, AssignmentBlock, InfogramBlock, GeniallyBlock
from core.wagtail_utils import StrictHierarchyPage
from users.models import SchoolClass
@ -45,6 +45,7 @@ class ContentBlock(StrictHierarchyPage):
('video_block', VideoBlock()),
('document_block', DocumentBlock()),
('infogram_block', InfogramBlock()),
('genially_block', GeniallyBlock()),
], null=True, blank=True)
type = models.CharField(