Sha256: db84bd291934ab4e697e6980e44b74f66f2d0e6221df4e56719f0372f5f79e0e

Contents?: true

Size: 1.17 KB

Versions: 61

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Decidim
  module Verifications
    module IdDocuments
      module Admin
        #
        # Handles the configuration for the ID documents verification
        #
        class ConfigController < Decidim::Admin::ApplicationController
          layout "decidim/admin/users"

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

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

          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
        end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
decidim-verifications-0.16.0 app/controllers/decidim/verifications/id_documents/admin/config_controller.rb