# HG changeset patch # User Thierry Florac # Date 1542636937 -3600 # Node ID be5bc85fd4427925f6ef1626828fe4a1cc5b3a88 # Parent 44ac5e31ce873ae1afca8cd86709833d614cce8a Created custom editor for contact card diff -r 44ac5e31ce87 -r be5bc85fd442 src/pyams_default_theme/component/paragraph/zmi/contact.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/component/paragraph/zmi/contact.py Mon Nov 19 15:15:37 2018 +0100 @@ -0,0 +1,38 @@ +# +# 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' + +from pyramid.decorator import reify + +from pyams_content.component.paragraph.interfaces.contact import IContactParagraph, have_gis +from pyams_content.features.renderer.zmi import RendererPropertiesEditForm +from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION +from pyams_form.form import ajax_config +from pyams_pagelet.pagelet import pagelet_config +from pyams_skin.layer import IPyAMSLayer + + +@pagelet_config(name='renderer-properties.html', context=IContactParagraph, layer=IPyAMSLayer, + permission=MANAGE_CONTENT_PERMISSION) +@ajax_config(name='renderer-properties.json', context=IContactParagraph, layer=IPyAMSLayer) +class ContactParagraphRendererPropertiesEditForm(RendererPropertiesEditForm): + """Contact paragraph renderer properties edit form""" + + dialog_class = 'modal-large' + + @reify + def fields(self): + fields = super(ContactParagraphRendererPropertiesEditForm, self).fields + if not have_gis: + fields = fields.omit('display_map', 'map_position') + return fields