_module_result.rhtml 1.87 KB
<% the_module = module_result.module %>
<% module_label = "#{the_module.name} (#{the_module.granularity})" %>

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

<hr/>

<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=".<%= metric_result.metric.name.delete("() ")%>"><%= 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="<%= metric_result.metric.name.delete("() ")%>" style="display: none;">
          <td colspan="4">
            <div id='historical-<%= metric_result.metric.name.delete("() ") %>'>
              <a href="#" show-metric-history="<%= metric_result.metric.name.delete("() ") %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>"> <p style="text-indent: 3em;"> Get Historical Values </p> </a>
            </div>
          </td>
          <td colspan="3" align="right">
            <%= range.comments.nil? ? '' : range.comments %>
          </td> 
        </tr>
      <% end %>
    <% end %>
  </tbody>
  <tfoot>
    <tr>
      <td colspan = "1">
        <div id='historical-grade'>
      </td>
      <td colspan = "4" align = "right">
        <a href="#" show-grade-history="<%= module_result.module.name %>" >
          <strong>
            <%= _('Grade:') %>
            <%= "%.02f" % module_result.grade %>
          </strong>
        </a>
      </td>
    </tr>
  </tfoot>
</table>