Clean up
This commit is contained in:
@@ -7,11 +7,12 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
has_orders %w{oldest}, only: [:show, :edit]
|
||||
has_filters(%w{all without_admin without_valuator under_valuation
|
||||
valuation_finished winners},
|
||||
only: [:index, :toggle_selection])
|
||||
only: [:index, :toggle_selection])
|
||||
|
||||
before_action :load_budget
|
||||
before_action :load_investment, only: [:show, :edit, :update, :toggle_selection]
|
||||
before_action :load_ballot, only: [:show, :index]
|
||||
before_action :parse_valuation_filters
|
||||
before_action :load_investments, only: [:index, :toggle_selection]
|
||||
|
||||
def index
|
||||
@@ -46,6 +47,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
else
|
||||
load_admins
|
||||
load_valuators
|
||||
load_valuator_groups
|
||||
load_tags
|
||||
render :edit
|
||||
end
|
||||
@@ -131,4 +133,16 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
||||
params[:budget_investment] = params[:budget_investment].except(:valuation_tag_list)
|
||||
end
|
||||
|
||||
def parse_valuation_filters
|
||||
if params[:valuator_or_group_id]
|
||||
model, id = params[:valuator_or_group_id].split("_")
|
||||
|
||||
if model == "group"
|
||||
params[:valuator_group_id] = id
|
||||
else
|
||||
params[:valuator_id] = id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -19,8 +19,8 @@ class Admin::ValuatorGroupsController < Admin::BaseController
|
||||
def create
|
||||
@group = ValuatorGroup.new(group_params)
|
||||
if @group.save
|
||||
notice = t("user_group.notice.created")
|
||||
redirect_to admin_valuator_groups_path, notice: notice
|
||||
notice = t("flash.actions.create.valuator_group")
|
||||
redirect_to [:admin, :valuator_groups], notice: notice
|
||||
else
|
||||
render :new
|
||||
end
|
||||
@@ -29,7 +29,7 @@ class Admin::ValuatorGroupsController < Admin::BaseController
|
||||
def update
|
||||
@group = ValuatorGroup.find(params[:id])
|
||||
if @group.update(group_params)
|
||||
notice = t("user_group.notice.updated")
|
||||
notice = t("flash.actions.update.valuator_group")
|
||||
redirect_to [:admin, @group], notice: notice
|
||||
else
|
||||
render :edit
|
||||
@@ -39,8 +39,8 @@ class Admin::ValuatorGroupsController < Admin::BaseController
|
||||
def destroy
|
||||
@group = ValuatorGroup.find(params[:id])
|
||||
@group.destroy
|
||||
notice = t("user_group.notice.destroyed")
|
||||
redirect_to admin_valuator_groups_path, notice: notice
|
||||
notice = t("flash.actions.destroy.valuator_group")
|
||||
redirect_to [:admin, :valuator_groups], notice: notice
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user