lp1271198 Strip browse and facet parameters from links
authorKathy Lussier <klussier@masslnc.org>
Tue, 26 Aug 2014 19:49:45 +0000 (15:49 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 19 Sep 2014 00:36:54 +0000 (20:36 -0400)
Browse and facet parameters were sticking to links to author, subject and
series links on record and result pages, as well as some other links where
the search parameters were no longer necessary. This commit:

1. Adds browse_search_parms and facet_search_parms to header.tt2 as new
classes of search parameters that one may want to remove.

2. Removes these parameters from the author and subject links on the
record page. It also uses the same method for removing search parameters
from the author link on the search results page and on the searchbar
Browse link.

3. Fixes an issue where the advanced search links were inadvertently
stripping general search parameters.

4. Adds more parameters to the general_search_parms group so that we can
have cleaner URLs.

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/opac/parts/header.tt2
Open-ILS/src/templates/opac/parts/record/authors.tt2
Open-ILS/src/templates/opac/parts/record/series.tt2
Open-ILS/src/templates/opac/parts/record/subjects.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/src/templates/opac/results.tt2

index 57c293c..b0d6883 100644 (file)
 
     #variables to use to remove parameters via mkurk
     expert_search_parms = ['tag','subfield','term','_special'];
-    general_search_parms = ['page','sort','query'];
+    general_search_parms = ['page','sort','query','bool','contains','pubdate'];
+    browse_search_parms = ['fi:has_browse_entry','bterm','blimit','bpivot'];
+    facet_search_parms = ['facet'];
+
 
     # -----------------------------------------------------------------------------
     # mkurl( destination_page, params_to_set, params_to_clear )
index c8e5678..51fbe8f 100644 (file)
@@ -91,7 +91,7 @@ BLOCK build_author_links;
                 supp_term = supp_term _ ' ' _ sf;
             END;
         END;
-        url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms));
+        url = mkurl(ctx.opac_root _ '/results', {query => qterm.replace('^\s*(.*?)\s*$', '$1'), qtype => 'author'}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms));
         author_type = (tlabel || label) | html;
         
         # schema.org changes
index 0ddc378..4be6b83 100644 (file)
@@ -24,7 +24,7 @@ BLOCK render_series;
                 total_term = all_terms.join(" ").replace('\s+$', '');
 
                 url = mkurl(ctx.opac_root _ '/results',
-                    { qtype=>'series', query=>total_term }, stop_parms.merge(expert_search_parms, general_search_parms)
+                    { qtype=>'series', query=>total_term }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms)
                 );
                 series = series _ '<a href="' _ url _ '">' _ single_term _ '</a> ';
             END;
index 68c421b..e074f89 100644 (file)
@@ -47,7 +47,7 @@
                 all_terms.push(subfield.textContent.replace('\-', ' ').replace('[#"^$\+,\.:;&|\[\]()]', ''));
                 total_term = all_terms.join(" ").replace('\s+$', '');
             %]
-<a href="[% mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms.merge(expert_search_parms, general_search_parms)) %]">[% single_term %]</a>
+<a href="[% mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms)) %]">[% single_term %]</a>
             [%- END;
             IF all_terms.size; "<br/>"; END;
             FOREACH link880 IN graphics;
index ef3734b..ff9cda9 100644 (file)
@@ -114,7 +114,7 @@ END;
                                                                 class="record_author"
                                                                 href="[%- 
                                                                     authorquery = attrs.author | replace('[#"^$\+\-,\.:;&|\[\]()]', ' ');
-                                                                    mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
+                                                                    mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, general_search_parms.merge(expert_search_parms, browse_search_parms, facet_search_parms))
                                                                     -%]">[% attrs.author | html %]</a>
 [%-
 FOR entry IN attrs.graphic_authors;
index ac594ee..5eb3873 100644 (file)
@@ -6,9 +6,9 @@
     [%- END %]
     <div id="search-box">
         <span class="search_catalog_lbl mobile_hide">[% l('Search the Catalog') %]</span>
-        <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, general_search_parms.merge(expert_search_parms)) %]"
+        <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {},  expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]"
             id="home_adv_search_link">[% l('Advanced Search') %]</a></span>
-        <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, ['fi:has_browse_entry']) %]">[% l('Browse the Catalog') %]</a></span>
+        <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, expert_search_parms.merge(general_search_parms, facet_search_parms, ['fi:has_browse_entry'])) %]">[% l('Browse the Catalog') %]</a></span>
     </div>
     <div class="searchbar">
         <span class='search_box_wrapper'>
index a3cb0e1..92ae43c 100644 (file)
@@ -47,7 +47,7 @@
                     <a href="[% mkurl(ctx.opac_root _ '/home', {$loc_name => loc_value}, 1) %]">[% l('Another Search') %]</a>
                 </div>
                 <div class="results_header_btns">
-                    <a href="[% mkurl(ctx.opac_root _ '/advanced',{}, general_search_parms.merge(expert_search_parms)) %]">[% l('Advanced Search') %]</a>
+                    <a href="[% mkurl(ctx.opac_root _ '/advanced',{}, expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]">[% l('Advanced Search') %]</a>
                 </div>
                 <div id="refine_hits" class="results_header_btns result_block_visible"><a onclick="getFacety();">[% l('Refine these results') %]</a></div>
                 <div id="return_to_hits" class="results_header_btns"><a onclick="getResulty();">[% l('Back to results') %]</a></div>