Sha256: fa9ba9e6ecc38e335410b63a15455f00b243cc7ce2fe778badc094c3f794a8df

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

<%= form_for [namespace, model_name.classify.constantize.new], :method => :post, :html => { :class => "well form-horizontal mass-inserting" } do |f| %>
  <%= hidden_field_tag :mass_inserting, true %>
  <% for col in model_columns %>
    <div <%= visible_column(model_name, col, 'inline') %> class="col-<%= col %>">
      <%=
        ar = model_name.classify.constantize.columns_hash[col]
        if not ar.nil? then
          case ar.type
          when 'integer' then
            if col =~ /.*_id/ then
              f.collection_select((col).to_sym, col.classify.constantize.all, :id, :caption, { :include_blank => true }, { :class => "input-small", :placeholder => col.capitalize })
            else
              f.text_field(col.to_sym, :class => "input-small", :placeholder => col.capitalize)
            end
          when 'boolean' then
            (
            f.radio_button_tag(col.to_sym, true)
            f.label((col + "_true").to_sym, t(:yes))
            f.radio_button_tag(col.to_sym, false)
            f.label((col + "_false").to_sym, t(:no))
            )
          else
            f.text_field(col.to_sym, :class => "input-small", :placeholder => col.capitalize)
          end
        else
          f.collection_select((col + '_id').to_sym, col.classify.constantize.all, :id, :caption, { :include_blank => true }, { :class => "input-small", :placeholder => col.capitalize })
        end
      %>
    </div>
  <% end %>
  <div style="display:inline;">
    <%= f.submit t(:create, :default => "Create"), :class => 'btn' %>
  </div>
<% end %>

<% if params[:mass_inserting] then %>
  <script type="text/javascript">
    elt = $('form.mass-inserting div[style*="inline"][class*="col"] .input-small').first();
    $(elt).focus();
  </script>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beautiful_scaffold-0.1.8 lib/generators/templates/app/views/_mass_inserting.html.erb
beautiful_scaffold-0.1.7 lib/generators/templates/app/views/_mass_inserting.html.erb