From: Lebbeous Fogle-Weekley Date: Thu, 13 Jun 2013 20:22:13 +0000 (-0400) Subject: OPAC Browse: Various interface improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0c583d24aa2032c134785f0f5af768406f69a5fc;p=working%2FEvergreen.git OPAC Browse: Various interface improvements * Change of wording for the starts-with-article warnings, plus the addition of a link to browse with the same term without the article. * Forward button relabeled "Next", to be more consistent with other things. * Spinners for form submission and back/next buttons, done in a way similar to the OPAC search interfaces. * Apply the user setting 'opac.hits_per_page' to serve as the default number of browse hits per page when users are logged in. * Numbered browse results instead of bulleted. * Change of wording around the controls where the user enters browse terms and selects a search class and context location. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm index cc9d73c41f..62b0c4a3d6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm @@ -15,6 +15,7 @@ use OpenSRF::Utils::SettingsClient; use Digest::MD5 qw/md5_hex/; use Apache2::Const -compile => qw/OK/; use MARC::Record; +use List::Util qw/first/; #use Data::Dumper; #$Data::Dumper::Indent = 0; @@ -56,7 +57,11 @@ sub prepare_browse_parameters { # XXX TODO add config.global_flag rows for browse limit-limit and # browse offset-limit? - my $limit = int($self->cgi->param('blimit') || 10); + my $limit = int( + $self->cgi->param('blimit') || + $self->ctx->{opac_hits_per_page} || + 10 + ); my $offset = int($self->cgi->param('boffset') || 0); my $force_backward = scalar($self->cgi->param('bback')); @@ -370,6 +375,8 @@ sub leading_article_test { if ($map->{$qtype}) { if ($bterm =~ qr/$map->{$qtype}/i) { $self->ctx->{browse_leading_article_warning} = 1; + ($self->ctx->{browse_leading_article_alternative} = $bterm) =~ + s/$map->{$qtype}//; } } }; @@ -383,6 +390,18 @@ sub load_browse { _init_browse_cache(); + # This is just so we can access a user settings IFF the user is logged in + # (opac.hits_per_page). + if ($self->ctx->{user}) { + $self->prepare_extended_user_info('settings'); + if (my $setting = first { $_->name eq 'opac.hits_per_page' } + @{$self->ctx->{user}->settings}) { + + $self->ctx->{opac_hits_per_page} = $setting->value; + } + } + + $self->ctx->{more_forward} = 0; $self->ctx->{more_back} = 0; diff --git a/Open-ILS/src/templates/opac/browse.tt2 b/Open-ILS/src/templates/opac/browse.tt2 index 35a9d5a8b4..0bb4931f42 100644 --- a/Open-ILS/src/templates/opac/browse.tt2 +++ b/Open-ILS/src/templates/opac/browse.tt2 @@ -7,7 +7,7 @@ INCLUDE "opac/parts/topnav.tt2"; ctx.page_title = l("Browse the Catalog"); - blimit = CGI.param('blimit') || 10; + blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10; boffset = CGI.param('boffset') || 0; depart_list = ['blimit', 'bterm', 'boffset', 'bpivot', 'bback']; @@ -27,28 +27,29 @@
-
+ [% control_qtype = INCLUDE "opac/parts/qtype_selector.tt2" - id="browse-search-class" browse_only=1 %] + id="browse-search-class" browse_only=1 plural=1 %] [% control_bterm = BLOCK %][% END %] [% control_locg = INCLUDE build_org_selector id='browse-context' show_loc_groups=1 arialabel=l('Select holding library') %] - [% l('Browse by [_1] for [_2] held under [_3]', control_qtype, control_bterm, control_locg) %] + [% l('Browse for [_1] starting with [_2] in [_3]', control_qtype, control_bterm, control_locg) %] +
[% BLOCK browse_pager %]
[% IF ctx.more_back %] - ← [%l ('Back') %] + ← [%l ('Back') %] [% END %] [% IF browse.english_pager; # XXX how to apply i18n here? current_qtype = CGI.param('qtype') || 'title' %] @@ -61,12 +62,14 @@ [% END %] [% IF ctx.more_forward %] - [%l ('Forward') %] → + [%l ('Next') %] → [% END %] + +
[% END %] - [% PROCESS browse_pager %] + [% PROCESS browse_pager id=0 %]
[% IF ctx.browse_error %] @@ -78,10 +81,19 @@ [% ELSE %] [% IF ctx.browse_leading_article_warning %]
- [% l("Your browse term seems to begin with an article. You might get better results by omitting the article.") %] + [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %] + [% IF ctx.browse_leading_article_alternative %] +

+ [% alternative_link = BLOCK %] + [% ctx.browse_leading_article_alternative | html %] + [% END; # alternative_link BLOCK + l("Did you mean [_1]?", alternative_link); + END # IF %] +

[% END %] -
    + +
      [% FOR result IN ctx.browse_results %]
    1. @@ -135,7 +147,7 @@ [% END %]
- [% PROCESS browse_pager %] + [% PROCESS browse_pager id=1 %]
diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index 16c6400957..68aac9bd43 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -1526,7 +1526,7 @@ a.preflib_change { margin: 2ex 0; } .browse-result-list { - list-style-type: square; + padding-bottom: 0.5ex; } .browse-shortcuts { font-size: 120%; diff --git a/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 b/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 index 30edbc6e9f..6986fc12d9 100644 --- a/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 +++ b/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 @@ -1,10 +1,10 @@ [% query_types = [ {value => "keyword", label => l("Keyword")}, - {value => "title", label => l("Title"), browse => 1}, + {value => "title", label => l("Title"), plural_label => l("Titles"), browse => 1}, {value => "jtitle", label => l("Journal Title")}, - {value => "author", label => l("Author"), browse => 1}, - {value => "subject", label => l("Subject"), browse => 1}, - {value => "series", label => l("Series"), browse => 1}, + {value => "author", label => l("Author"), plural_label => l("Authors"), browse => 1}, + {value => "subject", label => l("Subject"), plural_label => l("Subjects"), browse => 1}, + {value => "series", label => l("Series"), plural_label => l("Series"), browse => 1}, {value => "id|bibcn", label => l("Bib Call Number")} ] %]