show.html.erb 2.26 KB
<% @project = locals[:current_project] %>
<% @total_metrics = @project.total_metrics if @project != nil %>
<% @statistical_metrics = @project.statistical_metrics if @project != nil %>
<% @svn_error = @project.svn_error if (@project != nil && @project.svn_error) %>

<h1> <%= @project.name %>'s Info</h1>
<table id="show_info">
  <tr>
    <td><%= _("Name") %></td>
    <td><%= @project.name %></td>
  </tr>
  <% if (@project.description != nil && @project.description != "" ) %>
    <tr>
      <td><%= _("Description") %></td>
      <td><%= @project.description %></td>
    </tr>
  <% end %>
  <tr>
    <td><%= _("Repository address") %></td>
    <td><%= @project.repository_url %></td>
  </tr>
</table>

<br />


<% if @svn_error %>
  <h3>ERROR</h3>
  <div id="svn_error">
    <%= @svn_error %>
  </div>
  <br />
  <br />
  <p>
  <%= _("Possible causes:") %>
  <ul>
    <li>
    <%= _("Server is down") %>
    </li>
    <li>
    <% _("URL invalid, in this case create another project with the correct URL
    (Sorry for the incovenience, we're working for a better solution)") %>
    </li>
  </ul>
  </p>
<%else%>
  <h3> <%= _("Metric Results") %> </h3>
  <% if @project.metrics_calculated? %>
    <h3> <% _("Total Metrics") %> </h3>
    <table id="total_metrics">
      <% @total_metrics.each_with_index do |metric, index| %>
        <tr id="tr_<%= metric.name %>" class="d<%= index % 2 %>">
          <td class="metric_name"> <%= metric.name %> </td>
          <td class="metric_value"> <%= metric.value %> </td>
        </tr>
      <% end %>
    </table>

    <h3> <%= _("Statistical Metrics") %> </h3>
    <% @statistical_metrics.each_key do |metric_name| %>
      <div id="statistical_metrics">
        <%= "#{metric_name}_average: #{@statistical_metrics[metric_name]["average"]}" %>
        <ul>
          <% @statistical_metrics[metric_name].each do |stat_name, stat_value| %>
            <% if stat_name != "average" %>
              <li>
              <%= "#{metric_name}_#{stat_name}: #{stat_value}" %>
              </li>
            <% end %>
          <% end %>
        </ul>
      </div>
    <% end %>

  <% else %>
    <div id="progress_message">
      <%= _("Wait a moment while the metrics are calculated.<br/>
      Reload the page manually in a few moment. ") %>
    </div>
  <% end %>
<% end %>