% has_many_model = model.reflections[field.to_sym].klass %> <% limit = model.reflections[field.to_sym].options[:limit] || 0 %> <% can_destroy = field_setting(model, field, :can_destroy) %> <% can_add = field_setting(model, field, :can_add) %> <% read_only = field_setting(model, field, :read_only) %> <% can_destroy = true if can_destroy.nil? %> <% can_add = true if can_add.nil? %> <% read_only = false if read_only.nil? %> <% object.send(field.to_sym).build if object.send(field.to_sym).count == 0 and can_add and (limit == 0 or limit > object.send(field.to_sym).count) and !read_only %>
<%= field_title(has_many_model, has_many_field) %> | <% end %> <% if can_destroy and !read_only %>Remover | <% end %> <% end %>
---|---|
<% if columns == 0 %> <%= has_many_form.hidden_field :id %> <% end %> <%= edit_field_content(application, has_many_model, has_many_field, item, has_many_form) %> <%= field_hint(application, has_many_model, has_many_field, 'bottom') %> | <% columns = columns + 1 %> <% end %> <% end %> <% if can_destroy and !read_only %><%= has_many_form.check_box '_destroy', :class => 'destroy' %> | <% columns = columns + 1 %> <% end %>