Commit 625f988066b1344f94cbc86a31cd1a631d24359c
1 parent
61c32004
Exists in
master
and in
28 other branches
Adjustments
Showing
3 changed files
with
18 additions
and
14 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
| @@ -2,10 +2,10 @@ class MezuroPluginProfileController < ProfileController | @@ -2,10 +2,10 @@ class MezuroPluginProfileController < ProfileController | ||
| 2 | 2 | ||
| 3 | append_view_path File.join(File.dirname(__FILE__) + '/../views') | 3 | append_view_path File.join(File.dirname(__FILE__) + '/../views') |
| 4 | 4 | ||
| 5 | - def metrics | 5 | + def module_result |
| 6 | project_content = profile.articles.find(params[:id]) | 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 | end | 9 | end |
| 10 | 10 | ||
| 11 | def autoreload | 11 | def autoreload |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| 1 | require 'test_helper' | 1 | require 'test_helper' |
| 2 | 2 | ||
| 3 | -class MezuroPluginProfileControllerTest < ActiveSupport::TestCase | 3 | +class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 4 | 4 | ||
| 5 | def setup | 5 | def setup |
| 6 | @controller = MezuroPluginProfileController.new | 6 | @controller = MezuroPluginProfileController.new |
| 7 | @request = ActionController::TestRequest.new | 7 | @request = ActionController::TestRequest.new |
| 8 | - @response = ActionController::TestResponse.new | 8 | + @response = ActionController::TestResponse.new |
| 9 | @profile = fast_create(Community) | 9 | @profile = fast_create(Community) |
| 10 | @profile_id = @profile.identifier | 10 | @profile_id = @profile.identifier |
| 11 | end | 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 | <hr/> | 6 | <hr/> |
| 8 | -<table id="project_metric_result"> | 7 | + |
| 8 | +<table> | ||
| 9 | <thead> | 9 | <thead> |
| 10 | <tr> | 10 | <tr> |
| 11 | <th>Metric</th> | 11 | <th>Metric</th> |
| @@ -17,11 +17,15 @@ | @@ -17,11 +17,15 @@ | ||
| 17 | <tbody> | 17 | <tbody> |
| 18 | <% module_result.metric_results.each do |metric_result| %> | 18 | <% module_result.metric_results.each do |metric_result| %> |
| 19 | <% range = metric_result.range %> | 19 | <% range = metric_result.range %> |
| 20 | - <tr title=" <%= range.comments %>"> | 20 | + <tr title="<%= range.nil? ? '' : range.comments %>"> |
| 21 | <td><%= metric_result.metric.name %></td> | 21 | <td><%= metric_result.metric.name %></td> |
| 22 | <td><%= metric_result.value %></td> | 22 | <td><%= metric_result.value %></td> |
| 23 | <td><%= metric_result.weight %></td> | 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 | </tr> | 29 | </tr> |
| 26 | <% end %> | 30 | <% end %> |
| 27 | </tbody> | 31 | </tbody> |