From e2dd8c25adba0d6d3368d51afadd219fc610d89c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 23 Sep 2014 12:24:34 -0400 Subject: [PATCH] Bug 12755 - MARC Preview doesn't always display in managed MARC record Content-Type: text/plain; charset="utf-8" The MARC preview feature seems to have been broken by Bug 11570 - Upgrade jQueryUI to the latest version. When that patch was being developed there were no existing cases where the jQueryUI dialog feature was used, so the patch omitted it. Rather than update the build of jQueryUI to include the dialog feature I'm submitting a patch which uses a Bootstrap modal instead. This keeps the jQueryUI library smaller and avoids an unnecessary duplication of JS functionality. It also helps keep our modals consistent. The implementation uses progressive enhancement principles to improve click handling: Real links in the table, so that the preview link can be opened in a new tab if the user chooses; Event handling in the JavaScript instead of the markup ( $(selector).on(click... instead of Staged MARC management). In the list of titles (the "Citation" column) click any link and confirm that the MARC preview loads correctly. Confirm that previews work correctly on any page and after re-sorting. Confirm also that the modal window flexibly handles different browser window sizes. --- .../prog/en/modules/tools/manage-marc-import.tt | 47 ++++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt index 3d5f01d..2b4684a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -62,9 +62,7 @@ $(document).ready(function(){ [% END %] $('td:eq(1)', nRow).html( - '' + aData['citation'] + '' + '' + aData['citation'] + '' ); $('td:eq(2)', nRow).html( @@ -103,29 +101,27 @@ $(document).ready(function(){ }, })); [% END %] + $("body").on("click",".previewMARC", function(e){ + e.preventDefault(); + var ltitle = $(this).text(); + var page = $(this).attr("href"); + $("#marcPreviewLabel").text(ltitle); + $("#marcPreview .modal-body").load(page + " pre"); + $('#marcPreview').modal({show:true}); + }); + $("#marcPreview").on("hidden", function(){ + $("#marcPreviewLabel").html(""); + $("#marcPreview .modal-body").html("
\"\" "+_("Loading")+"
"); + }); }); -function show_marc( id ) { - var page = "/cgi-bin/koha/catalogue/showmarc.pl?importid=" + id; - - var $dialog = $('
') - .html('') - .dialog({ - autoOpen: false, - modal: true, - height: 625, - width: 500, - title: _("MARC Preview") - }); - - $dialog.dialog('open'); -} //]]> + #jobprogress{ width:200px;height:10px;border:1px solid #666;background:url('[% interface %]/[% theme %]/img/progress.png') -300px 0px no-repeat; } span.change-status { font-style:italic; color:#666; display:none; }#marcPreview { width : 80%; margin-left : -40%; } @media (max-width: 767px) { #marcPreview { margin: 0; width : auto; } } + [% INCLUDE 'header.inc' %] @@ -452,6 +448,19 @@ Page + + [% END %] -- 1.7.9.5