Sha256: 5a365c2385e7a885d81f92d93679a51830cd8b6d1bfe96af519b9c0fdfbf37ea

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

<%%= form_for(@<%= singular_table_name %>, html: { class: "col s12", role: "form" }) do |f| %>
  <%% if @<%= singular_table_name %>.errors.any? %>
    <div class="alert alert-danger alert-dismissable" role="alert">
      <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <h4><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h4>

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

<% attributes.each do |attribute| -%>
  <% if attribute.field_type == :textarea %>
    <div class="row">
      <div class="input-field col s12">
        <%%= f.text_area :<%= attribute.name %>, class: "materialize-textarea" %>
        <%%= f.label :<%= attribute.name %> %>
      </div>
    </div>
  <% else %>
    <div class="row">
      <div class="input-field col s12">
        <%%= f.text_field :<%= attribute.name %> %>
        <%%= f.label :<%= attribute.name %> %>
      </div>
    </div>
  <% end %>
<% end -%>
  <div class="row">
    <%%= f.submit 'Save', class: "waves-effect waves-light btn" %>
  </div>
<%% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
r5-0.5.0.0 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
r5-0.4.0.5 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
r5-0.4.0.4 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
r5-0.4.0.2 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
r5-0.4.0.1 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb
r5-0.4.0.0 lib/r5/template/lib/templates/erb/scaffold/_form.html.erb