--- a/src/pyams_content/component/paragraph/audio.py Wed Jun 27 15:54:28 2018 +0200
+++ b/src/pyams_content/component/paragraph/audio.py Wed Jun 27 16:20:47 2018 +0200
@@ -44,10 +44,9 @@
icon_class = 'fa-volume-up'
icon_hint = AUDIO_PARAGRAPH_NAME
- body = FieldProperty(IAudioParagraph['body'])
+ data = FileProperty(IAudioParagraph['data'])
description = FieldProperty(IAudioParagraph['description'])
author = FieldProperty(IAudioParagraph['author'])
- data = FileProperty(IAudioParagraph['data'])
renderer = FieldProperty(IAudioParagraph['renderer'])
--- a/src/pyams_content/component/paragraph/interfaces/audio.py Wed Jun 27 15:54:28 2018 +0200
+++ b/src/pyams_content/component/paragraph/interfaces/audio.py Wed Jun 27 16:20:47 2018 +0200
@@ -20,7 +20,7 @@
# import packages
from pyams_file.schema import AudioField
-from pyams_i18n.schema import I18nHTMLField, I18nTextField
+from pyams_i18n.schema import I18nTextField, I18nTextLineField
from zope.schema import TextLine, Choice
from pyams_content import _
@@ -38,8 +38,12 @@
class IAudioParagraph(IBaseParagraph):
"""Audio paragraph"""
- body = I18nHTMLField(title=_("Body"),
- required=False)
+ data = AudioField(title=_("Audio data"),
+ description=_("Audio file content"),
+ required=True)
+
+ title = I18nTextLineField(title=_("Legend"),
+ required=False)
description = I18nTextField(title=_("Description"),
description=_("File description displayed by front-office template"),
@@ -49,10 +53,6 @@
description=_("Name of document's author"),
required=False)
- data = AudioField(title=_("Audio data"),
- description=_("Audio file content"),
- required=True)
-
renderer = Choice(title=_("Audio template"),
description=_("Presentation template used for this audio file"),
vocabulary=AUDIO_PARAGRAPH_RENDERERS,
--- a/src/pyams_content/component/paragraph/zmi/audio.py Wed Jun 27 15:54:28 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/audio.py Wed Jun 27 16:20:47 2018 +0200
@@ -31,10 +31,9 @@
# import packages
from pyams_content.component.paragraph.audio import AudioParagraph
from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
- BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons
+ BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons, get_json_paragraph_refresh_event
from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
from pyams_form.form import ajax_config
-from pyams_form.group import NamedWidgetsGroup
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.event import get_json_form_refresh_event, get_json_widget_refresh_event
from pyams_utils.adapter import adapter_config
@@ -75,20 +74,6 @@
super(AudioParagraphAddForm, self).updateWidgets(prefix)
if 'description' in self.widgets:
self.widgets['description'].widget_css_class = 'textarea'
- if 'body' in self.widgets:
- self.widgets['body'].label = ''
-
- def updateGroups(self):
- self.add_group(NamedWidgetsGroup(self, 'body_group', self.widgets, ('body',),
- bordered=False,
- legend=_("HTML content"),
- css_class='inner switcher padding-right-10 no-y-padding pull-left',
- switch=True,
- display_mode='auto'))
- self.add_group(NamedWidgetsGroup(self, 'data_group', self.widgets,
- ('description', 'author', 'data', 'renderer'),
- bordered=False))
- super(AudioParagraphAddForm, self).updateGroups()
def create(self, data):
return AudioParagraph()
@@ -118,21 +103,6 @@
super(AudioParagraphPropertiesEditForm, self).updateWidgets(prefix)
if 'description' in self.widgets:
self.widgets['description'].widget_css_class = 'textarea'
- if 'body' in self.widgets:
- self.widgets['body'].label = ''
-
- def updateGroups(self):
- self.add_group(NamedWidgetsGroup(self, 'body_group', self.widgets, ('body',),
- bordered=False,
- fieldset_class='margin-top-10 padding-y-5',
- legend=_("HTML content"),
- css_class='inner switcher padding-right-10 no-y-padding pull-left',
- switch=True,
- display_mode='auto'))
- self.add_group(NamedWidgetsGroup(self, 'data_group', self.widgets,
- ('description', 'author', 'data', 'renderer'),
- bordered=False))
- super(AudioParagraphPropertiesEditForm, self).updateGroups()
@adapter_config(context=(IAudioParagraph, IPyAMSLayer), provides=IParagraphInnerEditor)
@@ -159,8 +129,12 @@
ITransactionManager(self.context).get().commit()
output.setdefault('events', []).append(
get_json_form_refresh_event(self.context, self.request, AudioParagraphPropertiesInnerEditForm))
- elif 'renderer' in updated:
- output.setdefault('events', []).append(
- get_json_widget_refresh_event(self.context, self.request,
- AudioParagraphPropertiesInnerEditForm, 'renderer'))
+ else:
+ if 'title' in updated:
+ output.setdefault('events', []).append(
+ get_json_paragraph_refresh_event(self.context, self.request))
+ if 'renderer' in updated:
+ output.setdefault('events', []).append(
+ get_json_widget_refresh_event(self.context, self.request,
+ AudioParagraphPropertiesInnerEditForm, 'renderer'))
return output