Added prefix to edit forms
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Apr 2018 12:14:50 +0200
changeset 62 2ed574c8fcd1
parent 61 2ae762f667cb
child 63 60f427a8efde
Added prefix to edit forms
src/pyams_zmi/zmi/extension.py
src/pyams_zmi/zmi/site.py
src/pyams_zmi/zmi/skin.py
--- a/src/pyams_zmi/zmi/extension.py	Wed Apr 11 12:14:12 2018 +0200
+++ b/src/pyams_zmi/zmi/extension.py	Wed Apr 11 12:14:50 2018 +0200
@@ -61,6 +61,8 @@
 class GoogleTagManagerPropertiesEditForm(AdminDialogEditForm):
     """Google Tag Manager properties edit form"""
 
+    prefix = 'tagmanager_properties.'
+
     legend = _("Update Google Tag Manager properties")
     ajax_handler = 'tag-manager-properties.json'
     edit_permission = MANAGE_SYSTEM_PERMISSION
@@ -97,6 +99,8 @@
 class GoogleAnalyticsPropertiesEditForm(AdminDialogEditForm):
     """Google Analytics properties edit form"""
 
+    prefix = 'analytics_properties.'
+
     legend = _("Update Google Analytics properties")
     ajax_handler = 'analytics-properties.json'
     edit_permission = MANAGE_SYSTEM_PERMISSION
@@ -124,15 +128,17 @@
 
     label = _("UserReport settings...")
     icon_class = 'fa-comments'
-    url = 'user-report.html'
+    url = 'userreport-properties.html'
     modal_target = True
 
 
-@pagelet_config(name='user-report.html', context=ISiteRoot, layer=IPyAMSLayer,
+@pagelet_config(name='userreport-properties.html', context=ISiteRoot, layer=IPyAMSLayer,
                 permission=MANAGE_SYSTEM_PERMISSION)
 class UserReportPropertiesEditForm(AdminDialogEditForm):
     """UserReport properties edit form"""
 
+    prefix = 'userreport_properties.'
+
     legend = _("Update UserReport service properties")
     ajax_handler = 'user-report.json'
     edit_permission = MANAGE_SYSTEM_PERMISSION
--- a/src/pyams_zmi/zmi/site.py	Wed Apr 11 12:14:12 2018 +0200
+++ b/src/pyams_zmi/zmi/site.py	Wed Apr 11 12:14:50 2018 +0200
@@ -99,10 +99,12 @@
 
     def get_ajax_output(self, changes):
         if changes:
-            return {'status': 'reload',
-                    'location': '#properties.html',
-                    'smallbox': self.request.localizer.translate(self.successMessage),
-                    'smallbox_status': 'success'}
+            return {
+                'status': 'reload',
+                'location': '#properties.html',
+                'smallbox': self.request.localizer.translate(self.successMessage),
+                'smallbox_status': 'success'
+            }
         else:
             return AJAXEditForm.get_ajax_output(self, changes)
 
@@ -138,6 +140,8 @@
 class BackOfficePropertiesEditForm(AdminDialogEditForm):
     """Back-office properties edit form"""
 
+    prefix = 'backoffice_properties.'
+
     legend = _("Update site back-office properties")
     ajax_handler = 'back-office-properties.json'
     edit_permission = MANAGE_SYSTEM_PERMISSION
@@ -173,10 +177,12 @@
 
     def get_ajax_output(self, changes):
         if changes:
-            return {'status': 'reload',
-                    'location': '#properties.html',
-                    'smallbox': self.request.localizer.translate(self.successMessage),
-                    'smallbox_status': 'success'}
+            return {
+                'status': 'reload',
+                'location': '#properties.html',
+                'smallbox': self.request.localizer.translate(self.successMessage),
+                'smallbox_status': 'success'
+            }
         else:
             return AJAXEditForm.get_ajax_output(self, changes)
 
@@ -201,6 +207,8 @@
 class ZMIConfigurationEditForm(AdminDialogEditForm):
     """ZMI configuration edit form"""
 
+    prefix = 'zmi_properties.'
+
     legend = _("Update ZMI configuration")
     label_css_class = 'control-label col-md-4'
     input_css_class = 'col-md-8'
--- a/src/pyams_zmi/zmi/skin.py	Wed Apr 11 12:14:12 2018 +0200
+++ b/src/pyams_zmi/zmi/skin.py	Wed Apr 11 12:14:50 2018 +0200
@@ -60,6 +60,8 @@
 class UserSkinnablePropertiesEditForm(AdminDialogEditForm):
     """User skin properties edit form"""
 
+    prefix = 'skin_properties.'
+
     legend = _("Graphic theme elements")
     label_css_class = 'control-label col-md-4'
     input_css_class = 'col-md-8'