Add button to delete a poll
This commit is contained in:
@@ -58,6 +58,16 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
@polls = Poll.current
|
||||
end
|
||||
|
||||
def destroy
|
||||
if ::Poll::Voter.where(poll: @poll).any?
|
||||
redirect_to admin_poll_path(@poll), alert: t("admin.polls.destroy.unable_notice")
|
||||
else
|
||||
@poll.destroy
|
||||
|
||||
redirect_to admin_polls_path, notice: t("admin.polls.destroy.success_notice")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_geozones
|
||||
|
||||
Reference in New Issue
Block a user