Sha256: d41a529858b4596eb65e7ff736e4a2905fab6c9ea7cb0d70cd53919fda192b5d

Contents?: true

Size: 1.21 KB

Versions: 19

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    class OrganizationExternalDomainWhitelistController < Decidim::Admin::ApplicationController
      layout "decidim/admin/settings"

      helper_method :blank_external_domain

      def edit
        enforce_permission_to :update, :organization, organization: current_organization
        @form = form(OrganizationExternalDomainWhitelistForm).from_model(current_organization)
      end

      def update
        enforce_permission_to :update, :organization, organization: current_organization
        @form = form(OrganizationExternalDomainWhitelistForm).from_params(params)

        UpdateExternalDomainWhitelist.call(@form, current_organization) do
          on(:ok) do
            flash[:notice] = t("domain_whitelist.update.success", scope: "decidim.admin")
            redirect_to edit_organization_external_domain_whitelist_path
          end
          on(:invalid) do
            flash[:notice] = t("domain_whitelist.update.error", scope: "decidim.admin")
            render action: "edit"
          end
        end
      end

      private

      def blank_external_domain
        @blank_external_domain ||= Admin::ExternalDomainForm.new
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-admin-0.26.10 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.9 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.8 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.7 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.5 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.4 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.3 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.0 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.0.rc2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.26.0.rc1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.0 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.0.rc4 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.0.rc3 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.0.rc2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.25.0.rc1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb