Class: Decidim::Verifications::IdDocuments::Admin::ConfigController

Inherits:
Admin::ApplicationController
  • Object
show all
Includes:
Admin::WorkflowsBreadcrumb
Defined in:
app/controllers/decidim/verifications/id_documents/admin/config_controller.rb

Overview

Handles the configuration for the ID documents verification

Instance Method Summary collapse

Instance Method Details

#editObject



17
18
19
20
21
# File 'app/controllers/decidim/verifications/id_documents/admin/config_controller.rb', line 17

def edit
  enforce_permission_to :update, :organization, organization: current_organization

  @form = form(ConfigForm).from_model(current_organization)
end

#updateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/decidim/verifications/id_documents/admin/config_controller.rb', line 23

def update
  enforce_permission_to :update, :organization, organization: current_organization

  @form = form(ConfigForm).from_params(params)

  UpdateConfig.call(@form) do
    on(:ok) do
      flash[:notice] = t("config.update.success", scope: "decidim.verifications.id_documents.admin")
      redirect_to pending_authorizations_path
    end

    on(:invalid) do
      flash.now[:alert] = t("config.update.error", scope: "decidim.verifications.id_documents.admin")
      render action: :edit
    end
  end
end