Sha256: dc7886d660673452e737b2715e44e09798435acce466ee38fd72897182edfc40

Contents?: true

Size: 1.61 KB

Versions: 2

Compression:

Stored size: 1.61 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 => :<%= attribute.image? ? 'image' : 'attachment' %><%= attribute.required_attachment? ? ', :required => true' : '' %>
    <%- else -%>
    = f.input :<%= attribute.actual_name %><%= attribute.text? ? %q(, :input_html => { :class => 'medium wysiwyg' }) : '' %>
    <%- 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 => :<%= attribute.image? ? 'image' : 'attachment' %><%= attribute.required_attachment? ? ', :required => true' : '' %>
      <%- else -%>
      = <%= child.name %>.input :<%= attribute.actual_name %><%= attribute.text? ? %q(, :input_html => { :class => 'medium wysiwyg' }) : '' %>
      <%- end -%>
    <%- end -%>
  <%- end -%>
      = <%= child.name %>.input :nested, :as => :hidden
<%- end -%>

  = f.buttons
<%- if level.multipart? -%>

= render :partial => 'admin/shared/progress_bar'
<%- end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schofield-0.3.1 lib/generators/templates/form.erb
schofield-0.3.0 lib/generators/templates/form.erb