app/views/form_section/edit.html.erb
<h1 class="no_border"><%= link_to @form_section.form.name, form_form_sections_path(@form_section.form) %> >
<span id='sectionId'><%= @form_section.name %></span></h1>
<div class="page-content-new form_page">
<div class="side-tab-content full_width">
<%= render :partial => "form_section/form_section" %>
<%= link_to I18n.t("user.actions.delete") + " " + @form_section.name, form_section_path(@form_section), { class: "form_delete", method: :delete, data: { confirm: I18n.t("messages.delete_form_section") }} %>
<% if @form_section.editable? %>
<h3><%= t("fields.label") %><%= link_to t("fields.add"), "javascript:void(0)", :class => "add_field" %></h3>
<% else %>
<h3><i><%= t("forms.cannot_be_edited") %></i></h3>
<% end %>
<div class="text_info"><%= t("form_section.messages.drag_drop_help_text").html_safe %></div>
<table id="form_sections" class="list_table" width="940">
<thead>
<tr>
<th width="280"><%= t("name") %></th>
<th width="190"><%= t("help_text") %></th>
<th width="100"><%= t("form_section.options") %></th>
<th width="75"><%= t("fields.type") %></th>
<th width="75" align="center"><%= t("form_section.hide") %></th>
<th width="75" align="center"><%= t("form_section.matchable") %></th>
<th width="220" align="center">Actions</th>
</tr>
</thead>
<tbody>
<input type="hidden" id="toggle_url" value="<%= toggle_fields_form_section_fields_path(@form_section) %>">
<input type="hidden" id="edit_url" value="<%= edit_form_section_path(@form_section) %>">
<input type="hidden" id="move_url" value="<%= change_form_form_section_fields_path(@form_section) %>">
<input type="hidden" id="save_order_url" value="<%= save_order_form_section_fields_path(@form_section) %>">
<% @form_section.fields.each do |field| %>
<% unless field.new? %>
<tr data="<%= field.name %>" class="<%= field.visible? ? "rowEnabled" : "rowDisabled" %>">
<td width="280"><%= field.display_name %></td>
<td width="190"><%= field.help_text %></td>
<td width="100"><%= field.option_strings unless field.option_strings.empty? %></td>
<td width="75"><%= field.type.try(:humanize) %></td>
<% if @form_section.editable? %>
<td width="75" align="center">
<% if field.editable? %>
<%= check_box_tag "fields[]", field.name, !field.visible? , {:id => "fields_#{field.name}", :class => "field_hide_show", 'data-field-name' => "visible"} %>
<% end %>
</td>
<% end %>
<td width="75">
<% if field.can_be_used_for_matching? %>
<%= check_box_tag "fields[]", field.name, field.matchable? , {:id => "fields_#{field.name}_matchable", :class => "field_matchable", 'data-field-name' => "matchable"} %>
<% end %>
</td>
<% if @form_section.editable? %>
<td class='field-buttons' width="220">
<% if field.editable? %>
<a href="javascript:void(0)" class="link_moveto"><%= t("fields.move_to") %></a>
<%= link_to t("buttons.edit"), edit_form_section_field_path(:form_section_id => @form_section.unique_id, :id => field.name), :id => "#{field.name}_edit" %>
<%= render :partial => "form_section/delete_button", :locals => {:field => field, :url => delete_form_section_fields_path(@form_section.unique_id),
:warning => I18n.t("messages.warning")} %> <%= hidden_field_tag "field_name" "#{field.name}" %>
<div class="move_to_panel hide">
<%= form_tag change_form_form_section_fields_path(@form_section), :html => {:method => :post} do -%>
<input type='hidden' name='id' value='<%= field.name %>' style="display:none;"/>
<input type='hidden' class="destination_form_id" name='destination_form_id' style="display:none;"/>
<% end %>
<%= select_tag "#{field.name}_destination_form_id", options_for_select(form_sections_for_display(@form), @form_section.unique_id), :class => "field_location"%>
</div>
<% end %>
</td>
<% end %>
</tr>
<% end %>
<% end %>
</tbody>
<tfoot>
</tfoot>
</table>
<div class="field_details_overlay hide"></div>
<div class="field_details_panel hide">
<ul class="field_types clearfix">
<li><%= link_to t("fields.text_field"), "javascript:void(0)", :id => "text_field", :class => "field_links sel" %> </li>
<li><%= link_to t("fields.text_area"), "javascript:void(0)", :id => "textarea", :class => "field_links" %></li>
<li><%= link_to t("fields.check_box"), "javascript:void(0)", :id => "check_boxes", :class => "field_links" %></li>
<li><%= link_to t("fields.select_box"), "javascript:void(0)", :id => "select_box", :class => "field_links" %></li>
<li><%= link_to t("fields.radio_button"), "javascript:void(0)", :id => "radio_button", :class => "field_links" %></li>
<li><%= link_to t("fields.numeric_field"), "javascript:void(0)", :id => "numeric_field", :class => "field_links" %></li>
<li><%= link_to t("fields.date_field"), "javascript:void(0)", :id => "date_field", :class => "field_links" %></li>
</ul>
<% @field ||= Field.new(:type => 'text_field') %>
<%= error_messages_for :field,
:header_tag => :h3,
:header_message => t("form_section.messages.cannot_create"),
:message => t('form_section.messages.correct_errors') %>
<%= render :partial => 'form_section/add_field', :locals => {:div_id => "field_details", :fields => [{:display_name => :text_field}, {:help_text => :text_area}] } %>
<%= render :partial => 'form_section/add_field', :locals => {:div_id => "field_details_options", :fields => [{:display_name => :text_field}, {:help_text => :text_area}, {:option_strings_text => :text_area}] } %>
</div>
</div>
<script>
var show_add_field = <%= show_add_field ||= (params[:show_add_field] || false) %>;
var field_type = "<%= @field.type || 'text_field' %>";
</script>