Merged in feature/instruments (pull request #20)

Change default set for rich text, add blocks

Approved-by: Ramon Wenger <ramon.wenger@iterativ.ch>
This commit is contained in:
Christian Cueni 2019-07-11 12:25:20 +00:00 committed by Ramon Wenger
commit e3c7cc77a9
6 changed files with 54 additions and 27 deletions

View File

@ -4656,7 +4656,8 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true "bundled": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -5021,7 +5022,8 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.1", "version": "5.1.1",
"bundled": true "bundled": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -5069,6 +5071,7 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -5107,11 +5110,13 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true "bundled": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.2", "version": "3.0.2",
"bundled": true "bundled": true,
"optional": true
} }
} }
}, },
@ -11232,9 +11237,9 @@
} }
}, },
"survey-vue": { "survey-vue": {
"version": "1.0.87", "version": "1.0.96",
"resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.0.87.tgz", "resolved": "https://registry.npmjs.org/survey-vue/-/survey-vue-1.0.96.tgz",
"integrity": "sha512-NKxrv6KHtGr3P5gr+nx+cu3OkvBgZUgV+cdb0mzvqObex8PJD+IEsbE4NpE6yeoIN6h6NLxaX+ns9Y2fV+xv0A==", "integrity": "sha512-6vwEprt6NdTC4BFELdReQWdPNAuVb59jnj2rI/tl7bhk4TJQluRtacy95T9V5r1oMDyATzn8kl2eX0Kr14KVSg==",
"requires": { "requires": {
"vue": "^2.1.10" "vue": "^2.1.10"
} }

View File

@ -64,7 +64,7 @@
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"semver": "^5.3.0", "semver": "^5.3.0",
"shelljs": "^0.7.6", "shelljs": "^0.7.6",
"survey-vue": "^1.0.87", "survey-vue": "^1.0.96",
"uglifyjs-webpack-plugin": "^1.1.1", "uglifyjs-webpack-plugin": "^1.1.1",
"unfetch": "^3.1.1", "unfetch": "^3.1.1",
"uploadcare-widget": "^3.6.0", "uploadcare-widget": "^3.6.0",

View File

@ -0,0 +1,15 @@
<template>
<h4 class="section-title" v-html="value.text"></h4>
</template>
<script>
export default {
props: ['value']
}
</script>
<style scoped lang="scss">
.section-title {
margin-bottom: 30px;
}
</style>

View File

@ -21,6 +21,7 @@
import VideoBlock from '@/components/content-blocks/VideoBlock'; import VideoBlock from '@/components/content-blocks/VideoBlock';
import LinkBlock from '@/components/content-blocks/LinkBlock'; import LinkBlock from '@/components/content-blocks/LinkBlock';
import DocumentBlock from '@/components/content-blocks/DocumentBlock'; import DocumentBlock from '@/components/content-blocks/DocumentBlock';
import SectionTitleBlock from '@/components/content-blocks/SectionTitleBlock';
export default { export default {
apollo: { apollo: {
@ -43,6 +44,7 @@
'video_block': VideoBlock, 'video_block': VideoBlock,
'link_block': LinkBlock, 'link_block': LinkBlock,
'document_block': DocumentBlock, 'document_block': DocumentBlock,
'section_title': SectionTitleBlock,
}, },
data() { data() {
@ -64,20 +66,6 @@
} }
& /deep/ { & /deep/ {
& h3 {
font-size: toRem(21px);
margin-bottom: 30px;
}
& h4 {
font-size: toRem(17px);
margin-bottom: 20px;
}
& h5 {
font-size: toRem(18px);
font-family: $serif-font-family;
margin-bottom: 15px;
font-weight: 800;
}
& p { & p {
margin-bottom: 40px; margin-bottom: 40px;
} }
@ -91,6 +79,10 @@
list-style: disc; list-style: disc;
line-height: 1.5; line-height: 1.5;
} }
& b {
font-weight: 600;
color: $color-brand;
}
} }
} }
</style> </style>

View File

@ -3,7 +3,8 @@ from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core.fields import StreamField from wagtail.core.fields import StreamField
from wagtail.images.blocks import ImageChooserBlock from wagtail.images.blocks import ImageChooserBlock
from books.blocks import TextBlock, LinkBlock, VideoBlock, DocumentBlock from books.blocks import LinkBlock, VideoBlock, DocumentBlock, SectionTitleBlock, InfogramBlock, \
GeniallyBlock, InstrumentTextBlock
from core.wagtail_utils import StrictHierarchyPage from core.wagtail_utils import StrictHierarchyPage
@ -11,11 +12,14 @@ class BasicKnowledge(StrictHierarchyPage):
parent_page_types = ['books.book'] parent_page_types = ['books.book']
contents = StreamField([ contents = StreamField([
('text_block', TextBlock()), ('text_block', InstrumentTextBlock()),
('image_block', ImageChooserBlock()), ('image_block', ImageChooserBlock()),
('link_block', LinkBlock()), ('link_block', LinkBlock()),
('video_block', VideoBlock()), ('video_block', VideoBlock()),
('document_block', DocumentBlock()), ('document_block', DocumentBlock()),
('section_title', SectionTitleBlock()),
('infogram_block', InfogramBlock()),
('genially_block', GeniallyBlock()),
], null=True, blank=True) ], null=True, blank=True)
LANGUAGE_COMMUNICATION = 'language_communication' LANGUAGE_COMMUNICATION = 'language_communication'

View File

@ -3,8 +3,8 @@ from wagtail.snippets.blocks import SnippetChooserBlock
from assignments.models import Assignment from assignments.models import Assignment
DEFAULT_RICH_TEXT_FEATURES = ['bold', 'italic', 'link', 'ol', 'ul'] DEFAULT_RICH_TEXT_FEATURES = ['ul']
INSTRUMENTS_RICH_TEXT_FEATURES = ['bold', 'ul']
# link_block # link_block
class LinkBlock(blocks.StructBlock): class LinkBlock(blocks.StructBlock):
@ -20,7 +20,7 @@ class TextBlock(blocks.StructBlock):
class Meta: class Meta:
icon = 'doc-full' icon = 'doc-full'
text = blocks.RichTextBlock() text = blocks.RichTextBlock(features=DEFAULT_RICH_TEXT_FEATURES)
# 'basic_knowledge' # 'basic_knowledge'
@ -74,9 +74,20 @@ class GeniallyBlock(blocks.StructBlock):
id = blocks.TextBlock() id = blocks.TextBlock()
class SectionTitleBlock(blocks.StructBlock):
text = blocks.TextBlock()
class SubtitleBlock(blocks.StructBlock): class SubtitleBlock(blocks.StructBlock):
text = blocks.TextBlock() text = blocks.TextBlock()
class InstrumentTextBlock(blocks.StructBlock):
class Meta:
icon = 'doc-full'
text = blocks.RichTextBlock(features=INSTRUMENTS_RICH_TEXT_FEATURES)
# 'text_block' 'task' 'basic_knowledge' 'student_entry' 'image_block' # 'text_block' 'task' 'basic_knowledge' 'student_entry' 'image_block'
# #
# url = blocks.URLBlock() # url = blocks.URLBlock()