<%= render 'layouts/delete_modal', delete_options: @delete_options %> <% @unit_table_fields.each do |f| %> <%= thead(f) %> <% end %> <% @units.each do |a| %> <% end %>
<%= a.name %>
<% Department.where({:unit_id => a.id}).each do |d| %> <%= d.name %>
<% end %>
<%= form_for @unit, :url => @url, html: {class: "form-horizontal main-forms previewable"} do |f| %>
<% # encoding: utf-8 %> <% content_for :page_specific_css do %> <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/main-list" %> <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/module-area" %> <% end %>

<%= @unit.new_record? ? t(:add) : t(:edit) %>

<% @site_in_use_locales.each_with_index do |locale, i| %>
">
<%= f.fields_for :name_translations do |f| %> <%= f.text_field locale, class: "input-xxlarge", placeholder: t(:name), value: (@unit.name_translations[locale] rescue nil) %> <% end %>
<% end %>
<% if @unit && !@unit.departments.blank? %>
<% @unit.departments.each_with_index do |department, i| %> <%= f.fields_for :departments, department do |f| %> <%= render :partial => 'form_dept', :object => department, :locals => {:f => f, :i => i} %> <% end %> <% end %>
<% end %>

<%= hidden_field_tag 'department_field_count', @unit.departments.count %> <%= t(:add) %>

<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %> <%= f.submit t('submit'), class: 'btn btn-primary' %>
<% content_for :page_specific_javascript do %> <% end %>
<% end %>