Class: Decidim::Budgets::Admin::ProposalsImportsController
Instance Method Summary
collapse
#maps_enabled?, #project, #projects
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/decidim/budgets/admin/proposals_imports_controller.rb', line 15
def create
enforce_permission_to :import_proposals, :projects
@form = form(Admin::ProjectImportProposalsForm).from_params(params, budget:)
Admin::ImportProposalsToBudgets.call(@form) do
on(:ok) do |projects|
flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.budgets.admin", number: projects.length)
redirect_to budget_projects_path(budget)
end
on(:invalid) do
flash[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.budgets.admin")
render action: "new"
end
end
end
|
#new ⇒ Object
9
10
11
12
13
|
# File 'app/controllers/decidim/budgets/admin/proposals_imports_controller.rb', line 9
def new
enforce_permission_to :import_proposals, :projects
@form = form(Admin::ProjectImportProposalsForm).instance
end
|