# HG changeset patch # User Thierry Florac # Date 1518106890 -3600 # Node ID d433c8c46ec9a3322b70e5e7f492ea6a9c1c2c28 # Parent 8409f13da5d02ed9324359c4f5f6c936b8d0f23c Updated associations interface to add user icon diff -r 8409f13da5d0 -r d433c8c46ec9 src/pyams_content/component/association/interfaces/__init__.py --- a/src/pyams_content/component/association/interfaces/__init__.py Thu Feb 08 15:51:58 2018 +0100 +++ b/src/pyams_content/component/association/interfaces/__init__.py Thu Feb 08 17:21:30 2018 +0100 @@ -55,6 +55,8 @@ user_title = Attribute("Association title proposed on public site") + user_icon = Attribute("Iocn associated with user title") + inner_title = Attribute("Inner content, if available") human_size = Attribute("Content size, if available") diff -r 8409f13da5d0 -r d433c8c46ec9 src/pyams_content/component/association/zmi/__init__.py --- a/src/pyams_content/component/association/zmi/__init__.py Thu Feb 08 15:51:58 2018 +0100 +++ b/src/pyams_content/component/association/zmi/__init__.py Thu Feb 08 17:21:30 2018 +0100 @@ -230,9 +230,12 @@ def getValue(self, obj): info = IAssociationInfo(obj, None) if info is not None: - return info.user_title + title = info.user_title else: - return '--' + title = '--' + if info.user_icon: + title += ' ' + info.user_icon + return title @adapter_config(name='inner_name', context=(IAssociationTarget, IPyAMSLayer, AssociationsTable), provides=IColumn) diff -r 8409f13da5d0 -r d433c8c46ec9 src/pyams_content/component/extfile/__init__.py --- a/src/pyams_content/component/extfile/__init__.py Thu Feb 08 15:51:58 2018 +0100 +++ b/src/pyams_content/component/extfile/__init__.py Thu Feb 08 17:21:30 2018 +0100 @@ -87,15 +87,19 @@ @property def user_title(self): + title = II18n(self.context).query_attribute('title') + if not title: + title = self.context.filename + return title + + @property + def user_icon(self): filename = self.context.filename if filename: name, ext = os.path.splitext(filename) - return '{title} '.format( - title=II18n(self.context).query_attribute('title') or filename, thumb=EXTENSIONS_THUMBNAILS.get(ext, 'unknown.png')) - else: - return '--' @property def inner_title(self): diff -r 8409f13da5d0 -r d433c8c46ec9 src/pyams_content/component/links/__init__.py --- a/src/pyams_content/component/links/__init__.py Thu Feb 08 15:51:58 2018 +0100 +++ b/src/pyams_content/component/links/__init__.py Thu Feb 08 17:21:30 2018 +0100 @@ -77,6 +77,8 @@ def pictogram(self): return self.context.icon_class + user_icon = None + class BaseLinkContentChecker(BaseContentChecker): """Base link content checker"""