Sha256: 54d225fef4e82113037ef5d169f2e9d7f8f48b4838c793de2fec34d1eb3da989
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
<% formparams = [] %> <% if not namespace.blank? then %> <% formparams << namespace %> <% end %> <% formparams << model_name.classify.constantize.new %> <%= form_for formparams, :method => :post, :html => { :class => "well well-small 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, :selected => (begin params[:q][col + "_eq"].to_i rescue '' end) }, { :class => "input-small" }) else f.text_field(col.to_sym, :class => "input-small", :placeholder => t(col.to_sym, :default => col).capitalize) end when :boolean then ( "<label class='bs-label-ib'>#{f.check_box(col.to_sym, {}, true, false)}#{t(col.to_sym, :default => col).capitalize}</label>".html_safe ) else f.text_field(col.to_sym, :class => "input-small", :placeholder => t(col.to_sym, :default => col).capitalize) end else f.collection_select((col + '_id').to_sym, col.classify.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_id_eq"].to_i rescue '' end) }, { :class => "input-small" }) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
beautiful_scaffold-0.2.5 | lib/generators/templates/app/views/_mass_inserting.html.erb |