Add Task selection on Poll Shift creation, and on shifts table

This commit is contained in:
Bertocq
2017-09-27 14:05:25 +02:00
parent 1dde4cb3ec
commit ce92dcd088
5 changed files with 22 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
end end
def shift_params def shift_params
params.require(:shift).permit(:booth_id, :officer_id, :date) params.require(:shift).permit(:booth_id, :officer_id, :date, :task)
end end
end end

View File

@@ -6,13 +6,21 @@
<%= t("admin.poll_shifts.new.new_shift") %> <%= t("admin.poll_shifts.new.new_shift") %>
</legend> </legend>
<div class="small-12 medium-4 column highlight padding"> <div class="small-12 medium-3 column highlight padding">
<strong><%= t("admin.poll_shifts.new.officer") %></strong> <strong><%= t("admin.poll_shifts.new.officer") %></strong>
<br><%= @officer.name %> <br><%= @officer.name %>
<%= f.hidden_field :officer_id, value: @officer.id %> <%= f.hidden_field :officer_id, value: @officer.id %>
</div> </div>
<div class="small-12 medium-4 column"> <div class="small-12 medium-3 column">
<label><%= t("admin.poll_shifts.new.task") %></label>
<%= f.select :task,
Poll::Shift.tasks.map {|k,v| [t("admin.poll_shifts.#{k}"), k]},
prompt: t("admin.poll_shifts.new.select_task"),
label: false %>
</div>
<div class="small-12 medium-3 column">
<label><%= t("admin.poll_shifts.new.date") %></label> <label><%= t("admin.poll_shifts.new.date") %></label>
<%= f.select :date, <%= f.select :date,
shift_dates_select_options(@polls), shift_dates_select_options(@polls),
@@ -22,7 +30,7 @@
<%= f.hidden_field :booth_id, value: @booth.id %> <%= f.hidden_field :booth_id, value: @booth.id %>
<div class="small-12 medium-4 column"> <div class="small-12 medium-3 column">
<%= f.submit t("admin.poll_shifts.new.add_shift"), <%= f.submit t("admin.poll_shifts.new.add_shift"),
class: "button expanded margin-top" %> class: "button expanded margin-top" %>
</div> </div>

View File

@@ -4,6 +4,7 @@
<tr> <tr>
<th><%= t("admin.poll_shifts.new.date") %></th> <th><%= t("admin.poll_shifts.new.date") %></th>
<th><%= t("admin.poll_shifts.new.officer") %></th> <th><%= t("admin.poll_shifts.new.officer") %></th>
<th><%= t("admin.poll_shifts.new.task") %></th>
<th class="text-right"><%= t("admin.poll_shifts.new.shift") %></th> <th class="text-right"><%= t("admin.poll_shifts.new.shift") %></th>
</tr> </tr>
</thead> </thead>
@@ -12,6 +13,7 @@
<tr id="shift_<%= shift.id %>" class="shift"> <tr id="shift_<%= shift.id %>" class="shift">
<td><%= l(shift.date.to_date, format: :long) %></td> <td><%= l(shift.date.to_date, format: :long) %></td>
<td><%= shift.officer_name %></td> <td><%= shift.officer_name %></td>
<td><%= t("admin.poll_shifts.#{shift.task}") %></td>
<td class="text-right"> <td class="text-right">
<%= link_to t("admin.poll_shifts.new.remove_shift"), <%= link_to t("admin.poll_shifts.new.remove_shift"),
admin_booth_shift_path(@booth, shift), admin_booth_shift_path(@booth, shift),

View File

@@ -503,6 +503,7 @@ en:
shift: "Assignment" shift: "Assignment"
shifts: "Shifts in this booth" shifts: "Shifts in this booth"
date: "Date" date: "Date"
task: "Task"
edit_shifts: Edit shifts edit_shifts: Edit shifts
new_shift: "New shift" new_shift: "New shift"
no_shifts: "This booth has no shifts" no_shifts: "This booth has no shifts"
@@ -512,12 +513,15 @@ en:
search_officer_placeholder: Search officer search_officer_placeholder: Search officer
search_officer_text: Search for an officer to assign a new shift search_officer_text: Search for an officer to assign a new shift
select_date: "Select day" select_date: "Select day"
select_task: "Select task"
table_shift: "Shift" table_shift: "Shift"
table_email: "Email" table_email: "Email"
table_name: "Name" table_name: "Name"
flash: flash:
create: "Shift added" create: "Shift added"
destroy: "Shift removed" destroy: "Shift removed"
vote_collection: Collect Votes
recount_scrutiny: Recount & Scrutiny
poll_booth_assignments: poll_booth_assignments:
flash: flash:
destroy: "Booth not assigned anymore" destroy: "Booth not assigned anymore"

View File

@@ -503,6 +503,7 @@ es:
shift: "Asignación" shift: "Asignación"
shifts: "Turnos en esta urna" shifts: "Turnos en esta urna"
date: "Fecha" date: "Fecha"
task: "Tarea"
edit_shifts: Asignar turno edit_shifts: Asignar turno
new_shift: "Nuevo turno" new_shift: "Nuevo turno"
no_shifts: "Esta urna no tiene turnos asignados" no_shifts: "Esta urna no tiene turnos asignados"
@@ -512,12 +513,15 @@ es:
search_officer_placeholder: Buscar presidentes de mesa search_officer_placeholder: Buscar presidentes de mesa
search_officer_text: Busca al presidente de mesa para asignar un turno search_officer_text: Busca al presidente de mesa para asignar un turno
select_date: "Seleccionar día" select_date: "Seleccionar día"
select_task: "Seleccionar tarea"
table_shift: "Turno" table_shift: "Turno"
table_email: "Email" table_email: "Email"
table_name: "Nombre" table_name: "Nombre"
flash: flash:
create: "Añadido turno de presidente de mesa" create: "Añadido turno de presidente de mesa"
destroy: "Eliminado turno de presidente de mesa" destroy: "Eliminado turno de presidente de mesa"
vote_collection: Recoger Votos
recount_scrutiny: Recuento & Escrutinio
poll_booth_assignments: poll_booth_assignments:
flash: flash:
destroy: "Urna desasignada" destroy: "Urna desasignada"