Sha256: d160a3651b8d514da86bbe397e1da7759cf14e05b72e7c6f035daf2a8abb1a6e

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

= better_error_messages_for

= semantic_form_for <%= level.nested? ? 'parent? ? [:admin, parent, resource] : ' : '' %>[:admin, resource]<%= level.multipart? ? ', :html => { :multipart => true }' : '' %> do |f|

  = f.inputs do
  
<%- level.attributes.each do |attribute| -%>
  <%- if level.form_field?(attribute) -%>
    <%- if attribute.attachment? -%>
    = f.input :<%= attribute.name.gsub(/_file_name$/, '') %>, :as => :image
    <%- else -%>
    = f.input :<%= attribute.actual_name %><%= attribute.text? ? %q(, :input_html => { :class => 'medium previewable' }) : '' %>
    <%- end -%>
  <%- end -%>
<%- end -%>
<%- level.has_ones.each do |child| -%>

    = f.semantic_fields_for :<%= child.name %>, resource.<%= child.name %> || resource.build_<%= child.name %> do |<%= child.name %>|
  <%- child.attributes.each do |attribute| -%>
    <%- if child.form_field?(attribute) && attribute.actual_name != level.name -%>
      <%- if attribute.attachment? -%>
      = <%= child.name %>.input :<%= attribute.name.gsub(/_file_name$/, '') %>, :as => :image
      <%- else -%>
      = <%= child.name %>.input :<%= attribute.actual_name %><%= attribute.text? ? %q(, :input_html => { :class => 'medium previewable' }) : '' %>
      <%- end -%>
    <%- end -%>
  <%- end -%>
      = <%= child.name %>.input :nested, :as => :hidden
<%- end -%>
                      
  = f.buttons

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
schofield-0.2.2 lib/generators/templates/form.erb
schofield-0.2.1 lib/generators/templates/form.erb
schofield-0.2.0 lib/generators/templates/form.erb