Sha256: cdcc1c5cb882575b00c6a1a9e93f9f10a3607c136ddcca87dd428411d64092f0

Contents?: true

Size: 1.22 KB

Versions: 12

Compression:

Stored size: 1.22 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, current_user) 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

12 entries across 12 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.8 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.7 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.6 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.5 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.4 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.3 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.0 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.0.rc2 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb
decidim-admin-0.27.0.rc1 app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb