stores officer booth on sign in

This commit is contained in:
rgarcia
2017-02-14 03:35:12 +01:00
committed by Javi Martín
parent 5835d12694
commit b4499321d3
14 changed files with 218 additions and 20 deletions

View File

@@ -6,7 +6,29 @@ class Officing::BaseController < ApplicationController
skip_authorization_check
def verify_officer
raise CanCan::AccessDenied unless current_user.try(:poll_officer?)
end
private
def verify_officer
raise CanCan::AccessDenied unless current_user.try(:poll_officer?)
end
def load_officer_assignment
@officer_assignments ||= current_user.poll_officer.
officer_assignments.
voting_days.
where(date: Time.current.to_date)
end
def verify_officer_assignment
if @officer_assignments.blank?
redirect_to officing_root_path, notice: t("officing.residence.flash.not_allowed")
end
end
def verify_booth
if session[:booth_id].blank?
redirect_to new_officing_booth_path
end
end
end