Merge pull request #3344 from consul/backport-budget_ballots
Allow voting Budget Investments in booths
This commit is contained in:
@@ -7,7 +7,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
before_action :load_geozones, only: [:new, :create, :edit, :update]
|
||||
|
||||
def index
|
||||
@polls = Poll.order(starts_at: :desc)
|
||||
@polls = Poll.not_budget.order(starts_at: :desc)
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -22,7 +22,12 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
def create
|
||||
@poll = Poll.new(poll_params.merge(author: current_user))
|
||||
if @poll.save
|
||||
redirect_to [:admin, @poll], notice: t("flash.actions.create.poll")
|
||||
notice = t("flash.actions.create.poll")
|
||||
if @poll.budget.present?
|
||||
redirect_to admin_poll_booth_assignments_path(@poll), notice: notice
|
||||
else
|
||||
redirect_to [:admin, @poll], notice: notice
|
||||
end
|
||||
else
|
||||
render :new
|
||||
end
|
||||
@@ -63,7 +68,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
|
||||
def poll_params
|
||||
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled,
|
||||
:stats_enabled, geozone_ids: [],
|
||||
:stats_enabled, :budget_id, geozone_ids: [],
|
||||
image_attributes: image_attributes]
|
||||
params.require(:poll).permit(*attributes, translation_params(Poll))
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
load_and_authorize_resource :question, class: "Poll::Question"
|
||||
|
||||
def index
|
||||
@polls = Poll.all
|
||||
@polls = Poll.not_budget
|
||||
@search = search_params[:search]
|
||||
|
||||
@questions = @questions.search(search_params).page(params[:page]).order("created_at DESC")
|
||||
|
||||
@@ -11,7 +11,7 @@ class PollsController < ApplicationController
|
||||
::Poll::Answer # trigger autoload
|
||||
|
||||
def index
|
||||
@polls = @polls.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
||||
@polls = @polls.not_budget.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
Reference in New Issue
Block a user