Moved forms to ".zmi" sub-package
authorThierry Florac <tflorac@ulthar.net>
Sun, 11 Mar 2018 11:16:23 +0100
changeset 49 0b1285117171
parent 48 4f9900ac02a1
child 50 c68bcd7f6fe1
Moved forms to ".zmi" sub-package
src/pyams_zmi/skin.py
--- a/src/pyams_zmi/skin.py	Sun Mar 11 11:15:57 2018 +0100
+++ b/src/pyams_zmi/skin.py	Sun Mar 11 11:16:23 2018 +0100
@@ -16,21 +16,11 @@
 # import standard library
 
 # import interfaces
-from pyams_skin.interfaces import ISkin, IUserSkinnable
-from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import MANAGE_SKIN_PERMISSION
-from pyams_zmi.interfaces.menu import IPropertiesMenu
+from pyams_skin.interfaces import ISkin
 from pyams_zmi.layer import IAdminLayer
 
 # import packages
-from pyams_form.form import AJAXEditForm
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.viewlet.menu import MenuItem, MenuDivider
 from pyams_utils.registry import utility_config
-from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogEditForm
-from pyramid.view import view_config
-from z3c.form import field
 
 from pyams_zmi import _
 
@@ -41,50 +31,3 @@
 
     label = _("PyAMS management skin")
     layer = IAdminLayer
-
-
-#
-# User skinnable properties configuration
-#
-
-@viewlet_config(name='user-skin-properties.divider', context=IUserSkinnable, layer=IAdminLayer, manager=IPropertiesMenu,
-                permission=MANAGE_SKIN_PERMISSION, weight=199)
-class UserSkinnablePropertiesMenuDivider(MenuDivider):
-    """User skin properties menu divider"""
-
-
-@viewlet_config(name='user-skin-properties.menu', context=IUserSkinnable, layer=IAdminLayer, manager=IPropertiesMenu,
-                permission=MANAGE_SKIN_PERMISSION, weight=200)
-class UserSkinnablePropertiesMenuItem(MenuItem):
-    """User skin properties menu"""
-
-    label = _("Graphic theme...")
-    icon_class = 'fa-paint-brush'
-    url = 'user-skin-properties.html'
-    modal_target = True
-
-
-@pagelet_config(name='user-skin-properties.html', context=IUserSkinnable, layer=IPyAMSLayer,
-                permission=MANAGE_SKIN_PERMISSION)
-class UserSkinnablePropertiesEditForm(AdminDialogEditForm):
-    """User skin properties edit form"""
-
-    legend = _("Graphic theme elements")
-    label_css_class = 'control-label col-md-4'
-    input_css_class = 'col-md-8'
-
-    @property
-    def fields(self):
-        fields = field.Fields(IUserSkinnable)
-        if not self.context.can_inherit_skin:
-            fields = fields.omit('inherit_skin')
-        return fields
-
-    ajax_handler = 'user-skin-properties.json'
-    edit_permission = MANAGE_SKIN_PERMISSION
-
-
-@view_config(name='user-skin-properties.json', context=IUserSkinnable, request_type=IPyAMSLayer,
-             permission=MANAGE_SKIN_PERMISSION, renderer='json', xhr=True)
-class UserSkinnablePropertiesAJAXEditForm(AJAXEditForm, UserSkinnablePropertiesEditForm):
-    """User skin properties edit form, JSON renderer"""