Sha256: f41dd19ff4e550c64529e707259675e856427c066518c9dd2b2d6af1458e7146
Contents?: true
Size: 1.83 KB
Versions: 4
Compression:
Stored size: 1.83 KB
Contents
===entity_code=== <%- @model.attributes.each do |attr| -%> <div class="field"> <%%= f.label :<%= attr.name %> %> <%%= f.<%= attr.form_field %> :<%= attr.name %> %> </div> <%- end # model.attributes.each -%> <%- @model.associations.each do |assoc| -%> <%- if assoc.belongs_to? -%> <div class="field"> <%%= f.label :<%= assoc.model2.singular_name.foreign_key %> %> <%%= f.select :<%= assoc.model2.singular_name.foreign_key %>, options_for_select( <%= assoc.model2.klass %>.order('<%= assoc.reference_field %> ASC').collect{ |c| [c.<%= assoc.reference_field %>, c.id] }, f.object.<%= assoc.model2.singular_name.foreign_key %> ), :prompt => '-- Select --' %> </div> <%- end # if -%> <%- if assoc.has_and_belongs_to_many? and assoc.composition? -%> <div class="nested"> <%%- <%= assoc.model2.klass %>.order('<%= assoc.reference_field %> ASC').each do |<%= assoc.model2.singular_name %>| -%> <div class="checkbox"> <%%= check_box_tag '<%= assoc.model2.plural_name %>[]', <%= assoc.model2.singular_name %>.id, (@<%= @model.singular_name %>.<%= assoc.model2.plural_name %>.include?(<%= assoc.model2.singular_name %>) ? true : false) %> <span><%%= <%= assoc.model2.singular_name %>.<%= assoc.reference_field %> %></span> </div> <%%- end -%> </div> <%- end -%> <%- if assoc.nested? -%> <div class="nested"> <%%= f.fields_for :<%= (assoc.nested_many?) ? assoc.model2.plural_name : assoc.model2.singular_name %> do |ff| %> <%%= render '<%= assoc.model2.space %>/<%= assoc.model2.plural_name %>/form_fields', :f => ff %> <%- unless assoc.nested_one? -%> <%%= ff.link_to_remove t('nested.remove') %> <%- end -%> <%% end %> <%- unless assoc.nested_one? -%> <%%= f.link_to_add t('nested.add', :name => '<%= assoc.model2.singular_name %>'), :<%= assoc.model2.plural_name %> %> <%- end -%> </div> <%- end # if -%> <%- end # associations loop -%>
Version data entries
4 entries across 4 versions & 1 rubygems