From: Rogan Hamby <rogan.hamby@gmail.com>
Date: Mon, 21 Oct 2019 16:02:24 +0000 (-0400)
Subject: loading custom css from library setting
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=485624d4a7bc8d44843857060b72a813e47573ab;p=evergreen%2Fjoelewis.git

loading custom css from library setting

Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Garry Collum <gcollum@gmail.com>
Signed-off-by: Jason Boyer <jboyer@equinoxinitiative.org>
---

diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 04ca260c36..32dcd0fffa 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -4408,6 +4408,15 @@ INSERT into config.org_unit_setting_type
         'coust', 'description'),
     'integer', null)
 
+,( 'opac.patron.custom_css', 'opac',
+    oils_i18n_gettext('opac.patron.custom_css',
+        'Custom CSS for the OPAC',
+        'coust', 'label'),
+    oils_i18n_gettext('opac.patron.custom_css',
+        'Custom CSS for the OPAC',
+        'coust', 'description'),
+    'string', NULL)
+
 ,( 'opac.payment_history_age_limit', 'opac',
     oils_i18n_gettext('opac.payment_history_age_limit',
         'Payment History Age Limit',
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.data.opac_custom_css.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.opac_custom_css.sql
new file mode 100644
index 0000000000..9715d1d276
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.opac_custom_css.sql
@@ -0,0 +1,16 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version);
+
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype, fm_class ) VALUES
+( 'opac.patron.custom_css', 'opac',
+    oils_i18n_gettext('opac.patron.custom_css',
+        'Custom CSS for the OPAC',
+        'coust', 'label'),
+    oils_i18n_gettext('opac.patron.custom_css',
+        'Custom CSS for the OPAC',
+        'coust', 'description'),
+    'string', NULL);
+
+COMMIT;
diff --git a/Open-ILS/src/templates/opac/parts/base.tt2 b/Open-ILS/src/templates/opac/parts/base.tt2
index b28f45ceb8..b6c2876a8a 100644
--- a/Open-ILS/src/templates/opac/parts/base.tt2
+++ b/Open-ILS/src/templates/opac/parts/base.tt2
@@ -16,7 +16,12 @@
         [% IF ctx.get_i18n_l(ctx.eg_locale).rtl == 't' %]
         <link rel="stylesheet" type="text/css" href="[% ctx.media_prefix %]/css/skin/default/opac/semiauto-rtl.css[% ctx.cache_key %]" />
         [% END %]
-        
+
+        [% IF ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_css') %]
+            [% custom_css = ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_css') %]
+        [% '<style>'; custom_css ; '</style>' %]                                          
+        [% END %]
+
         [%- libname = ctx.get_aou(ctx.search_ou).name;
             libname = libname | html;
             libsname = ctx.get_aou(ctx.search_ou).shortname; %]
diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/custom_css_in_opac.adoc b/docs/RELEASE_NOTES_NEXT/OPAC/custom_css_in_opac.adoc
new file mode 100644
index 0000000000..ab0f2abb1e
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/OPAC/custom_css_in_opac.adoc
@@ -0,0 +1,6 @@
+Custom CSS in OPAC 
+^^^^^^^^^^^^^^^^^^
+
+There is now a library setting called opac.patron.custom_css.  This can be populated with CSS that will load in the OPAC after the stylesheets and allow for custom CSS without editing server side templates.  
+
+