From bd14556057505af2cdffbabd96c4d286a80744bd Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 19 May 2016 15:53:48 -0400 Subject: [PATCH] LP 1548993: Restore Show More/Show Fewer Details button functionality. When using a show_more_details.default setting of true in config.tt2, the Show More/Show Fewer Details button functionality is broken. The detail record view is always shown, regardless of the button's state. This patch attempts to repair the behavior so that the user can toggle the detail record view even though the default is set to true. Signed-off-by: Jason Stephenson Signed-off-by: Jeanette Lundgren Signed-off-by: Kathy Lussier --- Open-ILS/src/templates/opac/parts/header.tt2 | 13 +++++++++++++ Open-ILS/src/templates/opac/parts/result/table.tt2 | 13 +++---------- Open-ILS/src/templates/opac/parts/searchbar.tt2 | 4 +--- Open-ILS/src/templates/opac/results.tt2 | 10 ++-------- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/header.tt2 b/Open-ILS/src/templates/opac/parts/header.tt2 index b0d68836d2..8b60ba9c7b 100644 --- a/Open-ILS/src/templates/opac/parts/header.tt2 +++ b/Open-ILS/src/templates/opac/parts/header.tt2 @@ -12,6 +12,19 @@ is_advanced = CGI.param("_adv").size; is_special = CGI.param("_special").size; + # Check if we want to show the detail record view. Doing this + # here because we don't want to repeat logic in multiple other + # files, nor do we want to add a new tt2 file just for this. The + # below is currently needed for parts/result/table.tt2, + # parts/searchbar.tt2, and results.tt2. + show_detail_view = 0; + IF CGI.param("detail_record_view").defined; + show_detail_view = CGI.param("detail_record_view"); + ELSIF show_more_details.default == "true" OR + show_more_details.default == "hide"; + show_detail_view = 1; + END; + #variables to use to remove parameters via mkurk expert_search_parms = ['tag','subfield','term','_special']; general_search_parms = ['page','sort','query','bool','contains','pubdate']; diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 251d069726..960d8c652f 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -43,9 +43,7 @@ [% FOR rec IN ctx.records; attrs = {marc_xml => rec.marc_xml}; PROCESS get_marc_attrs args=attrs; - IF CGI.param('detail_record_view') - OR (show_more_details.default == 'true' - OR show_more_details.default == 'hide'); + IF show_detail_view; attrs.title = attrs.title_extended; END; # note: rec.id refers to the record identifier, regardless @@ -146,9 +144,7 @@ END; [% format.label | html %] [% END %] [%- END %] - [%- UNLESS CGI.param('detail_record_view') - OR (show_more_details.default == 'true' - OR show_more_details.default == 'hide'); + [%- UNLESS show_detail_view; IF attrs.pubdate; pubdate_clean = attrs.pubdate | html; l(" ([_1])", pubdate_clean); @@ -174,10 +170,7 @@ END; [% END %] [% END %] - [%- IF CGI.param('detail_record_view') - OR (show_more_details.default == 'true' - OR show_more_details.default == 'hide'); - -%] + [%- IF show_detail_view -%] [% UNLESS rec.mmr_id %] diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2 index bd23358d45..20088fa93b 100644 --- a/Open-ILS/src/templates/opac/parts/searchbar.tt2 +++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2 @@ -60,9 +60,7 @@ -%] - [%- IF (show_more_details.default == 'true' OR show_more_details.default == 'hide') AND !CGI.param('detail_record_view') %] - - [%- END %] + [%- IF ctx.depth_sel_button AND NOT took_care_of_form %] diff --git a/Open-ILS/src/templates/opac/results.tt2 b/Open-ILS/src/templates/opac/results.tt2 index 37c652ce93..9d5dbf4227 100644 --- a/Open-ILS/src/templates/opac/results.tt2 +++ b/Open-ILS/src/templates/opac/results.tt2 @@ -69,8 +69,8 @@ [%- IF show_more_details.default != 'hide' -%] @@ -98,12 +98,6 @@ [% ctx.depth_sel_checkbox_label | html %] [% END %] - [%- IF CGI.param('detail_record_view') - OR (show_more_details.default == 'true' - OR show_more_details.default == 'hide'); - -%] - - [% END %] [% IF ctx.exclude_electronic_checkbox %]