Bug 29616: Replace library information popup in the OPAC with a modal
This patch modifies the OPAC bibliographic detail page so that information stored in libraries' "OPAC info" field can be displayed in a modal window instead of in a tooltip. This will make it more readable, especially for libraries with so much info content that the popup can disappear off the bottom of the page. To test, apply the patch and make sure you have at least one library configured according to each of these: A. One with both branches.branchurl and branches.opac_info B. One with branches.branchurl but not branches.opac_info C. One with branches.opac_info but not branches.branchurl D. One with neither branches.branchurl nor branches.opac_info View the bibliographic detail page in the OPAC for title(s) which have holdings from the libraries you configured above. In the holdings table, check the behavior of the library name in the "Current library" or "Home library" columns * - Case A: The library name appears as a link with an "info" icon. Clicking it shows the library information in a modal window. In the modal footer, a "Visit web site" button should take you to the correct URL. - Case B: The library name appears as a link without an icon. Clicking the link takes you to the correct URL. - Case C: The library name appears as a link with an "info" icon. Clicking it shows the library information in a modal window. In the modal footer there is no "Visit web site" button. - Case D: The library name is plain text. * Display of "Current library" and/or "Home library" is controlled by the OpacLocationBranchToDisplay system preference. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
fc3e532897
commit
35f35c629f
1 changed files with 77 additions and 31 deletions
|
@ -1195,17 +1195,21 @@
|
|||
</td>
|
||||
[% END %]
|
||||
[% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %]
|
||||
<td class="location" property="seller">
|
||||
<td class="location" property="seller" data-order="[% ITEM_RESULT.branchname| html %]">
|
||||
<link property="itemOffered" href="#record" />
|
||||
<link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
|
||||
<span class="[% ITEM_RESULT.holding_branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]" title="">
|
||||
[% IF ( ITEM_RESULT.branchurl ) %]
|
||||
<a href="[% ITEM_RESULT.branchurl | url %]">[% ITEM_RESULT.branchname | html %]</a>
|
||||
[% ELSE %]
|
||||
<span>[% ITEM_RESULT.branchname | html %]</span>
|
||||
[% END %]
|
||||
</span>
|
||||
<div class="branch-info-tooltip">[% ITEM_RESULT.holding_branch_opac_info | $raw %]</div>
|
||||
|
||||
[% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
|
||||
<a href="[% ITEM_RESULT.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.branchcode | html %]">
|
||||
<i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.branchname | html %]
|
||||
</a>
|
||||
[% ELSIF ( ITEM_RESULT.branchurl ) %]
|
||||
<a href="[% ITEM_RESULT.branchurl | url %]">
|
||||
[% ITEM_RESULT.branchname | html %]
|
||||
</a>
|
||||
[% ELSE %]
|
||||
<span>[% ITEM_RESULT.branchname | html %]</span>
|
||||
[% END %]
|
||||
|
||||
[% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
|
||||
<span class="shelvingloc">[% ITEM_RESULT.location_description | html %]</span>
|
||||
|
@ -1218,19 +1222,18 @@
|
|||
<td class="location" property="seller">
|
||||
<link property="itemOffered" href="#record" />
|
||||
<link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
|
||||
<span class="[% ITEM_RESULT.home_branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]" title="">
|
||||
[% IF Branches.GetURL( ITEM_RESULT.homebranch ) %]
|
||||
[% home_branch_url = Branches.GetURL( ITEM_RESULT.homebranch ) %]
|
||||
[% IF ( home_branch_url ) %]
|
||||
<a href="[% home_branch_url | url %]">[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</a>
|
||||
[% ELSE %]
|
||||
<span>[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</span>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<span>[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</span>
|
||||
[% END %]
|
||||
</span>
|
||||
<div class="branch-info-tooltip">[% ITEM_RESULT.home_branch_opac_info | $raw %]</div>
|
||||
|
||||
[% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
|
||||
<a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.homebranch | html %]">
|
||||
<i class="fa fa-info-circle" aria-hidden="true"></i> [% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
|
||||
</a>
|
||||
[% ELSIF ( Branches.GetURL( ITEM_RESULT.homebranch ) ) %]
|
||||
<a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]">
|
||||
[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
|
||||
</a>
|
||||
[% ELSE %]
|
||||
<span>[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</span>
|
||||
[% END %]
|
||||
|
||||
[% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
|
||||
<span class="shelvingloc">[% ITEM_RESULT.location_description | html %]</span>
|
||||
|
@ -1351,6 +1354,27 @@
|
|||
</table>
|
||||
[% END %][%# end of items_table block %]
|
||||
|
||||
<!-- Library Info Modal -->
|
||||
<div class="modal" id="libraryInfoModal" tabindex="-1" aria-labelledby="libraryInfoModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="libraryInfoModalLabel"></h5>
|
||||
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="libraryInfo"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a id="libraryInfoLink" href="" class="btn btn-primary">Visit web site</a>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div> <!-- /.modal-content -->
|
||||
</div> <!-- /.modal-dialog -->
|
||||
</div> <!-- /.modal -->
|
||||
|
||||
[% BLOCK jsinclude %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'columns_settings.inc' %]
|
||||
|
@ -1596,15 +1620,6 @@
|
|||
[% END # /IF OPACDetailQRCode %]
|
||||
|
||||
$('#bibliodescriptions').tabs();
|
||||
$(".branch-info-tooltip-trigger").uitooltip({
|
||||
position: { my: "left+15 center", at: "right center" },
|
||||
show: 50,
|
||||
hide: 50,
|
||||
content: function(){
|
||||
var element = $(this).next("div");
|
||||
return element.html();
|
||||
}
|
||||
});
|
||||
|
||||
[% IF ( Koha.Preference('OpacBrowseResults') && busc ) %]
|
||||
$(".l_Results").show();
|
||||
|
@ -1908,6 +1923,37 @@
|
|||
multiSearchRequest();
|
||||
});
|
||||
} /* if( OPACPopupAuthorsSearch == "1" ) */
|
||||
|
||||
$(".library_info").on("click", function(e){
|
||||
e.preventDefault();
|
||||
var branchcode = $(this).data("branchcode");
|
||||
var url = $(this).attr("href");
|
||||
$.ajax({
|
||||
url: "/api/v1/libraries/" + branchcode,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
$("#libraryInfoModalLabel").html( result.name );
|
||||
$("#libraryInfo").html( result.opac_info );
|
||||
if( result.url ){
|
||||
$("#libraryInfoLink").attr("href", result.url );
|
||||
$("#libraryInfoLink").show();
|
||||
} else {
|
||||
$("#libraryInfoLink").hide();
|
||||
}
|
||||
$("#libraryInfoModal").modal("show");
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
if( url ){
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#libraryInfoModal").on("hide.bs.modal", function(){
|
||||
$("#libraryInfoModalLabel, #libraryInfo").html("");
|
||||
$("#libraryInfoLink").attr("href", "");
|
||||
});
|
||||
});
|
||||
|
||||
function multiSearchRequest(){
|
||||
|
|
Loading…
Reference in a new issue