Class: Decidim::Lausanne::Budgets::Admin::ProposalsImportsController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Lausanne::Budgets::Admin::ProposalsImportsController
- Defined in:
- app/controllers/decidim/lausanne/budgets/admin/proposals_imports_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/lausanne/budgets/admin/proposals_imports_controller.rb', line 17 def create :import_proposals, :projects @form = form(Admin::ProjectImportProposalsForm).from_params(params, budget: budget) Admin::ImportProposalsToBudgets.call(@form) do on(:ok) do |projects| flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.lausanne_budgets.admin", number: projects.length) redirect_to lausanne_budget_projects_path(lausanne_budget: budget) end on(:invalid) do flash[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.lausanne_budgets.admin") render action: "new" end end end |
#new ⇒ Object
10 11 12 13 14 15 |
# File 'app/controllers/decidim/lausanne/budgets/admin/proposals_imports_controller.rb', line 10 def new :import_proposals, :projects @form = form(Admin::ProjectImportProposalsForm).instance @form.context.budget = budget end |