Use SEO-related title input field
authorThierry Florac <thierry.florac@onf.fr>
Fri, 08 Dec 2017 10:44:43 +0100
changeset 309 7f470b562ab8
parent 308 adc7fa946d13
child 310 61c586146b50
Use SEO-related title input field
src/pyams_content/shared/common/zmi/properties.py
--- a/src/pyams_content/shared/common/zmi/properties.py	Fri Dec 08 10:44:08 2017 +0100
+++ b/src/pyams_content/shared/common/zmi/properties.py	Fri Dec 08 10:44:43 2017 +0100
@@ -18,23 +18,23 @@
 # import interfaces
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION, IBaseContent
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_form.interfaces.form import IWidgetForm, IInnerSubForm
+from pyams_form.interfaces.form import IWidgetForm
 from pyams_skin.interfaces import IInnerPage, IPageHeader
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
-from pyams_workflow.interfaces import IWorkflowPublicationInfo
 from pyams_zmi.interfaces.menu import IContentManagementMenu, IPropertiesMenu
 from pyams_zmi.layer import IAdminLayer
 
 # import packages
 from pyams_content.shared.common.zmi import WfSharedContentHeaderAdapter
 from pyams_form.form import AJAXEditForm
+from pyams_i18n.widget import I18nSEOTextLineFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.viewlet.menu import MenuItem
 from pyams_utils.adapter import adapter_config
 from pyams_viewlet.manager import viewletmanager_config
 from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminEditForm, InnerAdminEditForm
+from pyams_zmi.form import AdminEditForm
 from pyramid.view import view_config
 from z3c.form import field
 from zope.interface import implementer
@@ -77,6 +77,8 @@
     legend = _("Content properties")
 
     fields = field.Fields(IWfSharedContent).select('title', 'short_name', 'description', 'keywords', 'notepad')
+    fields['title'].widgetFactory = I18nSEOTextLineFieldWidget
+
     ajax_handler = 'properties.json'
 
     def updateWidgets(self, prefix=None):
@@ -105,25 +107,3 @@
     """Shared content properties header adapter"""
 
     icon_class = 'fa fa-fw fa-edit'
-
-
-@adapter_config(name='publication',
-                context=(IWfSharedContent, IPyAMSLayer, SharedContentPropertiesEditForm),
-                provides=IInnerSubForm)
-class SharedContentPublicationPropertiesEditForm(InnerAdminEditForm):
-    """Shared content properties edit form extension"""
-
-    legend = _("Publication settings")
-    fieldset_class = 'bordered no-x-margin margin-y-10'
-
-    fields = field.Fields(IWorkflowPublicationInfo).select('publication_effective_date', 'push_end_date',
-                                                           'publication_expiration_date', 'displayed_publication_date')
-
-    weight = 20
-
-    def get_ajax_output(self, changes):
-        wf_changes = changes.get(IWorkflowPublicationInfo, ())
-        if ('publication_effective_date' in wf_changes) or ('displayed_publication_date' in wf_changes):
-            return {'status': 'reload'}
-        else:
-            return super(SharedContentPublicationPropertiesEditForm, self).get_ajax_output(changes)