Sha256: 949869a8f641ae5f831f42c8b51fde8662201676c932f65557f63a464f4733aa

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

<div class="page-header">
  <h1><%%= @title %></h1>
</div>

<%%= form_for @<%= resource_name %>, html: { class: 'form-horizontal' } do |f| %>
  <%% if @<%= resource_name %>.errors.any? %>
    <div id="error_explanation" class="bs-callout bs-callout-danger">
      <h4><%%= pluralize(@<%= resource_name %>.errors.count, "error") %> prohibited this <%= resource_name %> from being saved</h4>

      <ul>
      <%% @<%= resource_name %>.errors.full_messages.each do |msg| %>
        <li><%%= msg %></li>
      <%% end %>
      </ul>
    </div>
  <%% end %>

  <%- columns.each do |column| -%>
  <div class="form-group">
    <%%= f.label :<%= column.name %>, nil, class: 'col-md-2 control-label' %>
    <div class="col-md-10">
      <%- if column.name.split('_').last == 'id' -%>
      <%%= f.select :<%= column.name %>, [['---', nil]] + <%= column.name.split('_')[0..-2].join('_').camelize %>.current.collect{|<%= column.name.first %>| [<%= column.name.first %>.name, <%= column.name.first %>.id]}, {}, class: 'form-control' %>
      <%- elsif column.field_type == :date_select -%>
      <%%= f.text_field :<%= column.name %>, class: 'datepicker form-control', value: @<%= resource_name %>.<%= column.name %> ? @<%= resource_name %>.<%= column.name %>.strftime('%m/%d/%Y') : '' %>
      <%- else -%>
      <%%= f.<%= column.field_type %> :<%= column.name %><%= ", rows: 7, style: 'width:95%'" if column.field_type == :text_area %>, class: 'form-control' %>
      <%- end -%>
    </div>
  </div>

  <%- end -%>

  <div class="form-group">
    <div class="col-md-10 col-md-offset-2">
      <%%= f.submit nil, class: 'btn btn-primary' %>
      <%%= cancel %>
    </div>
  </div>
<%% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contour-2.1.0.beta15 lib/generators/contour/scaffold/templates/_form.html.erb
contour-2.1.0.beta14 lib/generators/contour/scaffold/templates/_form.html.erb
contour-2.1.0.beta13 lib/generators/contour/scaffold/templates/_form.html.erb