Cập nhật:Tôi cập nhật điều này sau khi thực hiện một số việc đào bới và nhận ra rằng đây có thể là lỗi khởi động twitter gây ra sự cố.Định dạng bảng lồng nhau với simple_form, nested_form và twitter-bootstrap
Đây là một phiên bản thô của hình thức lồng nhau của tôi:
<%= simple_nested_form_for @user, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<%= f.input :email %>
<%= f.input :name_first %>
<%= f.input :name_last %>
<table class="table table-striped">
<thead>
<tr>
<th>Active</th>
<th>Company</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<%= f.simple_fields_for :roles, :wrapper_tag => :tr do |role_form| %>
<td><%= role_form.hidden_field :id %><%= role_form.input :active, :label => false, :wrapper => false %></td>
<td><%= role_form.association :company, :label => false, :wrapper => false %></td>
<td><%= role_form.input :role, :label => false, :collection => [ "Guest", "User", "Inspector", "Owner"], :wrapper => false %></td>
<td><%= role_form.link_to_remove "Delete", :class => 'btn btn-mini btn-danger' %>
</td>
<% end %>
</tbody>
</table>
<p><%= f.link_to_add "Add a Role", :roles %></p>
</div>
<div class="form-actions">
<%= f.submit nil, :class => 'btn btn-primary' %>
<%= link_to 'Cancel', users_path, :class => 'btn' %>
</div>
</fieldset>
<% end %>
Khi nó trả lại các trường trong hàng bảng được thụt vào giống như hình thức phụ huynh thông qua { :class => 'form-horizontal' }
. Tôi chỉ muốn các lĩnh vực không có div wrapper vv và dường như không thể tìm ra nó. Tôi nghĩ rằng :wrapper => false
là vé nhưng không có may mắn cho đến nay.
Dan
Bạn có thể đăng giải pháp cuối cùng hoàn chỉnh của mình không, vì tôi gặp sự cố khi thêm phần lồng nhau vào bảng và có vẻ như bạn đang làm việc. Tôi sẽ đánh giá cao. –
Tôi đã kết thúc bước ra khỏi quan điểm này - nếu tôi nhớ lại div xung quanh đầu vào là giải pháp cuối cùng. –