# HG changeset patch # User Thierry Florac # Date 1518194914 -3600 # Node ID 8fc847d839921d45efa6819a311bb8400bcaf24f # Parent 6cd4434612f573901931b30a30919f48ce49f7ca Added logos and logos paragraphs diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/generations/__init__.py --- a/src/pyams_content/generations/__init__.py Fri Feb 09 17:48:14 2018 +0100 +++ b/src/pyams_content/generations/__init__.py Fri Feb 09 17:48:34 2018 +0100 @@ -34,6 +34,7 @@ from pyams_content.shared.common.manager import SharedToolContainer from pyams_content.shared.form.manager import FormsManager from pyams_content.shared.imagemap.manager import ImageMapsManager +from pyams_content.shared.logo.manager import LogosManager from pyams_content.shared.news.manager import NewsManager from pyams_content.shared.view.manager import ViewsManager from pyams_i18n.index import I18nTextIndexWithInterface @@ -54,6 +55,7 @@ REQUIRED_TOOLS = [('views', ViewsManager), ('news', NewsManager), + ('logos', LogosManager), ('forms', FormsManager), ('imagemaps', ImageMapsManager)] @@ -126,7 +128,7 @@ factory = registry.settings.get('pyams_content.config.{name}_tool_factory'.format(name=name)) if (factory is None) or (factory.upper() not in ('NONE', '--')): attr_name = '{name}_tool_name'.format(name=name) - tool_name = getattr(config, attr_name) or \ + tool_name = getattr(config, attr_name, None) or \ registry.settings.get('pyams_content.config.{name}'.format(name=attr_name), name) if tool_name not in manager: if factory is not None: diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/__init__.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,67 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE +from pyams_content.shared.logo.interfaces import IWfLogo, LOGO_CONTENT_TYPE, LOGO_CONTENT_NAME, ILogo +from pyams_content.features.review import IReviewTarget + +# import packages +from pyams_content.shared.common import WfSharedContent, register_content_type, SharedContent, WfSharedContentChecker +from pyams_file.property import FileProperty +from pyams_utils.adapter import adapter_config +from zope.interface import implementer +from zope.schema.fieldproperty import FieldProperty + +from pyams_content import _ + + +@implementer(IWfLogo, IReviewTarget) +class WfLogo(WfSharedContent): + """Logo persistent class""" + + content_type = LOGO_CONTENT_TYPE + content_name = LOGO_CONTENT_NAME + + image = FileProperty(IWfLogo['image']) + url = FieldProperty(IWfLogo['url']) + + +register_content_type(WfLogo) + + +@implementer(ILogo) +class Logo(SharedContent): + """WOrkflow managed logo persistent class""" + + content_class = WfLogo + + +@adapter_config(name='properties', context=IWfLogo, provides=IContentChecker) +class WfLogoContentChecker(WfSharedContentChecker): + """Logo content checker""" + + def inner_check(self, request): + output = super(WfLogoContentChecker, self).inner_check(request) + translate = request.localizer.translate + if not (self.context.image and self.context.image.get_size()): + output.append(translate(MISSING_VALUE).format(field=translate(IWfLogo['image'].title), + message=translate(_("no image defined")))) + if not self.context.url: + output.append(translate(MISSING_VALUE).format(field=translate(IWfLogo['url'].title), + message=translate(_("no URL defined")))) + return output diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/interfaces/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/interfaces/__init__.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,61 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + +# import standard library + +# import interfaces +from pyams_content.component.paragraph import IBaseParagraph +from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent + +# import packages +from pyams_file.schema import ImageField +from pyams_sequence.schema import InternalReferencesList +from zope.schema import URI + +from pyams_content import _ + + +LOGO_CONTENT_TYPE = 'logo' +LOGO_CONTENT_NAME = _("Logo") + + +class ILogosManager(ISharedTool): + """Logos manager interface""" + + +class IWfLogo(IWfSharedContent): + """Logo interface""" + + image = ImageField(title=_("Image"), + description=_("Image data"), + required=True) + + url = URI(title=_("Target URL"), + description=_("URL used to access external resource"), + required=False) + + +class ILogo(ISharedContent): + """Workflow managed logo interface""" + + +class ILogosParagraph(IBaseParagraph): + """Logos paragraph""" + + references = InternalReferencesList(title=_("Logos references"), + description=_("List of internal logos references"), + content_type=LOGO_CONTENT_TYPE) + + def get_targets(self, state=None): + """Get references targets""" diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/manager.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/manager.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,46 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.shared.logo.interfaces import ILogosManager +from zope.annotation import IAttributeAnnotatable +from zope.component.interfaces import ISite +from zope.lifecycleevent import IObjectAddedEvent + +# import packages +from pyams_content.shared.common.manager import SharedTool +from pyams_content.shared.logo import LOGO_CONTENT_TYPE, Logo +from pyams_utils.traversing import get_parent +from pyramid.events import subscriber +from zope.interface import implementer + + +@implementer(ILogosManager, IAttributeAnnotatable) +class LogosManager(SharedTool): + """Logos manager class""" + + shared_content_type = LOGO_CONTENT_TYPE + shared_content_factory = Logo + + +@subscriber(IObjectAddedEvent, context_selector=ILogosManager) +def handle_added_logos_manager(event): + """Register logos manager when added""" + site = get_parent(event.newParent, ISite) + registry = site.getSiteManager() + if registry is not None: + registry.registerUtility(event.object, ILogosManager) diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/paragraph.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/paragraph.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,104 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE +from pyams_content.shared.logo.interfaces import ILogosParagraph +from pyams_i18n.interfaces import II18nManager, INegotiator, II18n +from pyams_workflow.interfaces import IWorkflow, IWorkflowState + +# import packages +from pyams_content.component.paragraph import BaseParagraph, IParagraphFactory, BaseParagraphFactory, \ + BaseParagraphContentChecker +from pyams_sequence.utility import get_reference_target +from pyams_utils.adapter import adapter_config +from pyams_utils.registry import utility_config, get_utility +from pyams_utils.traversing import get_parent +from zope.interface import implementer +from zope.schema.fieldproperty import FieldProperty + +from pyams_content import _ + + +@implementer(ILogosParagraph) +class LogosParagraph(BaseParagraph): + """Logos paragraph""" + + icon_class = 'fa-th-large' + icon_hint = _("Logos") + + references = FieldProperty(ILogosParagraph['references']) + + def get_targets(self, state=None, with_reference=False): + for reference in self.references or (): + if with_reference: + yield reference, get_reference_target(reference, state) + else: + yield get_reference_target(reference, state) + + +@utility_config(name='Logos', provides=IParagraphFactory) +class LogosParagraphFactory(BaseParagraphFactory): + """Logos paragraph factory""" + + name = _("Logos") + content_type = LogosParagraph + + +@adapter_config(context=ILogosParagraph, provides=IContentChecker) +class LogosParagraphContentChecker(BaseParagraphContentChecker): + """Logos paragraph content checker""" + + def inner_check(self, request): + output = [] + translate = request.localizer.translate + manager = get_parent(self.context, II18nManager) + if manager is not None: + langs = manager.get_languages() + else: + negotiator = get_utility(INegotiator) + langs = (negotiator.server_language, ) + i18n = II18n(self.context) + for lang in langs: + value = i18n.get_attribute('title', lang, request) + if not value: + field_title = translate(ILogosParagraph['title'].title) + if len(langs) == 1: + output.append(translate(MISSING_VALUE).format(field=field_title)) + else: + output.append(translate(MISSING_LANG_VALUE).format(field=field_title, lang=lang)) + field_title = translate(ILogosParagraph['references'].title) + if not self.context.references: + output.append(translate(ERROR_VALUE).format( + field=field_title, + message=translate(_("no selected logo")))) + else: + for reference, target in self.context.get_targets(with_reference=True): + if target is None: + output.append(translate(ERROR_VALUE).format( + field=field_title, + message=translate(_("logo '{0}' can't be found")).format(reference))) + else: + workflow = IWorkflow(target, None) + if workflow is not None: + workflow_state = IWorkflowState(target) + if workflow_state.state not in workflow.published_states: + output.append(translate(ERROR_VALUE).format( + field=field_title, + message=translate(_("logo '{0}' is not published")).format( + II18n(target).query_attribute('title', request=request)))) + return output diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/zmi/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/zmi/__init__.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.interfaces import CREATE_CONTENT_PERMISSION +from pyams_content.shared.logo.interfaces import ILogosManager +from pyams_i18n.interfaces import II18n +from pyams_skin.interfaces import IContentTitle +from pyams_skin.interfaces.viewlet import IMenuHeader, IWidgetTitleViewletManager +from pyams_skin.layer import IPyAMSLayer +from pyams_zmi.interfaces.menu import IContentManagementMenu +from pyams_zmi.layer import IAdminLayer + +# import packages +from pyams_content.shared.common.zmi import SharedContentAddForm, SharedContentAJAXAddForm +from pyams_content.shared.logo import IWfLogo +from pyams_pagelet.pagelet import pagelet_config +from pyams_skin.viewlet.toolbar import ToolbarAction +from pyams_utils.adapter import adapter_config, ContextRequestAdapter, ContextRequestViewAdapter +from pyams_viewlet.viewlet import viewlet_config +from pyramid.view import view_config +from zope.interface import Interface + +from pyams_content import _ + + +@adapter_config(context=(IWfLogo, IContentManagementMenu), provides=IMenuHeader) +class LogoContentMenuHeader(ContextRequestAdapter): + """Logo content menu header adapter""" + + header = _("This logo") + + +@adapter_config(context=(IWfLogo, IPyAMSLayer, Interface), provides=IContentTitle) +class LogoTitleAdapter(ContextRequestViewAdapter): + """Logo title adapter""" + + @property + def title(self): + translate = self.request.localizer.translate + return translate(_("Logo « {title} »")).format( + title=II18n(self.context).query_attribute('title', request=self.request)) + + +@viewlet_config(name='add-shared-content.action', context=ILogosManager, layer=IAdminLayer, view=Interface, + manager=IWidgetTitleViewletManager, permission=CREATE_CONTENT_PERMISSION, weight=1) +class LogoAddAction(ToolbarAction): + """Logo adding action""" + + label = _("Add logo") + label_css_class = 'fa fa-fw fa-plus' + url = 'add-shared-content.html' + modal_target = True + + +@pagelet_config(name='add-shared-content.html', context=ILogosManager, layer=IPyAMSLayer, + permission=CREATE_CONTENT_PERMISSION) +class LogoAddForm(SharedContentAddForm): + """Logo add form""" + + legend = _("Add logo") + + +@view_config(name='add-shared-content.json', context=ILogosManager, request_type=IPyAMSLayer, + permission=CREATE_CONTENT_PERMISSION, renderer='json', xhr=True) +class LogoAJAXAddForm(SharedContentAJAXAddForm, LogoAddForm): + """Logo add form, JSON renderer""" diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/zmi/paragraph.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/zmi/paragraph.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,164 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ + IParagraphSummary +from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor +from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION +from pyams_content.shared.common import IWfSharedContent +from pyams_content.shared.logo.interfaces import ILogosParagraph +from pyams_form.interfaces.form import IInnerForm, IEditFormButtons +from pyams_i18n.interfaces import II18n +from pyams_skin.interfaces.viewlet import IToolbarAddingMenu +from pyams_skin.layer import IPyAMSLayer +from z3c.form.interfaces import INPUT_MODE + +# import packages +from pyams_content.component.paragraph.zmi import IParagraphContainerView, BaseParagraphAddMenu, \ + BaseParagraphAJAXAddForm, BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm +from pyams_content.shared.logo.paragraph import LogosParagraph +from pyams_pagelet.pagelet import pagelet_config +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyams_utils.traversing import get_parent +from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider +from pyams_zmi.form import AdminDialogAddForm +from pyramid.view import view_config +from z3c.form import field, button +from zope.interface import implementer + +from pyams_content import _ + + +@viewlet_config(name='add-logos-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView, + layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=600) +class LogosParagraphAddMenu(BaseParagraphAddMenu): + """Logos paragraph add menu""" + + label = _("Add logos...") + label_css_class = 'fa fa-fw fa-th-large' + url = 'add-logos-paragraph.html' + paragraph_type = 'Logos' + + +@pagelet_config(name='add-logos-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION) +class LogosParagraphAddForm(AdminDialogAddForm): + """Logos paragraph add form""" + + legend = _("Add new logos paragraph") + icon_css_class = 'fa fa-fw fa-th-large' + + fields = field.Fields(ILogosParagraph).omit('__parent__', '__name__', 'visible') + ajax_handler = 'add-logos-paragraph.json' + edit_permission = MANAGE_CONTENT_PERMISSION + + def create(self, data): + return LogosParagraph() + + def add(self, object): + IParagraphContainer(self.context).append(object) + + +@view_config(name='add-logos-paragraph.json', context=IParagraphContainerTarget, request_type=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True) +class LogosParagraphAJAXAddForm(BaseParagraphAJAXAddForm, LogosParagraphAddForm): + """Logos paragraph add form, JSON renderer""" + + +@pagelet_config(name='properties.html', context=ILogosParagraph, layer=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION) +class LogosParagraphPropertiesEditForm(BaseParagraphPropertiesEditForm): + """Logos paragraph properties edit form""" + + @property + def title(self): + content = get_parent(self.context, IWfSharedContent) + return II18n(content).query_attribute('title', request=self.request) + + legend = _("Edit paragraph properties") + icon_css_class = 'fa fa-fw fa-th-large' + + fields = field.Fields(ILogosParagraph).omit('__parent__', '__name__', 'visible') + ajax_handler = 'properties.json' + edit_permission = MANAGE_CONTENT_PERMISSION + + +@view_config(name='properties.json', context=ILogosParagraph, request_type=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True) +class LogosParagraphPropertiesAJAXEditForm(BaseParagraphAJAXEditForm, LogosParagraphPropertiesEditForm): + """Logos paragraph properteis edit form, JSOn renderer""" + + +@adapter_config(context=(ILogosParagraph, IPyAMSLayer), provides=IParagraphInnerEditor) +@implementer(IInnerForm) +class LogosParagraphInnerEditForm(LogosParagraphPropertiesEditForm): + """Logos paragraph properties inner edit form""" + + legend = None + ajax_handler = 'inner-properties.json' + + @property + def buttons(self): + if self.mode == INPUT_MODE: + return button.Buttons(IEditFormButtons) + else: + return button.Buttons() + + +@view_config(name='inner-properties.json', context=ILogosParagraph, request_type=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True) +class LogosParagraphInnerAJAXEditForm(BaseParagraphAJAXEditForm, LogosParagraphInnerEditForm): + """Logos paragraph properteis inner edit form, JSON renderer""" + + def get_ajax_output(self, changes): + output = super(LogosParagraphInnerAJAXEditForm, self).get_ajax_output(changes) + if 'references' in changes.get(ILogosParagraph, ()): + form = LogosParagraphInnerEditForm(self.context, self.request) + form.update() + content = form.getContent() + output.setdefault('events', []).append({ + 'evennt': 'myams.refresh', + 'options': { + 'object_id': '{0}_{1}_{2}'.format( + content.__class__.__name__, + getattr(content, '__name__', 'noname').replace('++', ''), + form.id), + 'content': form.render() + } + }) + return output + + +# +# Logos paragraph summary +# + +@adapter_config(context=(ILogosParagraph, IPyAMSLayer), provides=IParagraphSummary) +@template_config(template='templates/paragraph-summary.pt', layer=IPyAMSLayer) +class LogosParagraphSummary(BaseContentProvider): + """Logos paragraph summary""" + + language = None + + def update(self): + i18n = II18n(self.context) + if self.language: + setattr(self, 'title', i18n.get_attribute('title', self.language, request=self.request)) + else: + setattr(self, 'title', i18n.query_attribute('title', request=self.request)) diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/zmi/properties.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/zmi/properties.py Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,49 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.shared.logo import IWfLogo +from pyams_form.interfaces.form import IInnerSubForm +from pyams_skin.layer import IPyAMSLayer + +# import packages +from pyams_content.shared.common.zmi.properties import SharedContentPropertiesEditForm +from pyams_utils.adapter import adapter_config +from pyams_zmi.form import InnerAdminEditForm +from z3c.form import field + +from pyams_content import _ + + +@adapter_config(name='logo-settings', + context=(IWfLogo, IPyAMSLayer, SharedContentPropertiesEditForm), + provides=IInnerSubForm) +class LogoPropertiesEditForm(InnerAdminEditForm): + """Logo properties edit form extension""" + + legend = _("Main logo settings") + fieldset_class = 'bordered no-x-margin margin-y-10' + + fields = field.Fields(IWfLogo).select('image', 'url') + weight = 1 + + def get_ajax_output(self, changes): + if 'image' in changes.get(IWfLogo, ()): + return {'status': 'reload', + 'message': self.request.localizer.translate(self.successMessage)} + else: + return super(LogoPropertiesEditForm, self).get_ajax_output(changes) diff -r 6cd4434612f5 -r 8fc847d83992 src/pyams_content/shared/logo/zmi/templates/paragraph-summary.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/logo/zmi/templates/paragraph-summary.pt Fri Feb 09 17:48:34 2018 +0100 @@ -0,0 +1,14 @@ +

title

+
+ + + + + + + +