Bugzilla – Attachment 63708 Details for
Bug 18667
Show a diff view of SQL reports when converting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18667 - Show a diff view of SQL reports when converting
Bug-18667---Show-a-diff-view-of-SQL-reports-when-c.patch (text/plain), 4.87 KB, created by
Owen Leonard
on 2017-05-24 18:04:04 UTC
(
hide
)
Description:
Bug 18667 - Show a diff view of SQL reports when converting
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-05-24 18:04:04 UTC
Size:
4.87 KB
patch
obsolete
>From a5331bfda19e046827e9cc27131af55f31fad426 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 24 May 2017 17:51:18 +0000 >Subject: [PATCH] Bug 18667 - Show a diff view of SQL reports when converting > >This patch reformats the SQL conversion before-and-after view so that it >shows a diff between the two, just as the Manage MARC Import interface >does. > >This patch also makes a correction to the JavaScript which is triggered >by the closing of the modal. In Bootstrap 3 "hidden.bs.modal" is the >event name instead of "hidden." > >To test, apply the patch and find an SQL report in your reports library >which requires updating. > >- Click the "Update SQL" button. >- In the modal window, the "existing" and "updated" SQL should be shown > side-by-side with colored highlighting of the differece. >- Confirm that the "Update" button still works correctly. >- Also confirm that if you open the preview of another report, the > "Close" button hides the modal and updates the contents of the modal > markup. Use your browser's DOM inspector to confirm that <div > class="modal-body"> contains only <div id="loading"> and its contents. >--- > .../prog/en/modules/reports/convert_report.tt | 19 ++++++++++++------- > .../prog/en/modules/reports/guided_reports_start.tt | 16 ++++++++++++++-- > 2 files changed, 26 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt >index de77876..c231eae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt >@@ -1,16 +1,21 @@ > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Reports › Convert report</title> >+ <title>Koha › Reports › Convert report</title> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > </head> >- <body id="report_convert" class="catalog"> >- <div id="main" style="direction: ltr;"> >+ <body id="rep_report_convert" class="rep"> >+ <div> > [% IF msg == 'no_report' %] > There is no valid report for this id. > [% ELSIF msg == 'can_be_updated' %] >- <h3>Existing sql</h3> >- <pre>[% current_sql %]</pre> >- <h3>Updated sql</h3> >- <pre>[% updated_sql %]</pre> >+ <div id="col1" class="" style="width:45%;float:left;"> >+ <h3>Existing SQL</h3> >+ <span class="show_sql">[% current_sql | html_entity %]</span> >+ </div> >+ >+ <div id="col2" class="" style="width:45%; float:left;"> >+ <h3>Updated SQL</h3> >+ <span class="show_sql">[% updated_sql | html_entity %]</span> >+ </div> > [% ELSE %] > Something went wrong. > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index 4ef3b0e..1e15f66 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -32,9 +32,15 @@ > [% INCLUDE 'calendar.inc' %] > <style type="text/css"> > #sql { width: 90%; height: 9em;} >+ #update_sql .modal-dialog { width: 80%; } >+ ins { background-color: #e6ffe6; } >+ del { background-color: #ffe6e6; } >+ #col1 ins, #col2 del { display: none; } >+ .show_sql { font-family: monospace; } > </style> > [% IF ( saved1 ) %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+<script type="text/javascript" src="[% interface %]/lib/jsdiff/jsdiff.min.js"></script> > [% INCLUDE 'datatables.inc' %] > [% END %] > >@@ -172,11 +178,17 @@ $("#delColumn").on("click",function(){ > var ltitle = $(this).text(); > var report_id = $(this).data("report_id"); > var page = $(this).attr("href"); >- $("#update_sql .modal-body").load(page + " div"); >+ $("#update_sql .modal-body").load(page + " div", function(){ >+ var diff1 = $("#col1 .show_sql").text(); >+ var diff2 = $("#col2 .show_sql").text(); >+ var diffs = diffString( escape(diff1), escape(diff2) ); >+ $("#col1 .show_sql,#col2 .show_sql").html(diffs); >+ }); > $('#update_sql').modal('show'); > $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id); > }); >- $("#update_sql").on("hidden", function(){ >+ >+ $("#update_sql").on("hidden.bs.modal", function(){ > $("#update_sql_label").html(""); > $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); > }); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18667
:
63708
|
63712
|
64849
|
65023