Commit 82f205654c927b27cab095a202800a24f4f80378

Authored by Guilherme Rojas V. de Lima
Committed by Rafael Manzo
1 parent 52f237d6

Fixed js error and fixed the page location when the link is clicked.

The table row for chart just show when the link is clicked.
app/assets/javascripts/graphics.js
1   -function generate_graphic(container_id, metric_name, module_name, date_list, metric_values_list)
  1 +function chart_of_the_historic_of_metric (container_id, metric_name, module_name, date_list, metric_values_list)
2 2 {
3 3 date_list = date_list.split(',');
4 4 metric_values_list = metric_values_list.split(',');
5 5 for(var i = 0; i < metric_values_list.length; i++) {
6 6 metric_values_list[i] = parseInt(metric_values_list[i]);
7 7 }
8   - $('#container_'+container_id).hide();
  8 + $('#tr_container_' + container_id).hide();
9 9  
10 10 $(function () {
11 11 $('#container_'+container_id).highcharts({
... ... @@ -37,10 +37,10 @@ function generate_graphic(container_id, metric_name, module_name, date_list, met
37 37 borderWidth: 0
38 38 },
39 39 series: [{
40   - name: 'Tokyo',
  40 + name: 'Metric value',
41 41 data: metric_values_list
42 42 }]
43 43 });
44 44 });
45   - $('#container_'+container_id).show('slow');
  45 + $('#tr_container_' + container_id).show("slow");
46 46 }
47 47 \ No newline at end of file
... ...
app/views/repositories/_metric_result.html.erb
... ... @@ -2,10 +2,10 @@
2 2 <% unless metric_configuration_snapshot.range_snapshot.nil? %>
3 3 <% range_snapshot = find_range_snapshot(metric_result) %>
4 4 <tr>
5   - <td><%= link_to metric_configuration_snapshot.metric.name, '#', onclick: "generate_graphic(#{metric_result.id},#{metric_configuration_snapshot.metric.name}, #{module_result.module.name}, '12/09/2012,21/10/2013,30/05/2013','12.7,13,20')" %></td>
  5 + <td><%= link_to metric_configuration_snapshot.metric.name, "#metric_#{module_result.id}", onclick: "chart_of_the_historic_of_metric(#{metric_result.id},\'#{metric_configuration_snapshot.metric.name}\', \'#{module_result.module.name}\', '12/09/2012,21/10/2013,30/05/2013','12.7,13,20')", id: "metirc_#{module_result.id}" %></td>
6 6 <td><%= format_grade(metric_result.value) %></td>
7 7 <td><%= metric_configuration_snapshot.weight %></td>
8 8 <td><span style="color: #<%= range_snapshot.color %>"><%= range_snapshot.label %></span></td>
9 9 </tr>
10   - <tr><td colspan="4"><div id="container_<%= metric_result.id %>"></div></td></tr>
  10 + <tr id="tr_container_<%= metric_result.id %>" style="display: none"><td colspan="4"><div id="container_<%= metric_result.id %>"></div></td></tr>
11 11 <% end %>
12 12 \ No newline at end of file
... ...