Added custom resources to selected skin
authorThierry Florac <tflorac@ulthar.net>
Wed, 12 Dec 2018 10:13:00 +0100
changeset 485 bd3550a252ea
parent 484 0424aeca91a3
child 486 48b7cea0d903
Added custom resources to selected skin
src/pyams_skin/__init__.py
src/pyams_skin/interfaces/__init__.py
src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo
src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po
src/pyams_skin/locales/pyams_skin.pot
--- a/src/pyams_skin/__init__.py	Wed Dec 12 10:08:24 2018 +0100
+++ b/src/pyams_skin/__init__.py	Wed Dec 12 10:13:00 2018 +0100
@@ -93,6 +93,11 @@
                          depends=(jquery,),
                          bottom=True)
 
+myams_js_require = Resource(library, 'js/myams-require.js',
+                            minified='js/myams-require.min.js',
+                            depends=(jquery,),
+                            bottom=True)
+
 myams_plugins_loader = Resource(library, 'js/myams-plugins-loader.js',
                                 minified='js/myams-plugins-loader.min.js',
                                 depends=(myams_js_core,),
--- a/src/pyams_skin/interfaces/__init__.py	Wed Dec 12 10:08:24 2018 +0100
+++ b/src/pyams_skin/interfaces/__init__.py	Wed Dec 12 10:13:00 2018 +0100
@@ -12,17 +12,14 @@
 
 __docformat__ = 'restructuredtext'
 
-# import standard library
-
-# import interfaces
-from pyams_skin.layer import IPyAMSLayer
 from zope.component.interfaces import IObjectEvent, ObjectEvent
+from zope.configuration.fields import GlobalInterface
+from zope.interface import implementer, invariant, Interface, Attribute, Invalid
+from zope.schema import Text, TextLine, Choice, Int, Bool
 
-# import packages
+from pyams_file.schema import FileField
+from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import layout_config
-from zope.interface import implementer, invariant, Interface, Attribute, Invalid
-from zope.configuration.fields import GlobalInterface
-from zope.schema import Text, TextLine, Choice, Int, Bool
 
 from pyams_skin import _
 
@@ -80,6 +77,19 @@
     def get_skin(self, request=None):
         """Get skin matching this content"""
 
+    custom_stylesheet = FileField(title=_("Custom stylesheet"),
+                                  description=_("This custom stylesheet will be used to override selected theme styles"),
+                                  required=False)
+
+    editor_stylesheet = FileField(title=_("Editor stylesheet"),
+                                  description=_("Styles defined into this stylesheet will be available into HTML editor"),
+                                  required=False)
+
+    custom_script = FileField(title=_("Custom script"),
+                              description=_("This custom javascript file will be used to add dynamic features to "
+                                            "selected theme"),
+                              required=False)
+
 
 class IUserSkinnable(ISkinnable):
     """User skinnable content interface"""
Binary file src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.mo has changed
--- a/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po	Wed Dec 12 10:08:24 2018 +0100
+++ b/src/pyams_skin/locales/fr/LC_MESSAGES/pyams_skin.po	Wed Dec 12 10:13:00 2018 +0100
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-09-26 18:58+0200\n"
+"POT-Creation-Date: 2018-12-12 09:30+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,7 +15,7 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Lingua 3.8\n"
 
-#: src/pyams_skin/skin.py:157
+#: src/pyams_skin/skin.py:202
 msgid "PyAMS base skin"
 msgstr "Skin PyAMS par défaut"
 
@@ -170,38 +170,70 @@
 "Le titre des outils partagés doit-il être affiché dans les en-têtes de "
 "pages ?"
 
-#: src/pyams_skin/interfaces/__init__.py:58
+#: src/pyams_skin/interfaces/__init__.py:55
 msgid "Inherit parent skin?"
 msgstr "Hériter du thème du parent ?"
 
-#: src/pyams_skin/interfaces/__init__.py:59
+#: src/pyams_skin/interfaces/__init__.py:56
 msgid "Should we reuse parent skin?"
 msgstr "Si 'oui', le même thème que celui du niveau parent sera utilisé"
 
-#: src/pyams_skin/interfaces/__init__.py:63
+#: src/pyams_skin/interfaces/__init__.py:60
 msgid "Don't inherit parent skin?"
 msgstr "Ne pas hériter du thème du parent ?"
 
-#: src/pyams_skin/interfaces/__init__.py:64
+#: src/pyams_skin/interfaces/__init__.py:61
 msgid "Should we override parent skin?"
 msgstr "Si 'non', le même thème que celui du niveau parent sera utilisé"
 
-#: src/pyams_skin/interfaces/__init__.py:70
+#: src/pyams_skin/interfaces/__init__.py:67
 msgid "Custom graphic theme"
 msgstr "Choisir un thème spécifique"
 
-#: src/pyams_skin/interfaces/__init__.py:71
+#: src/pyams_skin/interfaces/__init__.py:68
 msgid "This theme will be used to handle graphic design (colors and images)"
 msgstr ""
 "Ce thème sera utilisé pour prendre en charge le modèle de présentation "
 "(palette de couleurs et images)"
 
-#: src/pyams_skin/interfaces/__init__.py:78
+#: src/pyams_skin/interfaces/__init__.py:80
+msgid "Custom stylesheet"
+msgstr "Feuille de style personnalisée"
+
+#: src/pyams_skin/interfaces/__init__.py:81
+msgid "This custom stylesheet will be used to override selected theme styles"
+msgstr ""
+"Cette feuille de style pourra être utilisée pour surcharger les styles "
+"proposés par le thème graphique sélectionné"
+
+#: src/pyams_skin/interfaces/__init__.py:84
+msgid "Editor stylesheet"
+msgstr "Feuille de style HTML"
+
+#: src/pyams_skin/interfaces/__init__.py:85
+msgid "Styles defined into this stylesheet will be available into HTML editor"
+msgstr ""
+"Les styles définis dans cette feuille de style seront accessibles aux contributeurs au sein "
+"de l'éditeur HTML ; consultez la documentation pour connaître les contraintes qui s'appliquent"
+
+#: src/pyams_skin/interfaces/__init__.py:88
+msgid "Custom script"
+msgstr "Script additionnel"
+
+#: src/pyams_skin/interfaces/__init__.py:89
+msgid ""
+"This custom javascript file will be used to add dynamic features to selected "
+"theme"
+msgstr ""
+"Ce fichier javascript pourra ajouter des fonctionnalités supplémentaires à celles proposées "
+"par le thème graphique sélectionné"
+
+#: src/pyams_skin/interfaces/__init__.py:75
 msgid "You must select a custom skin or inherit from parent!"
 msgstr ""
 "Vous devez choisir un thème spécifique ou hériter de celui du niveau parent"
 
-#: src/pyams_skin/interfaces/viewlet.py:258
+#: src/pyams_skin/interfaces/viewlet.py:264
 msgid "&lt;i class=&#39;fa fa-refresh fa-spin&#39;&gt;&lt;/i&gt;"
 msgstr "&lt;i class=&#39;fa fa-refresh fa-spin&#39;&gt;&lt;/i&gt;"
 
--- a/src/pyams_skin/locales/pyams_skin.pot	Wed Dec 12 10:08:24 2018 +0100
+++ b/src/pyams_skin/locales/pyams_skin.pot	Wed Dec 12 10:13:00 2018 +0100
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-09-26 18:58+0200\n"
+"POT-Creation-Date: 2018-12-12 09:30+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,7 +16,7 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Lingua 3.10.dev0\n"
 
-#: ./src/pyams_skin/skin.py:157
+#: ./src/pyams_skin/skin.py:202
 msgid "PyAMS base skin"
 msgstr ""
 
@@ -159,35 +159,61 @@
 msgid "Should shared tool title be displayed into shared content's title area?"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:58
+#: ./src/pyams_skin/interfaces/__init__.py:55
 msgid "Inherit parent skin?"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:59
+#: ./src/pyams_skin/interfaces/__init__.py:56
 msgid "Should we reuse parent skin?"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:63
+#: ./src/pyams_skin/interfaces/__init__.py:60
 msgid "Don't inherit parent skin?"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:64
+#: ./src/pyams_skin/interfaces/__init__.py:61
 msgid "Should we override parent skin?"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:70
+#: ./src/pyams_skin/interfaces/__init__.py:67
 msgid "Custom graphic theme"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:71
+#: ./src/pyams_skin/interfaces/__init__.py:68
 msgid "This theme will be used to handle graphic design (colors and images)"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/__init__.py:78
+#: ./src/pyams_skin/interfaces/__init__.py:80
+msgid "Custom stylesheet"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:81
+msgid "This custom stylesheet will be used to override selected theme styles"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:84
+msgid "Editor stylesheet"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:85
+msgid "Styles defined into this stylesheet will be available into HTML editor"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:88
+msgid "Custom script"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:89
+msgid ""
+"This custom javascript file will be used to add dynamic features to selected "
+"theme"
+msgstr ""
+
+#: ./src/pyams_skin/interfaces/__init__.py:75
 msgid "You must select a custom skin or inherit from parent!"
 msgstr ""
 
-#: ./src/pyams_skin/interfaces/viewlet.py:258
+#: ./src/pyams_skin/interfaces/viewlet.py:264
 msgid "&lt;i class=&#39;fa fa-refresh fa-spin&#39;&gt;&lt;/i&gt;"
 msgstr ""