omegahm/beerclub

View on GitHub
app/views/users/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for @user, html: { class: 'form-horizontal' } do |f| %>
  <fieldset>
    <legend>
      <h1><%= title -%></h1>
    </legend>

    <% if @user.errors.any? %>
      <div id="error_explanation">
        <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

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

    <div class="form-group">
      <%= f.label :name, 'Navn', class: 'col-lg-2 control-label' %>
      <div class="col-lg-10">
        <%= f.text_field :name, class: 'form-control' %>
      </div>
    </div>

    <div class="form-group">
      <%= f.label :room, 'Værelse', class: 'col-lg-2 control-label' %>
      <div class="col-lg-10">
        <%= f.text_field :room, class: 'form-control' %>
      </div>
    </div>

    <div class="form-group">
      <div class="col-lg-offset-2 col-lg-10">
        <div class="checkbox">
          <label>
            <%= f.check_box :visible %> Synlig
          </label>
        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-lg-offset-2 col-lg-10">
        <%= f.submit title, class: 'btn btn-success btn-sm' %>
        <%= link_to 'Tilbage', users_path, class: 'btn btn-link btn-sm' %>
      </div>
    </div>
  </fieldset>
<% end %>