Class: Decidim::DirectVerifications::Verification::Admin::ImportsController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Decidim::DirectVerifications::Verification::Admin::ImportsController
- Defined in:
- app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb
Instance Method Summary collapse
- #configured_workflows ⇒ Object
- #create ⇒ Object
- #current_authorization_handler ⇒ Object
- #new ⇒ Object
- #workflows ⇒ Object
Instance Method Details
#configured_workflows ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb', line 42 def configured_workflows return Decidim::DirectVerifications.config.manage_workflows if Decidim::DirectVerifications.config ["direct_verifications"] end |
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb', line 16 def create :create, :authorization defaults = { organization: current_organization, user: current_user } form = form(CreateImportForm).from_params(params.merge(defaults)) CreateImport.call(form) do on(:ok) do flash[:notice] = t(".success") end on(:invalid) do flash[:alert] = t(".error") end end redirect_to new_import_path end |
#current_authorization_handler ⇒ Object
48 49 50 |
# File 'app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb', line 48 def params[:authorization_handler] end |
#new ⇒ Object
11 12 13 14 |
# File 'app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb', line 11 def new :create, :authorization @form = form(CreateImportForm).instance end |
#workflows ⇒ Object
35 36 37 38 39 40 |
# File 'app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb', line 35 def workflows workflows = configured_workflows & current_organization..map.to_a workflows.map do |workflow| [t("#{workflow}.name", scope: "decidim.authorization_handlers"), workflow] end end |