YaleSTC/shifts

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

Summary

Maintainability
Test Coverage
<%= form_for([@week_template, @template_time_slot], remote: true) do |f| %>
    <div id ="errors">
        <%= render partial: "template_time_slots/error_messages", locals: {f: f} %>
    </div>
    <p>
        Where:
        <% @week_template.signup_locations.each do |location| %>
            <%= check_box_tag "for_locations[]", location.id %>
            <%= label_tag "location_#{location.id}", text = location.short_name %>
            <%= "," unless location == @week_template.signup_locations.last %>
        <% end %>
    </p>
    <p>
        Start time:
        <%= f.time_select "start_time", {
                                            start_time: @start,
                                            end_time: @end,
                                            include_start_time: true,
                                            include_end_time: false,
                                            default: @start} %>
    </p>
    <p>
        End time:
        <%= f.time_select "end_time", {
                                            start_time: @start,
                                            end_time: @end,
                                            include_start_time: false,
                                            include_end_time: true,
                                            default: @end} %>
    </p>
    <p>
        Day:
        <% RequestedShift::WEEK_DAY_SELECT.each do |day| %>
            <%= check_box "template_time_slot[day]", day[1].to_i %> <%= "#{day[0][0..2]}" %>
        <% end %>
    </p>
    <%= f.submit @template_time_slot.new_record? ? 'Add' : 'Update'  %>
<% end %>