adds shifts
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
<%= booth.location %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.booths.booth.shifts"),
|
||||
new_admin_booth_shift_path(booth),
|
||||
class: "button hollow" %>
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_booth_path(booth),
|
||||
class: "button hollow" %>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<th><%= t("admin.booths.index.name") %></th>
|
||||
<th><%= t("admin.booths.index.location") %></th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @booths.each do |booth| %>
|
||||
|
||||
24
app/views/admin/poll/shifts/_shifts.html.erb
Normal file
24
app/views/admin/poll/shifts/_shifts.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h3><%= t("admin.poll_shifts.new.assignments") %></h3>
|
||||
<table class="fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.poll_shifts.new.date") %></th>
|
||||
<th><%= t("admin.poll_shifts.new.officer") %></th>
|
||||
<th class="text-right"><%= t("admin.poll_shifts.new.assignment") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @shifts.each do |shift| %>
|
||||
<tr id="shift_<%= shift.id %>" class="shift">
|
||||
<td><%= l(shift.date.to_date, format: :long) %></td>
|
||||
<td><%= shift.officer.name %></td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.poll_shifts.new.remove_assignment"),
|
||||
admin_booth_shift_path(@booth, shift),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
46
app/views/admin/poll/shifts/new.html.erb
Normal file
46
app/views/admin/poll/shifts/new.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
<%= back_link_to admin_booths_path %>
|
||||
|
||||
<h2><%= @booth.name %></h2>
|
||||
|
||||
<%= form_for @shift, as: :shift, url: admin_booth_shifts_path do |f| %>
|
||||
<%= render "shared/errors", resource: @shift %>
|
||||
|
||||
<fieldset class="fieldset">
|
||||
<legend>
|
||||
<%= t("admin.poll_shifts.new.new_assignment") %>
|
||||
</legend>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.poll_shifts.new.date") %></label>
|
||||
<%= f.select :date,
|
||||
shift_dates_select_options(@polls),
|
||||
prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.poll_shifts.new.officer") %></label>
|
||||
<%= f.select :officer_id,
|
||||
officer_select_options(@officers),
|
||||
prompt: t("admin.poll_shifts.new.select_officer"),
|
||||
label: false %>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :booth_id, value: @booth.id %>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<%= f.submit t("admin.poll_shifts.new.add_assignment"),
|
||||
class: "button expanded hollow margin-top" %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<div id="shifts">
|
||||
<% if @shifts.empty? %>
|
||||
<div class="callout primary margin-top">
|
||||
<%= t("admin.poll_shifts.new.no_assignments") %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render "shifts" %>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user