@@ -, +, @@ - In the table listing saved reports, open the "Actions" pop-up menu and click the "Preview SQL" link. - You should be shown a modal with a syntax-highlighted view of the SQL code. - The footer of the modal should have options for Edit, Duplicate, Schedule, Delete, Run report, and Close. - Test that all these buttons work correctly. - Test that all of these features work correctly any page of the saved reports DataTable. --- .../en/modules/reports/guided_reports_start.tt | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -329,7 +329,12 @@ class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown" href="#"> + [% END %] @@ -1800,6 +1806,12 @@ e.preventDefault(); addToList(); }); + + $("body").on("click", ".preview_sql", function(e){ + e.preventDefault(); + var reportid = $(this).data("reportid"); + previewSql( reportid ); + }); }); function tabsInit( ui, rtable ){ @@ -1927,6 +1939,46 @@ window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes'); return false; } + + // Adapted from https://gist.github.com/jnormore/7418776 + function previewSql(reportid) { + var yes_label = ""; + var no_label = ""; + var message = $("#previewSql" + reportid ).val(); + var title = $("#previewSql" + reportid ).data("title"); + if( $("#preview-sql-modal").length > 0) { + $("#preview-sql-modal").remove(); + } + $("body").append('