Sha256: 613d4583b40f7756ea32ddc88abf2c52c132d5d4c49c9f755bd7015c5c1ec918

Contents?: true

Size: 1.11 KB

Versions: 28

Compression:

Stored size: 1.11 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
    flash[:info] = 'System Configuration Updated, sync job running in the background'
    Cron::SwitchboardSyncConfiguration.perform_later
    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

28 entries across 28 versions & 1 rubygems

Version Path
web47core-0.8.2 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.8.1 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.8.0 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.7 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.6 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.4 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.3 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.2 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.1 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.7.0 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.6.3 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.6.2 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.6.1 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.6.0 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.5.5 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.5.4 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.5.3 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.5.2 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.4.5 lib/app/controllers/concerns/core_system_configuration_controller.rb
web47core-0.4.4 lib/app/controllers/concerns/core_system_configuration_controller.rb