Added subscriber for admin view created event
authorThierry Florac <thierry.florac@onf.fr>
Tue, 19 Jan 2016 10:33:11 +0100
changeset 14 0acae95be0bd
parent 13 1b81f4f5f1f1
child 15 00269ed7ab5e
Added subscriber for admin view created event
src/pyams_zmi/view.py
--- a/src/pyams_zmi/view.py	Tue Jan 19 10:32:02 2016 +0100
+++ b/src/pyams_zmi/view.py	Tue Jan 19 10:33:11 2016 +0100
@@ -15,8 +15,10 @@
 # import standard library
 
 # import interfaces
+from pyams_form.interfaces.form import IFormCreatedEvent
 from pyams_pagelet.interfaces import IPageletCreatedEvent
 from pyams_zmi.interfaces import IAdminView
+from pyams_zmi.layer import IAdminLayer
 
 # import packages
 from pyams_skin.skin import apply_skin
@@ -28,8 +30,16 @@
 class AdminView(object):
     """Base admin view"""
 
+    layer = IAdminLayer
+
 
 @subscriber(IPageletCreatedEvent, context_selector=IAdminView)
 def handle_admin_view(event):
-    """Set admin skin for admin pages"""
+    """Set skin for admin views"""
     apply_skin(event.object.request, 'PyAMS admin skin')
+
+
+@subscriber(IFormCreatedEvent, context_selector=IAdminView)
+def handle_admin_form(event):
+    """Set skin for admin forms"""
+    apply_skin(event.object.request, 'PyAMS admin skin')