Skip to content

Commit

Permalink
WCM-614: Add IVideo.body markdown field
Browse files Browse the repository at this point in the history
  • Loading branch information
wosc committed Jan 20, 2025
1 parent de0ac95 commit d92508f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/zeit/content/video/browser/tests/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def test_add_video(self):
b.getControl('Title').value = 'myvid'
b.getControl('External ID').value = '1234'
b.getControl('Ressort').displayValue = ['Deutschland']
b.getControl('Markdown content').value = '# my title'
b.getControl(name='form.actions.add').click()
self.assertEllipsis('...Edit Video...', b.contents)
b.getLink('Checkin').click()
self.assertEllipsis('..."myvideo" has been checked in...', b.contents)
self.assertEllipsis('...External ID...1234...', b.contents)
self.assertEllipsis('...<h1>my title</h1>...', b.contents)
6 changes: 6 additions & 0 deletions core/src/zeit/content/video/browser/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Base(zeit.push.browser.form.SocialBase, zeit.push.browser.form.MobileBase)
'title',
)
+ FormFields(zeit.content.video.interfaces.IVideo).select(
'body',
'duration',
'expires',
'external_id',
Expand Down Expand Up @@ -83,6 +84,11 @@ class Base(zeit.push.browser.form.SocialBase, zeit.push.browser.form.MobileBase)
gocept.form.grouped.Fields(
_('Video-Thumbnail'), ('image',), css_class='wide-widgets column-left'
),
gocept.form.grouped.Fields(
_('Texts'),
('body',),
css_class='wide-widgets column-left',
),
gocept.form.grouped.RemainingFields('', css_class='column-left'),
)

Expand Down
2 changes: 2 additions & 0 deletions core/src/zeit/content/video/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class IVideo(
width = zope.schema.Int(title=_('Width of the Frame'), required=False)
url = zope.schema.URI(title=_('URI of the rendition'), required=False)

body = zeit.cms.content.field.Markdown(title=_('Markdown content'), required=False)


class VideoSource(zeit.cms.content.contentsource.CMSContentSource):
name = 'video'
Expand Down
2 changes: 2 additions & 0 deletions core/src/zeit/content/video/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class Video(zeit.cms.content.metadata.CommonMetadata):
('duration', 'width', 'url'),
)

body = zeit.cms.content.property.Structure('.body.text')

@property
def renditions(self):
return self._player_data['renditions']
Expand Down

0 comments on commit d92508f

Please sign in to comment.