Deleting a booth shift with recounts or partial results.
Show a flash message that it's not possible to delete booth shifts when they have associated recounts or partial results. Before an execption was raised.
This commit is contained in:
@@ -26,9 +26,14 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
||||
|
||||
def destroy
|
||||
@shift = Poll::Shift.find(params[:id])
|
||||
@shift.destroy
|
||||
notice = t("admin.poll_shifts.flash.destroy")
|
||||
redirect_to new_admin_booth_shift_path(@booth), notice: notice
|
||||
if @shift.unable_to_destroy?
|
||||
alert = t("admin.poll_shifts.flash.unable_to_destroy")
|
||||
redirect_to new_admin_booth_shift_path(@booth), alert: alert
|
||||
else
|
||||
@shift.destroy
|
||||
notice = t("admin.poll_shifts.flash.destroy")
|
||||
redirect_to new_admin_booth_shift_path(@booth), notice: notice
|
||||
end
|
||||
end
|
||||
|
||||
def search_officers
|
||||
|
||||
Reference in New Issue
Block a user