Sha256: 6d4d40c87554fcab3f04fb610dbc075ce75e88c84a57ee7dba040333b2a85bab

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

<%= fields_for @record do |f| %>
  <ul id="<%= field.name %>" data-tabs="{closable: true, onRemove: page_part_tab_remove, addButton: page_part_tab_add}">
    <ul>
      <% @record.send(field.name).each_with_index do |page_part, index| %>
        <li><%= link_to page_part.name, "#page_part_tab_#{index}" %></li>
      <% end %>
    </ul>
    <% @record.send(field.name).each_with_index do |page_part, index| -%>
      <li id="<%= "page_part_tab_#{index}" %>">
        <%= f.fields_for field.name, page_part do |page_part_builder| %>
          <% field.children.each do |field| %>
            <%= field.render :form, parent_controller, page_part_builder.object, :builder => page_part_builder %>
          <% end %>
          <%= page_part_builder.hidden_field :id unless page_part_builder.object.persisted? %>
        <% end %>
      </li>
    <% end -%>
  </ul>
  <div id="page_parts_marked_for_destroy">
  </div>

  <% new_page_part_tab_panel = capture do %>
    <%= f.fields_for field.name, PagePart.new, :child_index => 'new_page_part_tab_panel_index' do |page_part_builder| %>
      <% field.children.each do |field| %>
        <%= field.render :form, parent_controller, page_part_builder.object, :builder => page_part_builder %>
      <% end %>
    <% end %>
  <% end %>

  <%= javascript_tag do %>
    var new_page_part_tab_panel = '<%= j new_page_part_tab_panel.strip.html_safe %>'
  <% end %>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puffer_pages-0.1.0 app/components/page_parts/form.html.erb