--- a/src/source/howto-skin.rst Fri May 25 14:28:29 2018 +0200
+++ b/src/source/howto-skin.rst Tue Jun 19 16:11:57 2018 +0200
@@ -1,5 +1,75 @@
.. _skinhowto:
-How to create a new skin?
-=========================
+How to create Skin?
+===================
+
+A Skin is a tagging interface for associating media, javascript and CSS resources to a **renderer**
+
+1) Configuring resource library
+-------------------------------
+
+
+.. code-block:: python
+
+ from fanstatic import Library, Resource
+ from pyams_default_theme import pyams_default_theme
+
+ #Library(name, folder_path)
+ library = Library('mycms', 'resources')
+
+ #Resource(library, path_to_static)
+ mycms_css = Resource(library, 'css/mystyle.css',)
+
+
+ mycms_js = Resource(library, 'js/pyams-default.js',
+ depends=(pyams_default_theme, )
+ bottom=True
+ )
+
+
+:py:class:`Resource` can include others resources already defined with *depends* attribute, here `pyams_default_theme`.
+
+
+2) Create a new Layer to your skin
+----------------------------------
+
+Build a new interface inherit from `ICustomLayer`
+
+.. code-block:: python
+
+ class ICustomLayer(ICustomLayer):
+ """skin layer"""
+
+Define an utility providing ISkin with the custom label and the layer interface
+
+.. code-block:: python
+
+ @utility_config(name='Custom skin', provides=ISkin)
+ class CustomSkin(object):
+ """custom root skin"""
+
+ label = _("Custom: skin")
+ layer = ICustomLayer
+
+
+3) Declare the layer adapter
+----------------------------
+
+.. code-block:: python
+
+ @adapter_config(context=(Interface, ICustomLayer, Interface), provides=IResources)
+ class CustomSkinResourcesAdapter(ContextRequestViewAdapter):
+ """Custom skin resources adapter"""
+
+ def get_resources(self):
+ mycms.need()
+
+
+We have defined a Multiadapter with context=(context, request, view).
+
+.. note::
+
+ In the ZMI website you can now change the default graphical theme by you custom skin
+
+ .. image:: _static/select_skin.png