Sha256: 18c9ad4d7809c3d3bfcbf65eaf8b459ff90d1ade834cfbdc59fc59fd2098c0e8

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

<% formparams = [] %>
<% if not namespace.blank? then %>
  <% formparams << namespace %>
<% end %>
<% formparams << model_name.camelize.constantize.new %>
<%= form_for formparams, :method => :post, :html => { :class => "well well-small form-inline mass-inserting #{(params[:mass_inserting] ? 'setfocus' : '')}" } 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.camelize.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.camelize.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_eq"].to_i rescue '' end) }, {:class => "form-control"})
            else
              f.text_field(col.to_sym, :placeholder => t(i18n_translate_path(model_name, col)).capitalize, :class => "form-control")
            end
          when :boolean then
            (
            "<label class='bs-label-ib'>#{f.check_box(col.to_sym, {}, true, false)}#{t(i18n_translate_path(model_name, col)).capitalize}</label>".html_safe
            )
          else
            f.text_field(col.to_sym, :placeholder => t(i18n_translate_path(model_name, col)).capitalize, :class => "form-control")
          end
        else
          f.collection_select((col + '_id').to_sym, col.camelize.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_id_eq"].to_i rescue '' end) }, {:class => "form-control"})
        end
      %>
    </div>
  <% end %>
  <div style="display:inline;">
    <%= f.submit t(:create, :default => "Create"), :class => "btn btn-default", :data => { :disable_with => t(:saving, :default => "Saving...") } %>
  </div>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beautiful_scaffold-1.0.0.pre lib/generators/templates/app/views/_mass_inserting.html.erb
beautiful_scaffold-0.3.6 lib/generators/templates/app/views/_mass_inserting.html.erb