From b97056a8d41d4619d7392a9eaa9c17a900994d76 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 4 Dec 2015 21:21:37 -0500 Subject: [PATCH] Bug 15319 - Use Bootstrap modal for MARC preview when performing batch record modifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to reduce the number of dependencies for common interactions we should attempt to use Bootstrap modals in place of Greybox ones. This patch modifies the batch record modification page so that the "Preview MARC" link triggers a preview in a Bootstrap modal. To test: 1. Apply the patch and navigate to Tools -> Batch record modification. 2. Submit multiple biblionumbers for batch modification. 3. In the results list, click the "Preview MARC" link for multiple results and confirm that the correct data is shown each time. 4. Use the "Modify record using the following template" menu to change the modification template. 5. Confirm that the "Preview MARC" links still work and show data correctly modified by your newly chosen template. 6. Repeat steps 2-5 with authority record numbers. Signed-off-by: Frédéric Demians Works as described. No regression. Signed-off-by: Jonathan Druart --- .../en/modules/tools/batch_record_modification.tt | 51 ++++++++++++++++++---- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt index e02bfd8..c669cf6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt @@ -2,7 +2,6 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Batch record modification [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'greybox.inc' %] [% INCLUDE 'datatables.inc' %] @@ -55,15 +54,23 @@ $(document).ready(function() { $("#marc_modification_template_id").change(function(){ var url = "/cgi-bin/koha/svc/records/preview?" var mmtid = $(this).val(); - $("a.preview").each(function(){ + $("a.previewMARC").each(function(){ $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid); }); }); - $("a.preview").click(function(){ - // Equivalent to rel="gb_page_center[600,500]" - return GB_showCenter(_("Preview MARC"), this.href , 600, 500); - }); + $("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 + " div"); + $('#marcPreview').modal({show:true}); + }); + $("#marcPreview").on("hidden", function(){ + $("#marcPreviewLabel").html(""); + $("#marcPreview .modal-body").html("
\"\" "+_("Loading")+"
"); + }); }); //]]> @@ -191,12 +198,26 @@ $(document).ready(function() { [% biblio.biblionumber %] [% biblio.title %] - Preview MARC + Preview MARC [% END %]
Reminder: this action will modify all selected biblios!
+ + + [% ELSE %]
Select all @@ -217,13 +238,27 @@ $(document).ready(function() { [% authority.authid %] [% PROCESS authresult summary=authority.summary %] - Preview MARC + Preview MARC [% END %]
Reminder: this action will modify all selected authorities!
[% END %] + + +
-- 2.1.0