Commit 625f988066b1344f94cbc86a31cd1a631d24359c

Authored by Carlos Morais
1 parent 61c32004

Adjustments

plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
... ... @@ -2,10 +2,10 @@ class MezuroPluginProfileController < ProfileController
2 2  
3 3 append_view_path File.join(File.dirname(__FILE__) + '/../views')
4 4  
5   - def metrics
  5 + def module_result
6 6 project_content = profile.articles.find(params[:id])
7   - module_name = params[:module_name]
8   - render :partial => 'content_viewer/module_result', :locals => { :module_result => project_content.module_result(module_name) }
  7 + module_result = project_content.module_result(params[:module_name])
  8 + render :partial => 'content_viewer/module_result', :locals => { :module_result => module_result}
9 9 end
10 10  
11 11 def autoreload
... ...
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
1 1 require 'test_helper'
2 2  
3   -class MezuroPluginProfileControllerTest < ActiveSupport::TestCase
  3 +class MezuroPluginProfileControllerTest < ActionController::TestCase
4 4  
5 5 def setup
6 6 @controller = MezuroPluginProfileController.new
7 7 @request = ActionController::TestRequest.new
8   - @response = ActionController::TestResponse.new
  8 + @response = ActionController::TestResponse.new
9 9 @profile = fast_create(Community)
10 10 @profile_id = @profile.identifier
11 11 end
... ...
plugins/mezuro/views/content_viewer/_module_result.rhtml
1   -<h5><%= _('Metric Result') %> </h5>
2   -<strong>
3   - <%= _('Module:') %>
4   - <%= module_result.module.name %>
5   -</strong>
6   -<br/>
  1 +<% the_module = module_result.module %>
  2 +<% module_label = "#{the_module.name} (#{the_module.granularity})" %>
  3 +
  4 +<h5><%= _('Metric results for: ') + module_label %> </h5>
  5 +
7 6 <hr/>
8   -<table id="project_metric_result">
  7 +
  8 +<table>
9 9 <thead>
10 10 <tr>
11 11 <th>Metric</th>
... ... @@ -17,11 +17,15 @@
17 17 <tbody>
18 18 <% module_result.metric_results.each do |metric_result| %>
19 19 <% range = metric_result.range %>
20   - <tr title=" <%= range.comments %>">
  20 + <tr title="<%= range.nil? ? '' : range.comments %>">
21 21 <td><%= metric_result.metric.name %></td>
22 22 <td><%= metric_result.value %></td>
23 23 <td><%= metric_result.weight %></td>
24   - <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td>
  24 + <% if range.nil? %>
  25 + <td></td>
  26 + <% else %>
  27 + <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td>
  28 + <% end %>
25 29 </tr>
26 30 <% end %>
27 31 </tbody>
... ...