From dc510377e28d5c819916b0f3a9d05d9435dded31 Mon Sep 17 00:00:00 2001 From: Jen Zajac Date: Fri, 14 Aug 2015 19:36:15 +1200 Subject: [PATCH] Bug 14567: frontend template and JS for browse interface --- koha-tmpl/opac-tmpl/bootstrap/less/opac.less | 101 +++++++++++++++++++++++++++ opac/opac-browse.pl | 12 +++- 2 files changed, 112 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less index 0bd32b4..5c3bd09 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less +++ b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less @@ -304,6 +304,107 @@ td { } } +/*opac browse search*/ +#browse-search { + + form { + label { + display: inline-block; + margin-right:5px; + } + + [type=submit] { + margin-top: 10px; + } + } + + #browse-resultswrapper { + margin-top: 4em; + + @media (min-width: 768px) and (max-width: 984px) { + margin-top: 2em; + } + + @media (max-width: 767px) { + margin-top: 1em; + } + } + #browse-searchresults, #browse-selectionsearch { + border: 1px solid #E3E3E3; + .border-radius-all(4px); + padding: 0; + overflow-y: auto; + max-height: 31em; + margin-bottom: 2em; + } + #browse-searchresults { + max-height: 31em; + list-style: none; + padding: 10px; + + a { + display: block; + margin-bottom: 5px; + + &.selected { + background-color:#EEE; + } + } + + li:last-child a { + margin-bottom: 0; + } + + @media (max-width: 767px) { + max-height: 13em; + } + } + #browse-selection { + margin-top: -40px; + padding-top: 0; + + @media (max-width: 767px) { + margin-top: 0; + } + } + #browse-selectionsearch ol { + list-style: none; + margin: 0; + + li { + padding: 1em; + + &:nth-child(odd) { + background-color: #F4F4F4; + } + } + } + #browse-selectionsearch p.subjects { + font-size: 0.9em; + margin-bottom: 0; + } + #browse-selectionsearch h4 { + margin: 0; + } + .error, .no-results { + background-color: #EEE; + border: 1px solid #E8E8E8; + text-align: left; + padding: 0.5em; + .border-radius-all(3px); + } + .loading { + text-align: center; + + img { + margin:0.5em 0; + position: relative; + left: -5px; + } + } +} +/*end browse search*/ + /* Override Bootstrap alert */ .alert { background: #fffbe5; /* Old browsers */ diff --git a/opac/opac-browse.pl b/opac/opac-browse.pl index b5a7ef7..eb242f1 100755 --- a/opac/opac-browse.pl +++ b/opac/opac-browse.pl @@ -24,6 +24,7 @@ use CGI qw( -utf8 :standard ); use C4::Auth; use C4::Context; +use C4::Output; use Koha::ElasticSearch; use Koha::SearchEngine::Elasticsearch::Browse; @@ -41,8 +42,17 @@ binmode STDOUT, ':utf8'; my $api = $query->param('api'); if ( !$api ) { + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "opac-browse.tt", + query => $query, + type => "opac", + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), + } + ); + $template->param(); + output_html_with_http_headers $query, $cookie, $template->output; - # No parameters, so we just render the template. } elsif ( $api eq 'GetSuggestions' ) { -- 2.1.4