app/views/unit_of_works/_form.html.erb
<div class="tabs">
<ul>
<li><a href="#tabs-1"><%= I18n.t(:organization_unit_of_work) %> </a></li>
<li><a href="#tabs-2"> Complexities </a></li>
</ul>
<div id="tabs-1">
<%= simple_form_for(@unit_of_work) do |f| %>
<%= f.input :organization_id, :as => :hidden, :input_html => {:class => 'input-xxlarge', :value => @organization.id || params[:organization_id]} %>
<%= f.input :name, :label => I18n.t('name'), :input_html => {:class => 'input-xxlarge', :autofocus => (controller.action_name == 'new')} %>
<%= f.input :alias, :label => I18n.t('alias'), :input_html => {:class => 'input-xxlarge'} %>
<%= f.input :description, :label => I18n.t('description'), :input_html => {:class => 'input-xxlarge', :rows => 5} %>
<%= f.input :state, :label => I18n.t('state'), :as => :select, :collection => UnitOfWork.aasm.states_for_select, :input_html => {:class => 'input-large'} %>
<%= f.input :display_order, :label => I18n.t('display_order'), :input_html => {:class => 'input-large'} %>
<div class="accordion" id="accordion1">
<div class="accordion-group accordion-caret">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne">
<i class="fa fa-caret-down"></i>
<b><%= I18n.t 'text_organization_technology' %></b>
</a>
</div>
<div id="collapseOne" class="accordion-body in collapse">
<div class="accordion-inner">
<%= f.association :organization_technologies, :collection => @organization.organization_technologies, :as => :check_boxes, :input_html => {:class => 'input-xxlarge'} %>
</div>
</div>
</div>
</div>
<div class="actions-tabs">
<% if can? :edit_organizations, Organization %>
<% if action_name.in?(%w(new create)) %>
<%= submit_tag I18n.t('save_and_create'), :class => 'btn' %>
<%= submit_tag I18n.t('save'), :class => 'btn' %>
<% elsif action_name == 'edit' || action_name=='update' %>
<%= submit_tag I18n.t('save'), :class => 'btn' %>
<%= submit_tag I18n.t('apply'), :class => 'btn' %>
<% end %>
<% end %>
<%= link_to I18n.t('back'), edit_organization_path(@organization || params[:organization_id], :anchor => 'tabs-uow'), :class => 'btn' %>
</div>
<% end %>
</div>
<div id="tabs-2" style="min-height: 50px;">
<% @unit_of_work.organization_technologies.each do |ot| %>
<% if can? :edit_organizations, Organization %>
<p>
<%= link_to I18n.t('new_uow_complexity'), new_organization_uow_complexity_path(organization_id: @organization.id,
technology_id: ot.id,
uo_id: @unit_of_work.id, :anchor => 'tabs-uow'), :class => 'btn btn-mini pull-right' %>
</p>
<% end %>
<h4>
<%= @unit_of_work.name %> - <%= ot.name %>
</h4>
<table id="table_list_5" class="table table-bordered">
<thead>
<tr>
<th><%= I18n.t(:name) %></th>
<th><%= I18n.t(:description) %></th>
<th class="action" colspan="2"><%= I18n.t(:actions) %></th>
</tr>
</thead>
<tbody>
<% OrganizationUowComplexity.where(organization_technology_id: ot.id, unit_of_work_id: @unit_of_work.id).all.each do |oc| %>
<tr>
<td><%= oc.name %></td>
<td><%= oc.description %></td>
<td>
<%= link_to '', edit_organization_uow_complexity_path(oc.id, :organization_id => @organization.id), :class => 'icon-pencil pull-left', :title => I18n.t('edit') %>
<% if can? :manage, Organization %>
<%= link_to '', oc, confirm: I18n.t('are_you_sure'), method: :delete, :class => 'icon-trash pull-left', :style => 'color:red', :title => I18n.t('delete') %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>