--- a/src/pyams_content/component/illustration/__init__.py Thu Oct 12 22:32:05 2017 +0200
+++ b/src/pyams_content/component/illustration/__init__.py Fri Oct 13 08:13:10 2017 +0200
@@ -51,7 +51,9 @@
description = FieldProperty(IIllustration['description'])
author = FieldProperty(IIllustration['author'])
_data = I18nFileProperty(IIllustration['data'])
+ filename = FieldProperty(IIllustration['filename'])
renderer = FieldProperty(IIllustration['renderer'])
+ language = FieldProperty(IIllustration['language'])
@property
def data(self):
@@ -90,9 +92,11 @@
info = IFileInfo(data)
info.title = II18n(illustration).get_attribute('title', lang, request)
info.description = II18n(illustration).get_attribute('alt_title', lang, request)
- for lang, data in (illustration.data or {}).items():
- if data is not None:
- IFileInfo(data).language = lang
+ if not illustration.filename:
+ illustration.filename = info.filename
+ else:
+ info.filename = illustration.filename
+ info.language = illustration.language
@subscriber(IObjectAddedEvent, context_selector=IIllustration)
--- a/src/pyams_content/component/illustration/interfaces/__init__.py Thu Oct 12 22:32:05 2017 +0200
+++ b/src/pyams_content/component/illustration/interfaces/__init__.py Fri Oct 13 08:13:10 2017 +0200
@@ -39,7 +39,6 @@
"""Illustration paragraph"""
title = I18nTextLineField(title=_("Legend"),
- description=_("Illustration title"),
required=False)
alt_title = I18nTextLineField(title=_("Accessibility title"),
@@ -58,9 +57,18 @@
description=_("Image content"),
required=False)
+ filename = TextLine(title=_("Save file as..."),
+ description=_("Name under which the file will be saved"),
+ required=False)
+
renderer = Choice(title=_("Image style"),
vocabulary='PyAMS illustration renderers')
+ language = Choice(title=_("Language"),
+ description=_("File's content language"),
+ vocabulary="PyAMS base languages",
+ required=False)
+
class IIllustrationTarget(IAttributeAnnotatable):
"""Illustration target marker interface"""
@@ -79,5 +87,14 @@
description=_("Image content"),
required=True)
+ filename = TextLine(title=_("Save file as..."),
+ description=_("Name under which the file will be saved"),
+ required=False)
+
renderer = Choice(title=_("Image style"),
vocabulary='PyAMS illustration renderers')
+
+ language = Choice(title=_("Language"),
+ description=_("File's content language"),
+ vocabulary="PyAMS base languages",
+ required=False)