app/views/factors/index.html.erb
<div class="tabs">
<ul>
<li><a href="#tabs-1"><%= I18n.t(:factors) %></a></li>
<li><a href="#tabs-2"><%= I18n.t(:complexity_by_factor) %></a></li>
</ul>
<div id="tabs-1">
<table border="0" width="100%">
<tr>
<td style="text-align:right;">
<%= link_to I18n.t('new_factor'), new_factor_path, :class => 'btn' %>
</td>
</tr>
</table>
<table id="table_list_5" class="table tablesorterPager table-striped table-bordered table-condensed">
<thead>
<tr>
<th><%= I18n.t(:name) %></th>
<th><%= I18n.t(:alias) %></th>
<th><%= I18n.t(:type) %></th>
<th><%= I18n.t(:description) %></th>
<th class="filter-select"><%= I18n.t(:record_status) %></th>
<th class="action"><%= I18n.t(:actions) %></th>
</tr>
</thead>
<tbody>
<% @factors.each do |factor| %>
<tr>
<td><%= factor.name %></td>
<td><%= factor.alias %></td>
<td><%= factor.factor_type.nil? ? '' : factor.factor_type.humanize %></td>
<td><%= factor.description %></td>
<td><%= factor.record_status.name unless factor.record_status.nil? %> <%= factor.show_custom_value %></td>
<td class="center">
<%= link_to '', edit_factor_path(factor), :class => 'icon-pencil', :title => I18n.t('edit') %>
<%= link_to '', factor, confirm: I18n.t('are_you_sur'), method: :delete, :class => 'icon-trash', :title => I18n.t('delete') %>
<% if is_master_instance? && !factor.is_local_record? %>
<% if factor.is_retired? %>
<%= link_to('', "factors/#{factor.id}/restore_change", confirm: I18n.t('restoring'), :class => 'icon-undo', :style => 'color:orange', :title => I18n.t('restore_title')) %>
<% else %>
<% unless factor.is_defined? %>
<%= link_to('', "factors/#{factor.id}/validate_change", confirm: I18n.t('validation'), :class => 'icon-ok', :style => 'color:green', :title => I18n.t('validate_title')) %>
<% end %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
<%= render :partial => 'layouts/footer_table' %>
</table>
</div>
<div id="tabs-2">
<b>Factor's Complexities Library</b>
<br>
<% @factors.each do |factor| %>
<h4>
<%= factor.factor_type.nil? ? "" : factor.factor_type.humanize %> - <%= factor.name %> - <%= factor.description %>
</h4>
<table class="table">
<tr>
<th>
<% if can? :edit_organizations, Organization %>
<%= link_to 'Ajouter un niveau', new_organization_uow_complexity_path(:organization_id => nil, factor: factor.id), :class => '' %>
<% end %>
</th>
<th></th>
<th></th>
</tr>
<% factor.organization_uow_complexities.where(organization_id: nil).order('display_order ASC').each do |c| %>
<tr>
<td class="span2"><%= c.name %></td>
<td class="span2"><%= c.value %></td>
<td>
<%= link_to '', edit_organization_uow_complexity_path(c, organization_id: nil), :class => 'icon-pencil icon-large pull-left', :title => I18n.t('edit') %>
<%= link_to '', c, confirm: I18n.t('are_you_sur'), method: :delete, :class => 'icon-trash icon-large pull-left', :title => I18n.t('delete') %>
<% if is_master_instance? && !c.is_local_record? %>
<% if c.is_retired? %>
<%= link_to('', "/organization_uow_complexities/#{c.id}/restore_change", confirm: I18n.t('restoring'), :class => 'icon-undo icon-large pull-left', :style => 'color:orange', :title => I18n.t('restore_title')) %>
<% else %>
<% unless c.is_defined? %>
<%= link_to('', "/organization_uow_complexities/#{c.id}/validate_change", confirm: I18n.t('validation'), :class => 'icon-ok icon-large pull-left', :style => 'color:green', :title => I18n.t('validate_title')) %>
<% end %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>
</div>
</div>