Sha256: a01f09a34e6d7c7e3abc0d35712a222e10feda956c119dc970b0f6752d72ccb8

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

<%%= form_for(@<%= singular_table_name %>, html: {class: 'form-horizontal'}) do |f| %>
  <%% if @<%= singular_table_name %>.errors.any? %>
    <div class="alert alert-block">
      <p>
      	<strong><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</strong>
        <ul>
          <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
          <li><%%= msg %></li>
          <%% end %>
        </ul>
      </p>
    </div>
    
    <script type="text/javascript">
    $('document').ready(function() {    
      $(".field_with_errors label").css('color', 'red');
      
      // Remove field_with_errors div
      $(".field_with_errors").each(function(index, element) {
        var content = element.innerHTML;
        $(element).replaceWith(content);
      });
      
	  <%% @<%= singular_table_name %>.errors.each do |a| %>      
	    $('#<%= singular_table_name %>_<%%= a %>').css('border-color', 'red');      
	  <%% end %>
    });
    </script>
  <%% end %>

<% attributes.each do |attribute| -%>
  <div class="control-group">
    <%%= f.label :<%= attribute.name %>, class: 'control-label' %>
    <div class="controls">
      <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
    </div>
  </div>
<% end -%>
  <div class="form-actions">
    <%%= f.submit <%= key_value :class, "'btn btn-primary'" %> %>
    <%%= link_to 'Back', <%= plural_table_name %>_path, <%= key_value :class, "'btn btn-default'" %> %>
  </div>
<%% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap2-rails-0.0.4 lib/templates/erb/scaffold/_form.html.erb
bootstrap2-rails-0.0.3 lib/templates/erb/scaffold/_form.html.erb
bootstrap2-rails-0.0.2 lib/templates/erb/scaffold/_form.html.erb
bootstrap2-rails-0.0.1 lib/templates/erb/scaffold/_form.html.erb