Displays officing booth in layout

This commit is contained in:
rgarcia
2017-02-15 18:22:02 +01:00
committed by Javi Martín
parent 9c59c8b68e
commit 4761ac91bd
9 changed files with 19 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
class Officing::BaseController < ApplicationController
layout "admin"
helper_method :current_booth
before_action :authenticate_user!
before_action :verify_officer

View File

@@ -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

View 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 %>

View File

@@ -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>

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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)