<h1>[% name | html %]</h1>
[% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes | html %]</p>[% END %]
[% IF ( unlimited_total ) %]<p><span class="label">Total number of results:</span> [% unlimited_total | html %][% IF unlimited_total > limit %] ([% limit | html %] shown)[% END %].</p>[% END %]
-<div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql | html %]</pre></div>
+
+<div id="sql_output" style="display:none;">
+ <span class="label">Report SQL:</span>
+ <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
+</div>
<div>
<a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
}
$(document).ready(function(){
-
+ var showsql;
hide_bar_element();
if ( $('.chart-column-conf').length == 1 ) {
$("#sql_output").toggle();
$("#toggle_sql_hid").toggle();
$("#toggle_sql_vis").toggle();
+ if( !showsql ){
+ showsql = CodeMirror.fromTextArea(sql, {
+ lineNumbers: false,
+ mode: "text/x-sql",
+ lineWrapping: true,
+ readOnly: true
+ });
+ }
});
$(".toggle_chart_settings").click(function(){