mezuro/prezento

View on GitHub
app/views/kalibro_configurations/show.html.erb

Summary

Maintainability
Test Coverage
<div class="page-header">
  <h1><%= @kalibro_configuration.name %></h1>
</div>

<p>
  <strong><%= t('description') %>:</strong>
  <%= @kalibro_configuration.description %>
</p>

<hr>
<% if kalibro_configuration_owner? @kalibro_configuration.id %>
  <%= link_to t_action(:add, MetricConfiguration), kalibro_configuration_choose_metric_path(@kalibro_configuration.id), class: 'btn btn-info' %>
<% end %>
<div id="tree_metrics">
<h2><%= t('tree_metrics') %></h2>

<table class="table table-hover" id="tree_metric_configurations">
  <thead>
    <tr>
      <th><%= t('metric') %></th>
      <th><%= t('code') %></th>
      <th><%= t('weight') %></th>
      <th colspan="3"></th>
    </tr>
  </thead>
  <tbody>
    <% if Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations").empty? %>
      <%= render partial: 'no_metric_configurations', locals: { message: 'no_tree_metric_configurations' } %>
    <% else %>
      <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_tree_metric_configurations"), as: :metric_configuration %>
    <% end %>
  </tbody>
</table>
</div>

<hr>

<div id="hotspot_metrics">
<h2><%= t('hotspot_metrics') %></h2>

<table class="table table-hover" id="hotspot_metric_configurations">
  <thead>
    <tr>
      <th><%= t('metric') %></th>
      <th><%= t('code') %></th>
      <th colspan="2"></th>
    </tr>
  </thead>
  <tbody>
    <% if Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations").empty? %>
      <%= render partial: 'no_metric_configurations', locals: { message: 'no_hotspot_metric_configurations' } %>
    <% else %>
      <%= render partial: 'metric_configurations', collection: Rails.cache.read("#{@kalibro_configuration.id}_hotspot_metric_configurations"), as: :metric_configuration %>
    <% end %>
  </tbody>
</table>
</div>

<hr>
<p>
 <%= link_to t('back'), kalibro_configurations_path, class: 'btn btn-default' %>
 <% if kalibro_configuration_owner? @kalibro_configuration.id %>
   <%= link_to t_action(:destroy, KalibroConfiguration), kalibro_configuration_path(@kalibro_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Configuration?' }, class: 'btn btn-danger' %>
 <% end %>
</p>