feat(editors): add editorial features aka the configurable edit link
This commit is contained in:
committed by
Benedikt Rötsch
parent
bf50c66df4
commit
240e008a87
13
views/mixins/_editorialFeatures.pug
Normal file
13
views/mixins/_editorialFeatures.pug
Normal file
@@ -0,0 +1,13 @@
|
||||
mixin editorialFeatures(entry)
|
||||
if settings.editorialFeatures
|
||||
.editorial-features
|
||||
.editorial-features__item
|
||||
a.editorial-features__text(
|
||||
href=`https://app.contentful.com/spaces/${settings.space}/entries/${entry.sys.id}`
|
||||
target='_blank'
|
||||
rel='noopener'
|
||||
) Edit in the web app
|
||||
.editorial-features__hint-wrapper
|
||||
svg.editorial-features__hint-icon
|
||||
use(xlink:href='/icons/icons.svg#info')
|
||||
.editorial-features__hint-message Edit this entry in our web app. You have to be logged in and have access to the connected space to use this feature.
|
||||
@@ -1,3 +1,4 @@
|
||||
include _editorialFeatures
|
||||
include _lessonModuleCodeSnippet
|
||||
include _lessonModuleCopy
|
||||
include _lessonModuleImage
|
||||
@@ -5,23 +6,24 @@ include _lessonModuleImage
|
||||
mixin lesson(lesson, course, nextLesson)
|
||||
.lesson
|
||||
h1.lesson__title #{lesson.fields.title}
|
||||
div.lesson__short-description !{helpers.markdown(lesson.fields.description)}
|
||||
+editorialFeatures(lesson)
|
||||
if lesson.fields.image
|
||||
img.lesson__image(src=`${lesson.fields.image.fields.file.url}` alt=`${lesson.fields.image.fields.title}`)
|
||||
each module in lesson.fields.modules
|
||||
if module.sys.contentType
|
||||
case module.sys.contentType.sys.id
|
||||
when 'lessonCodeSnippets'
|
||||
+lessonModuleCodeSnippet(module)
|
||||
when 'lessonCopy'
|
||||
+lessonModuleCopy(module)
|
||||
when 'lessonModuleImage'
|
||||
+lessonImage(module)
|
||||
else
|
||||
h2 ️️⚠️ Invalid lesson module
|
||||
p
|
||||
span Could not determine type of
|
||||
strong #{module.sys.id}
|
||||
.lesson__modules
|
||||
each module in lesson.fields.modules
|
||||
if module.sys.contentType
|
||||
case module.sys.contentType.sys.id
|
||||
when 'lessonCodeSnippets'
|
||||
+lessonModuleCodeSnippet(module)
|
||||
when 'lessonCopy'
|
||||
+lessonModuleCopy(module)
|
||||
when 'lessonModuleImage'
|
||||
+lessonImage(module)
|
||||
else
|
||||
h2 ️️⚠️ Invalid lesson module
|
||||
p
|
||||
span Could not determine type of
|
||||
strong #{module.sys.id}
|
||||
if nextLesson
|
||||
a.lesson__cta.cta(href=`/courses/${course.fields.slug}/lessons/${nextLesson.fields.slug}${queryString}`) View next lesson
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ mixin moduleCopy(module)
|
||||
.module
|
||||
div(class=`module-copy${style}`)
|
||||
div(class=`module-copy__first${style}`)
|
||||
h1(class=`module-copy__headline${style}`) #{module.fields.headline}
|
||||
if module.fields.headline
|
||||
h1(class=`module-copy__headline${style}`) #{module.fields.headline}
|
||||
div(class=`module-copy__copy${style}`) !{helpers.markdown(module.fields.copy)}
|
||||
div(class=`module-copy__second${style}`)
|
||||
if module.fields.ctaTitle && module.fields.ctaLink
|
||||
|
||||
Reference in New Issue
Block a user