--- a/src/pyams_content/shared/form/zmi/field.py Fri Jul 19 08:13:59 2019 +0200
+++ b/src/pyams_content/shared/form/zmi/field.py Fri Jul 26 12:58:31 2019 +0200
@@ -10,8 +10,6 @@
# FOR A PARTICULAR PURPOSE.
#
-__docformat__ = 'restructuredtext'
-
import json
from pyramid.decorator import reify
@@ -36,6 +34,7 @@
from pyams_i18n.interfaces import II18n
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.container import switch_element_visibility
+from pyams_skin.event import get_json_table_row_refresh_event
from pyams_skin.interfaces.container import ITableWithActions
from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
@@ -54,6 +53,9 @@
from pyams_zmi.layer import IAdminLayer
from pyams_zmi.view import ContainerAdminView
+
+__docformat__ = 'restructuredtext'
+
from pyams_content import _
@@ -63,7 +65,7 @@
"""Form fields menu"""
label = _("Form fields...")
- icon_class = 'fa-pencil-square-o'
+ icon_class = 'fa-th-list'
url = '#form-fields.html'
@@ -242,7 +244,7 @@
"""Form field add form"""
legend = _("Add form field")
- icon_css_class = 'fa fa-fw fa-pencil-square-o'
+ icon_css_class = 'fa fa-fw fa-th-list'
fields = field.Fields(IFormField).omit('__parent__', '__name__', 'visible')
edit_permission = MANAGE_CONTENT_PERMISSION
@@ -280,7 +282,7 @@
return II18n(content).query_attribute('title', request=self.request)
legend = _("Edit form field properties")
- icon_class = 'fa fa-fw fa-pencil-square-o'
+ icon_class = 'fa fa-fw fa-th-list'
fields = field.Fields(IFormField).omit('__parent__', '__name__', 'visible')
edit_permission = MANAGE_CONTENT_PERMISSION
@@ -292,14 +294,8 @@
def get_ajax_output(self, changes):
output = super(self.__class__, self).get_ajax_output(changes)
- if 'label' in changes.get(IFormField, ()):
- output.setdefault('events', []).append({
- 'event': 'myams.refresh',
- 'options': {
- 'handler': 'PyAMS_content.fields.refreshField',
- 'object_name': self.context.__name__,
- 'title': II18n(self.context).query_attribute('label', request=self.request),
- 'visible': self.context.visible
- }
- })
+ if changes:
+ container = get_parent(self.context, IFormFieldContainerTarget)
+ output.setdefault('events', []).append(
+ get_json_table_row_refresh_event(container, self.request, FormFieldsContainerTable, self.context))
return output