# HG changeset patch # User Thierry Florac # Date 1522935006 -7200 # Node ID a3f26cfd30940649176c5930efa6e3cfb998c8fb # Parent a1d5eb955e5485d063f534563ae35fd0bd348051 Pictograms updates diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/component/paragraph/interfaces/pictogram.py --- a/src/pyams_content/component/paragraph/interfaces/pictogram.py Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/component/paragraph/interfaces/pictogram.py Thu Apr 05 15:30:06 2018 +0200 @@ -51,8 +51,8 @@ pictogram = Attribute("Select pictogram object") - label = I18nTextLineField(title=_("Alternate label"), - description=_("Alternate pictogram label; if not specified, the pictogram title " + label = I18nTextLineField(title=_("Alternate header"), + description=_("Alternate pictogram label; if not specified, the pictogram header " "will be used"), required=False) diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/component/paragraph/zmi/pictogram.py --- a/src/pyams_content/component/paragraph/zmi/pictogram.py Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/component/paragraph/zmi/pictogram.py Thu Apr 05 15:30:06 2018 +0200 @@ -35,6 +35,7 @@ from z3c.table.interfaces import IValues, IColumn # import packages +from pyams_content.component.paragraph import BaseParagraph from pyams_content.component.paragraph.pictogram import PictogramParagraph, PictogramItem from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \ BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm @@ -269,7 +270,7 @@ if pictogram is not None: image = II18n(pictogram).query_attribute('image', request=self.request) if image: - return ''.format(absolute_url(image, self.request, '++thumb++32x32')) + return ''.format(absolute_url(image, self.request, '++thumb++48x48')) return '--' @@ -318,29 +319,29 @@ class PictogramsTableNameColumn(I18nColumn, I18nAttrColumn): """Pictograms table name column""" - _header = _("Label") + _header = _("pictogram-item-header", default="Header") attrName = 'label' weight = 10 def getValue(self, obj): value = super(PictogramsTableNameColumn, self).getValue(obj) if not value: - value = II18n(obj.pictogram).query_attribute('title', request=self.request) - return value + value = II18n(obj.pictogram).query_attribute('header', request=self.request) + return value or BaseParagraph.empty_title @adapter_config(name='body', context=(IPictogramContainerTarget, IPyAMSLayer, PictogramsTable), provides=IColumn) class PictogramsTableBodyColumn(I18nColumn, I18nAttrColumn): """Pictograms table body column""" - _header = _("Body") + _header = _("Associated text") attrName = 'body' weight = 20 def getValue(self, obj): value = super(PictogramsTableBodyColumn, self).getValue(obj) if not value: - return '--' + return BaseParagraph.empty_title return get_text_start(value, 40, 10) diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/reference/pictograms/__init__.py --- a/src/pyams_content/reference/pictograms/__init__.py Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/reference/pictograms/__init__.py Thu Apr 05 15:30:06 2018 +0200 @@ -30,6 +30,7 @@ from pyams_utils.vocabulary import vocabulary_config from pyramid.events import subscriber from zope.interface import implementer +from zope.schema.fieldproperty import FieldProperty from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm @@ -52,6 +53,8 @@ """Pictogram persistent class""" image = I18nFileProperty(IPictogram['image']) + alt_title = FieldProperty(IPictogram['alt_title']) + header = FieldProperty(IPictogram['header']) @vocabulary_config(name=PICTOGRAM_VOCABULARY) diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/reference/pictograms/interfaces/__init__.py --- a/src/pyams_content/reference/pictograms/interfaces/__init__.py Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/reference/pictograms/interfaces/__init__.py Thu Apr 05 15:30:06 2018 +0200 @@ -20,7 +20,7 @@ from zope.annotation.interfaces import IAttributeAnnotatable # import packages -from pyams_i18n.schema import I18nImageField +from pyams_i18n.schema import I18nImageField, I18nTextLineField from zope.container.constraints import containers, contains from zope.interface import Interface from zope.schema import List, Choice @@ -45,6 +45,14 @@ description=_("Pictogram content"), required=True) + alt_title = I18nTextLineField(title=_("Accessibility title"), + description=_("Alternate title used to describe image content"), + required=False) + + header = I18nTextLineField(title=_('pictogram-header', default="Header"), + description=_("Default header associated with this pictogram"), + required=False) + class IPictogramTable(IReferenceTable): """Pictograms table interface""" diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/reference/pictograms/zmi/__init__.py --- a/src/pyams_content/reference/pictograms/zmi/__init__.py Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/reference/pictograms/zmi/__init__.py Thu Apr 05 15:30:06 2018 +0200 @@ -65,6 +65,7 @@ """Pictogram add form""" legend = _("Add new pictogram") + dialog_class = 'modal-large' fields = field.Fields(IPictogram).omit('__parent__', '__name__') ajax_handler = 'add-pictogram.json' diff -r a1d5eb955e54 -r a3f26cfd3094 src/pyams_content/reference/pictograms/zmi/templates/manager-selection.pt --- a/src/pyams_content/reference/pictograms/zmi/templates/manager-selection.pt Wed Apr 04 15:35:44 2018 +0200 +++ b/src/pyams_content/reference/pictograms/zmi/templates/manager-selection.pt Thu Apr 05 15:30:06 2018 +0200 @@ -13,10 +13,18 @@ tal:repeat="pictogram view.available_pictograms"> -
+
+ + + +
+
+ tal:attributes="src extension:absolute_url(img, '++thumb++48x48')" />
Title
@@ -32,10 +40,18 @@ tal:repeat="pictogram view.selected_pictograms"> -
+
+ + + +
+
+ tal:attributes="src extension:absolute_url(img, '++thumb++48x48')" />
Title