Owen Leonard
9cb89b4639
This patch updates the version of Bootstrap in the OPAC from 2.3.1 to 4.5.0. The Bootstrap JavaScript files have been replaced with custom builds of the 4.5.0 JavaScript source files. The Bootstrap CSS is now built into the OPAC CSS by loading the required Bootstrap 4.5.0 SCSS files in node_modules. OPAC SCSS now starts with Bootstrap customizations: /* Bootstrap variable customizations */ $headings-color: #727272; ... Followed by loading the necessary Bootstrap SCSS files: /* Bootstrap imports */ @import "../../../../../node_modules/bootstrap/scss/functions"; @import "../../../../../node_modules/bootstrap/scss/variables"; ... Followed by our CSS. The build process for generating compiled CSS now creates a file which bundles Bootstrap CSS and ours. Removed from the Koha source: Bootstrap CSS files, Bootstrap "glyphicons" images. The upgrade to Bootstrap 4 involved a lot of markup changes to conform with new Bootstrap classes, especially in classes related to the grid. Besides duplicating the grid we used before, this upgrade adds some new features made possible by Bootstrap 4.5's use of flexbox as a layout tool. This includes custom ordering of columns based on class names: https://getbootstrap.com/docs/4.5/layout/grid/#order-classes. Other areas where the most changes have been made: Navigation menus, breadcrumb menus, buttons, dropdowns. Bootstrap's JavaScript file is now "bootstrap.bundle.min.js" to reflect the fact that a required JavaScript asset is now distributed separately in Bootstrap 4. The "bundle" version includes Popper.js. Unrelated changes: Indentation corrections, removal of invalid "//<![CDATA[" markers, removal of invalid script type attributes. To test, apply the patch and run 'yarn install' to install Bootstrap as an npm module. Run 'yarn build --view opac' to regenerate the OPAC CSS. Test as many aspect of the OPAC as possible, viewing pages at various browser widths to confirm that everything adjusts well. Test with various OPAC interface system preferences enabled and disabled. Test self checkout and self checkin. Known issues: RTL support has not been updated. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
175 lines
7.9 KiB
Text
175 lines
7.9 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › RecordedBooks search for '[% q | html %]'</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% BLOCK cssinclude %]
|
|
[% END %]
|
|
</head>
|
|
[% INCLUDE 'bodytag.inc' bodyid='recordedbooks-results-page' bodyclass='scrollto' %]
|
|
[% INCLUDE 'masthead.inc' %]
|
|
|
|
<div class="main">
|
|
<nav aria-label="breadcrumb">
|
|
<ul class="breadcrumb">
|
|
<li class="breadcrumb-item">
|
|
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
|
|
</li>
|
|
<li class="breadcrumb-item active" aria-current="page">
|
|
<a href="#">RecordedBooks search for '[% q | html %]'</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-lg-2">
|
|
[% IF ( OpacNav || OpacNavBottom ) %]
|
|
[% INCLUDE 'navigation.inc' %]
|
|
[% END %]
|
|
</div>
|
|
<div class="col-lg-10 order-first order-md-first order-lg-2">
|
|
<div id="recordedbooks-results-content" class="maincontent searchresults">
|
|
<h1>RecordedBooks search for '[% q | html %]'</h1>
|
|
[% UNLESS ( logged_in_user ) %]
|
|
<h3 class="rb_login">Sign in to view availability and checkout items or place holds</h3>
|
|
[% END %]
|
|
|
|
<div id="breadcrumbs">
|
|
<p></p>
|
|
</div>
|
|
|
|
<div id="top-pages">
|
|
<nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
|
|
</nav>
|
|
</div>
|
|
|
|
<table id="recordedbooks-results-list" class="table table-striped">
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div id="bottom-pages">
|
|
<nav class="pagination pagination-sm noprint" aria-label="Search results pagination">
|
|
</nav>
|
|
</div>
|
|
|
|
</div> <!-- / #recordedbooks-results-content -->
|
|
</div> <!-- / .col-lg-10 -->
|
|
</div> <!-- / .row -->
|
|
</div> <!-- / .container-fluid -->
|
|
</div> <!-- / .main -->
|
|
|
|
[% INCLUDE 'recordedbooks-checkout.inc' %]
|
|
|
|
[% INCLUDE 'opac-bottom.inc' %]
|
|
[% BLOCK jsinclude %]
|
|
[% Asset.js("js/recordedbooks.js") | $raw %]
|
|
<script>
|
|
var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( '\r', '\\r' ) |html %]";
|
|
var results_per_page = [% OPACnumSearchResults || 20 | html %];
|
|
|
|
function search( page ) {
|
|
$( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
|
|
|
|
KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) {
|
|
if ( data.error ) {
|
|
$( '#recordedbooks-status' ).html( '<strong class="unavailable">' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '</strong>' );
|
|
return;
|
|
}
|
|
|
|
if ( !data.total ) {
|
|
$( '#recordedbooks-status' ).html( '<strong>' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '</strong>' );
|
|
return;
|
|
}
|
|
|
|
$( '#recordedbooks-results-list tbody' ).empty();
|
|
|
|
$( '#recordedbooks-status' ).html( '<strong>' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '</strong>' );
|
|
|
|
for ( var i = 0; data.items[i]; i++ ) {
|
|
var prod = data.items[i];
|
|
var results = [];
|
|
results.push( '<tr>' );
|
|
|
|
results.push( '<td class="info"><span class="title">' );
|
|
if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
|
|
results.push( prod.title );
|
|
if (prod.url) results.push( '</a>' );
|
|
results.push( '</span>' );
|
|
results.push( '<p>' + MSG_BY + ' ', prod.author, '</p>' );
|
|
if (prod.description) results.push( '<p>' + prod.description, '</p>' );
|
|
results.push( '<span class="results_summary mediatype"><span class="label">' + MSG_TYPE + ': </span>', prod.media, '</span>' );
|
|
|
|
results.push( '</td>' );
|
|
|
|
results.push( '<td>' );
|
|
if ( prod.images && prod.images.medium ) {
|
|
if (prod.url) results.push( '<a href="', prod.url, '" target="recordedbooks">' );
|
|
results.push( '<img class="thumbnail" src="', prod.images.medium, '" />' );
|
|
if (prod.url) results.push( '</a>' );
|
|
}
|
|
results.push( '</td>' );
|
|
|
|
results.push( '</tr>' );
|
|
var $tr = $( results.join( '' ));
|
|
$( '#recordedbooks-results-list tbody' ).append( $tr );
|
|
|
|
$tr.find( '.info' ).each(function() {
|
|
KOHA.RecordedBooks.add_actions(this, prod.isbn);
|
|
});
|
|
}
|
|
|
|
$( '#recordedbooks-results-list tr:odd' ).addClass( 'highlight' );
|
|
|
|
var pages = [];
|
|
|
|
var max_page = Math.floor( data.total / results_per_page );
|
|
if (data.total == page*results_per_page) max_page++;
|
|
|
|
if ( page != 1 ) {
|
|
pages.push( '<li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' );
|
|
}
|
|
|
|
for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) {
|
|
if ( p == page ) {
|
|
pages.push( ' <li class="page-item disabled"><a class="page-link" href="#">' + ( p + 1 ) + '</a></li>' );
|
|
} else {
|
|
pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' );
|
|
}
|
|
}
|
|
|
|
if ( page < max_page ) {
|
|
pages.push( ' <li class="page-item"><a class="page-link od-nav" href="#" data-page="' + (page + 1) + '">' + MSG_NEXT + ' »</a></li>' );
|
|
}
|
|
|
|
if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '<ul class="pagination">' + pages.join( '' ) + '</ul>');
|
|
|
|
if( KOHA.RecordedBooks.is_identified() == false ){
|
|
$("#breadcrumbs").before('<h3 class="rb_register"><a href="https://[% Koha.Preference('RecordedBooksDomain') | uri %]">To see availability you must register for RecordedBooks using your cardnumber and the email associated with your Koha account</a></h3>');
|
|
}
|
|
|
|
} );
|
|
}
|
|
|
|
$( document ).ready( function() {
|
|
$( '#breadcrumbs p' )
|
|
.append( ' ' )
|
|
.append( '<span id="recordedbooks-status"></span>' );
|
|
|
|
$( document ).on( 'click', 'a.od-nav', function() {
|
|
search( $( this ).data( 'page' ) );
|
|
return false;
|
|
});
|
|
|
|
[% IF ( logged_in_user ) %]
|
|
KOHA.RecordedBooks.with_account_details("#breadcrumbs", function() {
|
|
search( 1 );
|
|
});
|
|
[% ELSE %]
|
|
search( 1 );
|
|
[% END %]
|
|
} );
|
|
</script>
|
|
[% END %]
|