LP#1744385: Allow highlight disabling globally via config.tt2
authorMike Rylander <mrylander@gmail.com>
Wed, 10 Jan 2018 19:44:48 +0000 (14:44 -0500)
committerDan Wells <dbw2@calvin.edu>
Wed, 28 Feb 2018 21:18:40 +0000 (16:18 -0500)
Also, add CC0 highlighter icon from https://pixabay.com/en/highlight-highlighter-highlighting-2022407/
and provide highlight en/dis-able.

Signed-off-by: Mike Rylander <miker@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/misc_util.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/web/images/highlight.png [new file with mode: 0644]

index 28f730c..ac731cd 100644 (file)
@@ -181,6 +181,9 @@ search.basic_config = {
 # Make metarecord search the default.
 #search.metarecord_default = 1;
 
+# Disable search term highlighting
+#search.no_highlight = 1;
+
 ##############################################################################
 # Show Google Book Previews
 # Set to 1 or 'true' to enable
index 2d48ccc..ba507bd 100644 (file)
 
         args.display_fields = {};
         args.hl = {};
-        IF !CGI.param('no_highlight');
+        IF !CGI.param('no_highlight') && !search.no_highlight;
             args.display_field_list = ctx.fetch_display_fields(args.df_bib_list.list);
 
             FOR df IN args.display_field_list;
index 20b7d36..15d2a37 100644 (file)
                     </a>
                 </div>
             [% END %]
+            [% IF !search.no_highlight %]
+            <div class="rdetail_aux_utils highlighting">
+              [% IF CGI.param('no_highlight') %]
+                <a href="[% mkurl('', {}, ['no_highlight']) %]" class="no-dec">
+              [% ELSE %]
+                <a href="[% mkurl('', {no_highlight => '1'}) %]" class="no-dec">
+              [% END %]
+                     <img src="[% ctx.media_prefix %]/images/highlight.png[% ctx.cache_key %]" alt="[% l('Toggle highlighting') %]" />
+                     [% CGI.param('no_highlight') ?  l('Enable Highlighting') : l('Disable Highlighting') %]
+                </a>
+            </div>
+            [% END %]
             [%- IF ctx.is_staff %]
             <div class="rdetail_aux_utils clear_addedcontent_cache">
                 <a href="[% ctx.media_prefix %]/opac/extras/ac/clearcache/all/r/[% ctx.bre_id | uri %]" class="no-dec" target="_blank">
index c33a897..0a5f62f 100644 (file)
@@ -94,7 +94,7 @@ END;
               id='search_org_selector' show_loc_groups=1
         -%]
         </label>
-    <span>
+      <span>
         <input id="detail" type="hidden" name="detail_record_view" value="[% show_detail_view %]"/>
         <input id='search-submit-go' type="submit" value="[% l('Search') %]" class="opac-button"
             onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden";[% IF ctx.depth_sel_button AND NOT took_care_of_form %] $("search-submit-go-depth").className="hidden";[% END %]}, 2000)'/>
@@ -103,7 +103,15 @@ END;
             onclick='setTimeout(function(){$("search-submit-spinner").className=""; $("search-submit-go").className="hidden"; $("search-submit-go-depth").className="hidden";}, 2000)' title="[% ctx.depth_sel_tooltip | html %]">[% ctx.depth_sel_button_label | html %]</button>
         [%- END %]
         <img id='search-submit-spinner' src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif[% ctx.cache_key %]' style='height:16px;width:16px;' class='hidden' alt='[% l("Search In Progress") %]'/>
-    </span>
+        [%- IF took_care_of_form && !search.no_highlight %]
+        <label for="no_highlight">
+          <input type="checkbox" id="no_highlight" name="no_highlight" value="1"
+              onchange="search_modifier_onchange('no_highlight', this, true)"
+              [% CGI.param('no_highlight').size ? ' checked="checked"' : '' %] />
+          [% l('Disable Highlighting') %]
+        </label>
+        [%- END %]
+      </span>
     </div>
     [% IF ctx.bookbag %]
     <div id="search-only-bookbag-container">
diff --git a/Open-ILS/web/images/highlight.png b/Open-ILS/web/images/highlight.png
new file mode 100644 (file)
index 0000000..d550b46
Binary files /dev/null and b/Open-ILS/web/images/highlight.png differ