Bugzilla – Attachment 55582 Details for
Bug 17282
Ability to create charts for SQL reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17282 - Fix QA comments:
Bug-17282---Fix-QA-comments.patch (text/plain), 5.70 KB, created by
Alex Arnaud
on 2016-09-15 12:24:20 UTC
(
hide
)
Description:
Bug 17282 - Fix QA comments:
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2016-09-15 12:24:20 UTC
Size:
5.70 KB
patch
obsolete
>From e93a74663e311317ca91ab43a2ac3ab73664dcbc Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 15 Sep 2016 12:21:39 +0000 >Subject: [PATCH] Bug 17282 - Fix QA comments: > > - Don't scroll to the top when deleting a column, > - prevents to delete all columns, > - better handling of headers/results deleting >--- > koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc | 9 +++- > .../en/modules/reports/guided_reports_start.tt | 58 +++++++++++++++------- > 2 files changed, 46 insertions(+), 21 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc >index 00b68c1..ebb86ad 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc >@@ -30,8 +30,13 @@ > [% column = 1 %] > <div> > [% FOREACH header IN header_row %] >- <fieldset id="column_[% column %]" style="display: inline !important;"> >- <legend>Column [% column %] - <a href="#" onclick="removeColumn('column_[% column %]', '[% header.cell %]')">del</a></legend> >+ <fieldset class="chart-column-conf" id="column_[% column %]" style="display: inline !important;"> >+ <legend> >+ Column [% column %] >+ <a class="chart-column-delete" href="#" onclick="removeColumn('column_[% column %]'); return false;"> >+ <img src="[% interface %]/[% theme %]/img/x.png" alt="Delete" /> >+ </a> >+ </legend> > <div> > <label for="y_[% column %]">y:</label> > <select id="y_[% column %]" name="y"> >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 59513ca..2bf55f3 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 >@@ -817,9 +817,6 @@ canned reports and writing custom SQL reports.</p> > <script type="text/javascript" src="[% interface %]/lib/d3c3/c3.min.js"></script> > <script type="text/javascript"> > >- var headers = [% header_row.json %]; >- var results = [% results.json %] >- > function hide_bar_element() { > $('#chart-column-horizontal').hide() > $('.chart-column-group').each(function( index ) { >@@ -840,30 +837,23 @@ canned reports and writing custom SQL reports.</p> > }); > } > >- function removeColumn(id, header_name) { >+ function removeColumn(id) { > $('#'+id).remove(); > >- var delete_index; >- $.each(headers, function(index, value) { >- if (value.cell == header_name) { >- delete_index = index; >- } >- }); >- headers.splice(delete_index, 1); >+ if ( $('.chart-column-conf').length == 1 ) { >+ $('.chart-column-delete').remove(); >+ } > >- $.each(results, function(index, value) { >- $.each(value.cells, function(i, val) { >- if (i == delete_index) { >- results[index].cells.splice(i, 1) >- } >- }); >- }); > } > > $(document).ready(function(){ > > hide_bar_element(); > >+ if ( $('.chart-column-conf').length == 1 ) { >+ $('.chart-column-delete').remove(); >+ } >+ > > $('#download-chart').click(function() { > var svg = '<svg>' + $('#chart svg').html() + '</svg>'; >@@ -890,6 +880,10 @@ canned reports and writing custom SQL reports.</p> > var lines = []; > var options = {}; > >+ //var headers = [% header_row.json %]; >+ headers = [% header_row.json %]; >+ var results = [% results.json %] >+ > $('select[name="y"]').each(function( index ) { > y_elements.push( $(this).val() ); > }); >@@ -902,12 +896,38 @@ canned reports and writing custom SQL reports.</p> > } > }); > >+ // Remove deleted columns from headers and results. >+ var deleted_indexes = []; >+ var kept_headers = []; >+ $.each(headers, function(index, value) { >+ if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) { >+ // This header is neither a x element nor in y elements. Don't need it. >+ deleted_indexes.push(index); >+ } >+ else { >+ kept_headers.push({cell: value.cell}); >+ } >+ }); >+ >+ // Remove coresponding cells. >+ var kept_results = []; >+ $.each(results, function(index, value) { >+ var line = {}; >+ line['cells'] = []; >+ $.each(value.cells, function(i, val) { >+ if ($.inArray(i, deleted_indexes) === -1) { >+ line['cells'].push({cell: val.cell}); >+ } >+ }); >+ kept_results.push(line); >+ }); >+ > options.type = $('select[name="chart-type"]').val(); > options.horizontal = $('input[name="column-horizontal"]').prop('checked'); > options.lines = lines; > > >- chart = create_chart(headers, results, x_elements, y_elements, groups, options); >+ chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options); > $('#chart').prepend('<div style="font-size: 1rem; text-align: center;">[% name %]</div>'); > $('#download-chart').show(); > }); >-- >2.7.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 17282
:
55412
|
55442
|
55444
|
55480
|
55582
|
55586
|
55588
|
55604
|
55605
|
55606
|
55607
|
55868
|
55869
|
62529
|
63565
|
63566
|
63567
|
63568
|
63569
|
63570
|
63571
|
67225
|
67226
|
67227
|
67228
|
67229
|
67230
|
67231
|
69174
|
69429
|
69430
|
69493
|
79182
|
79230
|
79308
|
79309
|
79310
|
79311
|
79312
|
79313
|
79337
|
79338
|
79339