adding query to opac by library setting
authorRogan Hamby <rogan.hamby@gmail.com>
Mon, 21 Oct 2019 13:47:45 +0000 (09:47 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 25 Mar 2022 21:01:10 +0000 (17:01 -0400)
Signed-off-by: Garry Collum <gcollum@gmail.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/xxxx.data.jquery_opac_library_setting.sql [new file with mode: 0644]
Open-ILS/src/templates-bootstrap/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/js.tt2
docs/RELEASE_NOTES_NEXT/OPAC/jquery_opac_setting.adoc [new file with mode: 0644]

index 4b21270..a0f937c 100644 (file)
@@ -4660,6 +4660,15 @@ INSERT into config.org_unit_setting_type
         'coust', 'description'),
     'string', null)
 
+,( 'opac.patron.custom_jquery', 'opac',
+    oils_i18n_gettext('opac.patron.custom_jquery',
+        'Custom jQuery for the OPAC',
+        'coust', 'label'),
+    oils_i18n_gettext('opac.patron.custom_jquery',
+        'Custom jQuery for the OPAC',
+        'coust', 'description'),
+    'string', NULL)
+
 ,( 'org.patron_opt_boundary', 'sec',
     oils_i18n_gettext('org.patron_opt_boundary',
         'Patron Opt-In Boundary',
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.data.jquery_opac_library_setting.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.jquery_opac_library_setting.sql
new file mode 100644 (file)
index 0000000..28fe478
--- /dev/null
@@ -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_jquery', 'opac',
+    oils_i18n_gettext('opac.patron.custom_jquery',
+        'Custom jQuery for the OPAC',
+        'coust', 'label'),
+    oils_i18n_gettext('opac.patron.custom_jquery',
+        'Custom jQuery for the OPAC',
+        'coust', 'description'),
+    'string', NULL);
+
+COMMIT;
index 51f9e3a..87b7752 100755 (executable)
 </script>
 [% END %]
 
+[% IF ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_jquery') %]
+[%     custom_jquery = ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_jquery') %]
+[%     '<script>'; custom_jquery ; '</script>' %]
+[% END %]
+
 <!-- DOB validation for Patron Registration in OPAC -->
 <script >
     function dobValidate(input) {
index aa4e9f5..71512ec 100644 (file)
 </script>
 [% END %]
 
+[% IF ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_jquery') %]
+[%     custom_jquery = ctx.get_org_setting(ctx.search_ou, 'opac.patron.custom_jquery') %]
+[%     '<script>'; custom_jquery ; '</script>' %]                                          
+[% END %]
+
 <!-- DOB validation for Patron Registration in OPAC -->
 <script type="text/javascript">
     function dobValidate(input) {
diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/jquery_opac_setting.adoc b/docs/RELEASE_NOTES_NEXT/OPAC/jquery_opac_setting.adoc
new file mode 100644 (file)
index 0000000..97bc531
--- /dev/null
@@ -0,0 +1,8 @@
+jQuery OPAC Library Setting 
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A new setting entitled opac.patron.custom_jquery has been added to library settings. Using this does require that the ctx.want_jquery be uncommented and set to 1 (true) in the opac/parts/config.tt2 file.  Using this setting will allow OPACs to run jQuery without customizing server side templates.  For example adding the following:
+
+$(document).ready(function(){ $("a:contains(Link 2)").text('Kafka'); });
+
+Will change the text of 'Link 2' in the link bar to say 'Kafka'.  See the Evergreen WIKI (https://wiki.evergreen-ils.org/) for examples.