Added check in poll card that allows setting the value of
results_enabled flag.

Access to stats/results now is controlled with abilities.

Polls related to proposals will be accessible to the proposal author
like they were administrators.
This commit is contained in:
Juan Salvador Pérez García
2018-07-13 10:39:49 +02:00
parent 0daaf9e7db
commit f439fc7371
16 changed files with 93 additions and 10 deletions

View File

@@ -34,10 +34,14 @@ class Dashboard::PollsController < Dashboard::BaseController
def update
authorize! :manage_polls, proposal
if poll.update(poll_params)
redirect_to proposal_dashboard_poll_path(proposal, poll), notice: t("flash.actions.update.poll")
else
render :edit
respond_to do |format|
if poll.update(poll_params)
format.html { redirect_to proposal_dashboard_poll_path(proposal, poll), notice: t("flash.actions.update.poll") }
format.json { respond_with_bip(poll) }
else
format.html { render :edit }
format.json { respond_with_bip(poll) }
end
end
end