YaleSTC/shifts

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

Summary

Maintainability
Test Coverage
<div class="admin_form">
  <fieldset class="index">
    <legend><%= title %></legend>
    <%= form_for (@location.new_record? ? [@department,@location] : @location) do |f| %>
      <%= f.error_messages %>
      <p>
        <%= f.label :name %>
        <%= f.text_field :name %>
      </p>
      <p>
        <%= f.label :short_name %>
        <%= f.text_field :short_name %>
      </p>
      <p>
        <%= f.label :description %>
        <%= f.text_field :description %>
      </p>
      <p>
        <%= f.label :loc_group_id %>
        <%= f.collection_select(:loc_group_id, current_user.loc_groups_to_admin(@department), :id, :name, {prompt: "Select a location group"}) %>
      </p>
      <p>
        <%= f.label :useful_links %>
        <%= f.text_area :useful_links, rows: 4, cols: 40 %>
      </p>
      <p>
        <%= f.label :min_staff %>
        <%= f.text_field :min_staff %>
      </p>
      <p>
        <%= f.label :max_staff %>
        <%= f.text_field :max_staff %>
      </p>
      <p>
        <%= f.label :report_email, text = "Receiving email address for shift reports" %>
        <%= f.text_field :report_email %>
      <p>
        <%= f.label :priority %>
        <%= f.text_field :priority %>
      </p>
      <p>
        <%= f.label :active %>
        <%= f.check_box :active %>
      </p>
      <p>
        <%= f.label :category_id, "Payform category" %>
        <%= f.collection_select(:category_id, Category.all, :id, :name, {prompt: "Select a payform category"}) %>
      </p>
      <p>
        <label>&#8200;</label>
        <%= f.submit (@location.id.nil? ? "Create" : "Update") %>
      </p>
    <% end %>
  </fieldset>
</div>