_module_result.rhtml 2.27 KB
<% unless @content.errors[:base].nil? %>
  <%= @content.errors[:base] %>
<% else %>
  <% the_module = @module_result.module %>
  <% module_label = "#{the_module.name} (#{the_module.granularity})" %>

  <h5><%= _('Metric results for: ') + module_label %> </h5>

  <hr/>
  <div class="zoomable-image">
  <table>
    <thead>
      <tr>
        <th>Metric</th>
        <th>Value</th>
        <th>Weight</th>
        <th>Threshold</th>
      </tr>
    </thead>
    <tbody>
      <% @module_result.metric_results.each do |metric_result|  %>
        <% range = metric_result.range %>
        <% if !range.nil? %>
          <tr>
            <td><a href="#" data-show=".<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>"><%= metric_result.metric.name %></a></td>
            <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td>
            <td><%= metric_result.weight %></td>
            <td style="background-color: #<%= range.color[2..-1] %>"><%= range.label %></td>
          </tr>	  
          <tr class="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" style="display: none;">
            <td colspan="3">
              <div id='historical-<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>'>
                <a href="#" show-metric-history="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_result) %>"> <p style="text-indent: 3em;"> Get Historical Values </p> </a>
              </div>
            </td>
            <td align="right">
              <%= range.comments.nil? ? '' : range.comments %>
            </td> 
          </tr>
        <% end %>
      <% end %>
    </tbody>
    <tfoot>
      <tr>
        <td colspan = "3">
          <div id='historical-grade'></div>
        </td>
        <td align = "right">
          <a href="#" show-grade-history="<%= @module_result.module.name %>" data-module-name="<%= the_module.name%>" >
            <strong>
              <%= _('Grade:') %>
              <%= "%.02f" % @module_result.grade %>
            </strong>
          </a>
        </td>
      </tr>
    </tfoot>
  </table>
  </div>
<% end %>