Displays officing booth in layout
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
class Officing::BaseController < ApplicationController
|
class Officing::BaseController < ApplicationController
|
||||||
layout "admin"
|
layout "admin"
|
||||||
|
helper_method :current_booth
|
||||||
|
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :verify_officer
|
before_action :verify_officer
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ class Officing::BoothController < Officing::BaseController
|
|||||||
|
|
||||||
if only_one_booth?
|
if only_one_booth?
|
||||||
set_booth(@booths.first)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
find_booth
|
find_booth
|
||||||
set_booth(@booth)
|
set_booth(@booth)
|
||||||
redirect_to officing_root_path, notice: t("officing.booth.new.success", booth: @booth.location)
|
redirect_to officing_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
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>
|
<div class="admin-content small-12 medium-9 column" data-equalizer-watch>
|
||||||
<%= render "layouts/flash" %>
|
<%= render "layouts/flash" %>
|
||||||
|
<%= render "layouts/officing_booth" %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ en:
|
|||||||
edit: Edit
|
edit: Edit
|
||||||
configure: Configure
|
configure: Configure
|
||||||
delete: Delete
|
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:
|
banners:
|
||||||
index:
|
index:
|
||||||
title: Banners
|
title: Banners
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ en:
|
|||||||
booth:
|
booth:
|
||||||
new:
|
new:
|
||||||
title: "Choose your booth"
|
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:
|
results:
|
||||||
flash:
|
flash:
|
||||||
create: "Results saved"
|
create: "Results saved"
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ es:
|
|||||||
edit: Editar
|
edit: Editar
|
||||||
configure: Configurar
|
configure: Configurar
|
||||||
delete: Borrar
|
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:
|
banners:
|
||||||
index:
|
index:
|
||||||
title: Banners
|
title: Banners
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ es:
|
|||||||
booth:
|
booth:
|
||||||
new:
|
new:
|
||||||
title: "Escoge tu urna"
|
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:
|
results:
|
||||||
flash:
|
flash:
|
||||||
create: "Datos guardados"
|
create: "Datos guardados"
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ feature "Booth" do
|
|||||||
|
|
||||||
login_through_form_as(officer.user)
|
login_through_form_as(officer.user)
|
||||||
|
|
||||||
expect(page).to have_content "You are officing the booth located at #{booth.location}."
|
within("#officing-booth") do
|
||||||
|
expect(page).to have_content "You are officing the booth located at #{booth.location}."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Officer with multiple booth assignments today" do
|
scenario "Officer with multiple booth assignments today" do
|
||||||
@@ -54,7 +56,9 @@ feature "Booth" do
|
|||||||
select booth2.location, from: "booth_id"
|
select booth2.location, from: "booth_id"
|
||||||
click_button "Enter"
|
click_button "Enter"
|
||||||
|
|
||||||
expect(page).to have_content "You are officing the booth located at #{booth2.location}."
|
within("#officing-booth") do
|
||||||
|
expect(page).to have_content "You are officing the booth located at #{booth2.location}."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Display single booth for any number of polls" do
|
scenario "Display single booth for any number of polls" do
|
||||||
|
|||||||
Reference in New Issue
Block a user