Add intro to instruments
This commit is contained in:
parent
5057e54e4d
commit
76b14e3cc8
|
|
@ -12,7 +12,7 @@
|
||||||
@edit-note="editNote"
|
@edit-note="editNote"
|
||||||
@bookmark="bookmark(!chapter.bookmark)"
|
@bookmark="bookmark(!chapter.bookmark)"
|
||||||
/>
|
/>
|
||||||
<p class="chapter__description">
|
<p class="chapter__description intro">
|
||||||
{{ chapter.description }}
|
{{ chapter.description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
@edit-note="editNote"
|
@edit-note="editNote"
|
||||||
@bookmark="bookmark(!module.bookmark)"/>
|
@bookmark="bookmark(!module.bookmark)"/>
|
||||||
<div
|
<div
|
||||||
class="module__intro"
|
class="module__intro intro"
|
||||||
v-html="module.intro"/>
|
v-html="module.intro"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
fragment InstrumentParts on InstrumentNode {
|
fragment InstrumentParts on InstrumentNode {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
intro
|
||||||
slug
|
slug
|
||||||
bookmarks {
|
bookmarks {
|
||||||
uuid
|
uuid
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
<div class="instrument">
|
<div class="instrument">
|
||||||
<h1 class="instrument__title">{{ instrument.title }}</h1>
|
<h1 class="instrument__title">{{ instrument.title }}</h1>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="instrument__intro intro"
|
||||||
|
v-html="instrument.intro"/>
|
||||||
|
|
||||||
<content-component
|
<content-component
|
||||||
:key="component.id"
|
:key="component.id"
|
||||||
:component="component"
|
:component="component"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
.intro {
|
||||||
|
@include lead-paragraph;
|
||||||
|
|
||||||
|
> p {
|
||||||
|
@include lead-paragraph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,3 +27,4 @@
|
||||||
@import "simple-list";
|
@import "simple-list";
|
||||||
@import "widget-popover";
|
@import "widget-popover";
|
||||||
@import "toast";
|
@import "toast";
|
||||||
|
@import "intro";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 2.2.12 on 2020-09-29 07:54
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
import wagtail.core.fields
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('basicknowledge', '0006_auto_20200520_0954'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='basicknowledge',
|
||||||
|
name='intro',
|
||||||
|
field=wagtail.core.fields.RichTextField(blank=True, default=''),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
|
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
|
||||||
from wagtail.core.fields import StreamField
|
from wagtail.core.fields import StreamField, RichTextField
|
||||||
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, ThinglinkBlock
|
GeniallyBlock, InstrumentTextBlock, SubtitleBlock, ThinglinkBlock, DEFAULT_RICH_TEXT_FEATURES
|
||||||
from core.wagtail_utils import StrictHierarchyPage
|
from core.wagtail_utils import StrictHierarchyPage
|
||||||
|
|
||||||
|
|
||||||
class BasicKnowledge(StrictHierarchyPage):
|
class BasicKnowledge(StrictHierarchyPage):
|
||||||
parent_page_types = ['books.book']
|
parent_page_types = ['books.book']
|
||||||
|
|
||||||
|
intro = RichTextField(features=DEFAULT_RICH_TEXT_FEATURES, default='', blank=True)
|
||||||
|
|
||||||
contents = StreamField([
|
contents = StreamField([
|
||||||
('text_block', InstrumentTextBlock()),
|
('text_block', InstrumentTextBlock()),
|
||||||
('image_block', ImageChooserBlock()),
|
('image_block', ImageChooserBlock()),
|
||||||
|
|
@ -42,6 +44,7 @@ class BasicKnowledge(StrictHierarchyPage):
|
||||||
content_panels = [
|
content_panels = [
|
||||||
FieldPanel('title', classname="full title"),
|
FieldPanel('title', classname="full title"),
|
||||||
FieldPanel('type'),
|
FieldPanel('type'),
|
||||||
|
FieldPanel('intro'),
|
||||||
StreamFieldPanel('contents')
|
StreamFieldPanel('contents')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class InstrumentNode(DjangoObjectType):
|
||||||
filter_fields = ['slug', 'type']
|
filter_fields = ['slug', 'type']
|
||||||
interfaces = (relay.Node,)
|
interfaces = (relay.Node,)
|
||||||
only_fields = [
|
only_fields = [
|
||||||
'slug', 'title', 'type', 'contents',
|
'slug', 'title', 'intro', 'type', 'contents',
|
||||||
]
|
]
|
||||||
|
|
||||||
def resolve_bookmarks(self, info, **kwargs):
|
def resolve_bookmarks(self, info, **kwargs):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue