From 4d1273d822af9c754dd4fd52e842594191f9e0da Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Thu, 27 Oct 2011 18:20:00 -0400 Subject: [PATCH] Tpac: staff saved searches expand/collapse, use right ou context for setting 1) Display staff saved searches collapsed by default. This makes the facet display right underneath it more accessible in the case of long search histories. 2) When checking the org unit setting for the limiting number of searches to save, use the user's ws_ou as the context, since this is a staff-client feature. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 27 +++++++++++++++++++++ .../templates/opac/parts/staff_saved_searches.tt2 | 28 ++++++++++++++++++---- Open-ILS/web/css/skin/default/opac/style.css | 8 +++++++ 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 4a508207a6..e934a398dc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -26,6 +26,7 @@ my $U = 'OpenILS::Application::AppUtils'; use constant COOKIE_SES => 'ses'; use constant COOKIE_PHYSICAL_LOC => 'eg_physical_loc'; +use constant COOKIE_SSS_EXPAND => 'eg_sss_expand'; use constant COOKIE_ANON_CACHE => 'anoncache'; use constant ANON_CACHE_MYLIST => 'mylist'; @@ -249,9 +250,35 @@ sub load_common { } } + $self->staff_saved_searches_set_expansion_state if $ctx->{is_staff}; + return Apache2::Const::OK; } +sub staff_saved_searches_set_expansion_state { + my $self = shift; + + my $param = $self->cgi->param('sss_expand'); + my $value; + + if (defined $param) { + $value = ($param ? 1 : 0); + $self->apache->headers_out->add( + "Set-Cookie" => $self->cgi->cookie( + -name => COOKIE_SSS_EXPAND, + -path => $self->ctx->{base_path}, + -secure => 1, # not strictly necessary, but this feature is staff-only, so may as well + -value => $value, + -expires => undef + ) + ); + } else { + $value = $self->cgi->cookie(COOKIE_SSS_EXPAND); + } + + $self->ctx->{saved_searches_expanded} = $value; +} + # physical_loc (i.e. "original location") passed in as a URL # param will replace any existing physical_loc stored as a cookie. sub get_physical_loc { diff --git a/Open-ILS/src/templates/opac/parts/staff_saved_searches.tt2 b/Open-ILS/src/templates/opac/parts/staff_saved_searches.tt2 index fb8ce216fe..0250651caa 100644 --- a/Open-ILS/src/templates/opac/parts/staff_saved_searches.tt2 +++ b/Open-ILS/src/templates/opac/parts/staff_saved_searches.tt2 @@ -1,8 +1,26 @@ [% IF ctx.saved_searches.size %] -
[% l("Your recent searches:") %]
- [% FOR s IN ctx.saved_searches %] - + +
+
+ [% l("Recent searches") %] +
+
+ [% IF ctx.saved_searches_expanded %] + [% l('Collapse') %] + [% ELSE %] + [% l('Expand') %] + [% END %] +
+
 
+
+
 
+
+ [% IF ctx.saved_searches_expanded %] + [% FOR s IN ctx.saved_searches %] + + [% END %] [% END %] +
[% END %] diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css index e3a425d68c..91b789c250 100644 --- a/Open-ILS/web/css/skin/default/opac/style.css +++ b/Open-ILS/web/css/skin/default/opac/style.css @@ -1166,3 +1166,11 @@ table.bookbag-specific { margin-bottom: 2ex; } .save-notes { padding-bottom: 1.5ex; } +.saved-searches-header { width: 100%; font-weight: bold; font-size: 120%; } +.saved-searches-header .button { float: right; width: 28px; } +.saved-searches-header .text { float: left; padding-right: 1em; margin: 0.5ex 0;} +.saved-searches-header {font-weight: bold; font-size: 120%; } +.saved-searches { border-bottom: 1px solid #666; } +#staff-saved-search { /* wraps .saved-searches-header and .saved-searches on the record page */ + border-right: 1px solid #333; +} -- 2.11.0