Displays officing booth in layout
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class Officing::BaseController < ApplicationController
|
||||
layout "admin"
|
||||
helper_method :current_booth
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :verify_officer
|
||||
|
||||
@@ -7,14 +7,14 @@ class Officing::BoothController < Officing::BaseController
|
||||
|
||||
if only_one_booth?
|
||||
set_booth(@booths.first)
|
||||
redirect_to officing_root_path, notice: t("officing.booth.new.success", booth: @booths.first.location)
|
||||
redirect_to officing_root_path
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
find_booth
|
||||
set_booth(@booth)
|
||||
redirect_to officing_root_path, notice: t("officing.booth.new.success", booth: @booth.location)
|
||||
redirect_to officing_root_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
5
app/views/layouts/_officing_booth.html.erb
Normal file
5
app/views/layouts/_officing_booth.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<% if current_user.poll_officer? %>
|
||||
<div id="officing-booth" class="callout info">
|
||||
<%= t("admin.officing_booth.title", booth: current_booth.try(:location)) %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
<div class="admin-content small-12 medium-9 column" data-equalizer-watch>
|
||||
<%= render "layouts/flash" %>
|
||||
<%= render "layouts/officing_booth" %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,8 @@ en:
|
||||
edit: Edit
|
||||
configure: Configure
|
||||
delete: Delete
|
||||
officing_booth:
|
||||
title: "You are officing the booth located at %{booth}. If this is not correct, do not continue and call the help phone number. Thank you."
|
||||
banners:
|
||||
index:
|
||||
title: Banners
|
||||
|
||||
@@ -19,7 +19,6 @@ en:
|
||||
booth:
|
||||
new:
|
||||
title: "Choose your booth"
|
||||
success: "You are officing the booth located at %{booth}. If this is not correct, do not continue and call the help phone number. Thank you."
|
||||
results:
|
||||
flash:
|
||||
create: "Results saved"
|
||||
|
||||
@@ -14,6 +14,8 @@ es:
|
||||
edit: Editar
|
||||
configure: Configurar
|
||||
delete: Borrar
|
||||
officing_booth:
|
||||
title: "Estás ahora mismo en la mesa ubicada en %{booth}. Si esto no es correcto no sigas adelante y llama al teléfono de incidencias. Gracias."
|
||||
banners:
|
||||
index:
|
||||
title: Banners
|
||||
|
||||
@@ -19,7 +19,6 @@ es:
|
||||
booth:
|
||||
new:
|
||||
title: "Escoge tu urna"
|
||||
success: "Estás ahora mismo en la mesa ubicada en %{booth}. Si esto no es correcto no sigas adelante y llama al teléfono de incidencias. Gracias."
|
||||
results:
|
||||
flash:
|
||||
create: "Datos guardados"
|
||||
|
||||
@@ -30,8 +30,10 @@ feature "Booth" do
|
||||
|
||||
login_through_form_as(officer.user)
|
||||
|
||||
within("#officing-booth") do
|
||||
expect(page).to have_content "You are officing the booth located at #{booth.location}."
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Officer with multiple booth assignments today" do
|
||||
officer = create(:poll_officer)
|
||||
@@ -54,8 +56,10 @@ feature "Booth" do
|
||||
select booth2.location, from: "booth_id"
|
||||
click_button "Enter"
|
||||
|
||||
within("#officing-booth") do
|
||||
expect(page).to have_content "You are officing the booth located at #{booth2.location}."
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Display single booth for any number of polls" do
|
||||
officer = create(:poll_officer)
|
||||
|
||||
Reference in New Issue
Block a user