Add intro to instruments
This commit is contained in:
parent
5057e54e4d
commit
76b14e3cc8
|
|
@ -12,7 +12,7 @@
|
|||
@edit-note="editNote"
|
||||
@bookmark="bookmark(!chapter.bookmark)"
|
||||
/>
|
||||
<p class="chapter__description">
|
||||
<p class="chapter__description intro">
|
||||
{{ chapter.description }}
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
@edit-note="editNote"
|
||||
@bookmark="bookmark(!module.bookmark)"/>
|
||||
<div
|
||||
class="module__intro"
|
||||
class="module__intro intro"
|
||||
v-html="module.intro"/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
fragment InstrumentParts on InstrumentNode {
|
||||
id
|
||||
title
|
||||
intro
|
||||
slug
|
||||
bookmarks {
|
||||
uuid
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
<div class="instrument">
|
||||
<h1 class="instrument__title">{{ instrument.title }}</h1>
|
||||
|
||||
<div
|
||||
class="instrument__intro intro"
|
||||
v-html="instrument.intro"/>
|
||||
|
||||
<content-component
|
||||
:key="component.id"
|
||||
:component="component"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
.intro {
|
||||
@include lead-paragraph;
|
||||
|
||||
> p {
|
||||
@include lead-paragraph;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,3 +27,4 @@
|
|||
@import "simple-list";
|
||||
@import "widget-popover";
|
||||
@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 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 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
|
||||
|
||||
|
||||
class BasicKnowledge(StrictHierarchyPage):
|
||||
parent_page_types = ['books.book']
|
||||
|
||||
intro = RichTextField(features=DEFAULT_RICH_TEXT_FEATURES, default='', blank=True)
|
||||
|
||||
contents = StreamField([
|
||||
('text_block', InstrumentTextBlock()),
|
||||
('image_block', ImageChooserBlock()),
|
||||
|
|
@ -42,6 +44,7 @@ class BasicKnowledge(StrictHierarchyPage):
|
|||
content_panels = [
|
||||
FieldPanel('title', classname="full title"),
|
||||
FieldPanel('type'),
|
||||
FieldPanel('intro'),
|
||||
StreamFieldPanel('contents')
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class InstrumentNode(DjangoObjectType):
|
|||
filter_fields = ['slug', 'type']
|
||||
interfaces = (relay.Node,)
|
||||
only_fields = [
|
||||
'slug', 'title', 'type', 'contents',
|
||||
'slug', 'title', 'intro', 'type', 'contents',
|
||||
]
|
||||
|
||||
def resolve_bookmarks(self, info, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in New Issue