Sha256: c9636c0a86343d3bc9bf8824dae202b90786810190760fa30e8a9e4bb10e7083

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

<%%= form_for(@<%= singular_table_name %>) do |f| %>
<%% if @<%= singular_table_name %>.errors.any? %>
  <div class="panel panel-danger">
    <div class="panel-heading">
      <h3 class="panel-title">
        <%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h3>
    </div>
    <div class="panel-body">
      <ul>
        <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
        <li><%%= msg %></li>
        <%% end %>
      </ul>
    </div>
  </div>
  <%% end %>
    <%- attributes.each do |attribute| -%>
      <div class="form-group">
      <%- if attribute.password_digest? -%>
        <%%= f.label :password %>
        <%%= f.password_field :password, class: "form-control" %>
      </div>
      <div>
        <%%= f.label :password_confirmation %>
        <%%= f.password_field :password_confirmation, class: "form-control" %>
      <%- else -%>
      <%- if attribute.reference? -%>
        <%%= f.label :<%= attribute.column_name %> %>
        <%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, {prompt: true}, { class: "form-control"}  %>
      <%- elsif  attribute.type == :boolean -%>
        <div class="checkbox">
          <label class="checkbox-inline">
            <%%=  check_box_tag "<%= singular_table_name %>", @<%= singular_table_name %>.<%= attribute.name %>, @<%= singular_table_name %>.<%= attribute.name %> %><%= attribute.name.camelize %>
          </label>
        </div>
      <% else -%>
        <%%= f.label :<%= attribute.name %> %>
        <%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: "form-control" %>
      <%- end -%>
      <%- end -%>
      </div>
      <%- end -%>
      <hr />
      <div class="form-group actions">
        <%%= f.submit class: "btn btn-default" %>
      </div>
<%% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
actionscaffold-0.3.5 lib/generators/scaffold_view/templates/bootstrap/_form.html.erb
actionscaffold-0.3.1 lib/generators/scaffold_view/templates/bootstrap/_form.html.erb