Class: Decidim::Elections::Admin::ProposalsImportsController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- Admin::ApplicationController
- Admin::Components::BaseController
- ApplicationController
- Decidim::Elections::Admin::ProposalsImportsController
- Defined in:
- decidim-elections/app/controllers/decidim/elections/admin/proposals_imports_controller.rb
Overview
This controller allows to import proposals as answers.
Instance Method Summary collapse
Methods inherited from Admin::Components::BaseController
#current_component, #current_participatory_space, #parent_path, #permission_class_chain, #permission_scope, #permissions_context, #set_component_breadcrumb_item, #skip_manage_component_permission
Methods included from RegistersPermissions
Methods inherited from Admin::ApplicationController
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Methods included from Headers::HttpCachingDisabler
Methods included from NeedsSnippets
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'decidim-elections/app/controllers/decidim/elections/admin/proposals_imports_controller.rb', line 15 def create (:import_proposals, :answer, election:, question:) @form = form(Admin::AnswerImportProposalsForm).from_params(params, election:, question:) Admin::ImportProposalsToElections.call(@form) do on(:ok) do |answers| flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.elections.admin", number: answers.length) redirect_to election_question_answers_path(election, question) end on(:invalid) do flash[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.elections.admin") render action: "new" end end end |
#new ⇒ Object
10 11 12 13 |
# File 'decidim-elections/app/controllers/decidim/elections/admin/proposals_imports_controller.rb', line 10 def new (:import_proposals, :answer, election:, question:) @form = form(Admin::AnswerImportProposalsForm).instance end |