Skip to content

Commit

Permalink
WCM-307: add teaser title, teaser text and background color to volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinnaj94 committed Sep 4, 2024
1 parent a940a8a commit 02762ce
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
14 changes: 13 additions & 1 deletion core/src/zeit/content/volume/browser/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ def doc(self):

class Base:
form_fields = zope.formlib.form.FormFields(zeit.content.volume.interfaces.IVolume).select(
'product', 'year', 'volume', 'date_digital_published', 'teaserText'
'product',
'year',
'volume',
'date_digital_published',
'teaserText',
'title',
'teaser',
'background_color',
)

field_groups = (
Expand All @@ -32,6 +39,11 @@ class Base:
('product', 'year', 'volume', 'date_digital_published', 'teaserText'),
css_class='column-left',
),
gocept.form.grouped.Fields(
_('Teaser'),
('title', 'teaser', 'background_color'),
css_class='wide-widgets column-left',
),
)

def __init__(self, context, request):
Expand Down
13 changes: 13 additions & 0 deletions core/src/zeit/content/volume/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ class IVolume(zeit.cms.content.interfaces.IXMLContent):

next = zope.interface.Attribute('The next IVolume object (by date_digital_published) or None')

title = zope.schema.TextLine(title=_('Title'), required=False)

teaser = zope.schema.TextLine(title=_('Teaser'), required=False)

background_color = zope.schema.TextLine(
title=_('Area background color (6 characters, no #)'),
description=_('Hex value of background color for area'),
required=False,
min_length=6,
max_length=6,
constraint=zeit.cms.content.interfaces.hex_literal,
)

def fill_template(text):
"""Fill in a string template with the placeholders year=self.year
and name=self.volume (zero-padded to two digits), e.g.
Expand Down
2 changes: 1 addition & 1 deletion core/src/zeit/content/volume/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Volume(zeit.cms.content.xmlsupport.XMLContentBase):
zeit.cms.content.dav.mapProperties(
zeit.content.volume.interfaces.IVolume,
zeit.cms.interfaces.DOCUMENT_SCHEMA_NS,
('date_digital_published', 'year', 'volume'),
('date_digital_published', 'year', 'volume', 'title', 'teaser', 'background_color'),
)

_product_id = zeit.cms.content.dav.DAVProperty(
Expand Down

0 comments on commit 02762ce

Please sign in to comment.