Sha256: 12744eaa95b386cb545028fcddb94860d07e9903a34af0c979370cc480bfd085

Contents?: true

Size: 1.23 KB

Versions: 49

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

#
# Manage the system configuration page
#
module CoreSystemConfigurationsController
  include CoreController

  #
  # Edit the system configuration
  #
  def edit
    load_configuration
  end

  #
  # Update and log the system configuration changes
  #
  def update
    # @system_configuration.update_attributes_and_log! @current_admin_user, system_configuration_params
    SystemConfiguration.configuration.update! system_configuration_params
    if SystemConfiguration.switchboard_configured?
      flash[:info] = 'System Configuration Updated, sync job running in the background'
      Cron::SwitchboardSyncConfiguration.perform_later
    else
      flash[:info] = 'System Configuration Updated'
    end
    redirect_to index_path
  rescue StandardError => error
    log_controller_error error
    load_configuration
    render :edit
  end

  private

  #
  # Get the system configuration properties from the request
  #
  def system_configuration_params
    params[:system_configuration].permit(%i[switchboard_base_url switchboard_stack_id switchboard_stack_api_token])
  end

  #
  # Load the current system configuration
  #
  def load_configuration
    @system_configuration = SystemConfiguration.configuration
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
web47core-2.2.15 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-3.0.4 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-3.0.3 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-3.0.1 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-3.0.0 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.16 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.15 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.14 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.13 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.12 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.11 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-2.0.1 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-2.0.0 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.10 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.9 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.8 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.7 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.6 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.5 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-1.1.4 lib/app/controllers/concerns/core_system_configuration_controller.rb