personal_plugin_generator/app/views/admin/personal_plugin_fields/_render_table.html.erb

39 lines
1.9 KiB
Plaintext

<table class="table table-bordered">
<thead>
<th><%= t(:remove) %></th>
<th><%= thead_field("field_name") %></th>
<th><%= thead_field("translation_name") %></th>
<th><%= thead_field("field_type") %></th>
<th><%= thead_field("localize") %></th>
<th><%= thead_field("slug_title") %></th>
</thead>
<tbody>
<%= f.fields_for root_name do |f| %>
<% field_values.each_with_index do |field_value,i| %>
<% i = "new_field_index" if field_value.nil? && !@include_blank %>
<tr>
<td><span class="remove_btn">X</span></td>
<td><%= text_field_tag "#{f.object_name}[#{i}][field_name]",(field_value["field_name"] rescue nil) %></td>
<td>
<% @site_in_use_locales.each_with_index do |locale, ii| %>
<span class="<%= locale %> tab-pane fade <%= ( ii == 0 ) ? "in active" : '' %>">
<%= f.fields_for "#{i}][translation_name" do |f| %>
<%= text_field_tag "#{f.object_name}[#{locale}]", (field_value["translation_name"][locale] rescue nil) , class: "input-block-level" %>
<% end %>
</span>
<% end %>
</td>
<td><%= select_tag "#{f.object_name}[#{i}][field_type]",options_for_select(field_types,(field_value["field_type"] rescue nil)) %></td>
<td>
<%= hidden_field_tag "#{f.object_name}[#{i}][localize]", "0",:id=>nil %>
<%= check_box_tag "#{f.object_name}[#{i}][localize]", "1" , (field_value["localize"] == "1" rescue false),:id=>nil %>
</td>
<td>
<%= hidden_field_tag "#{f.object_name}[#{i}][slug_title]", "0",:id=>nil %>
<%= check_box_tag "#{f.object_name}[#{i}][slug_title]", "1" , (field_value["slug_title"] == "1" rescue false),:id=>nil,:class=>"slug_title" %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>