Module: CoreSystemConfigurationsController

Includes:
CoreController
Defined in:
lib/app/controllers/concerns/core_system_configuration_controller.rb

Overview

Manage the system configuration page

Instance Method Summary collapse

Instance Method Details

#editObject

Edit the system configuration



12
13
14
# File 'lib/app/controllers/concerns/core_system_configuration_controller.rb', line 12

def edit
  system_configuration
end

#syncObject

This method is abstract.

Cause the system configuration to be synced with the switchboard server



17
18
19
20
21
22
23
24
25
26
# File 'lib/app/controllers/concerns/core_system_configuration_controller.rb', line 17

def sync
  raise 'System Configuration not configured to sync' unless SystemConfiguration.switchboard_configured?

  Cron::SwitchboardSyncConfiguration.perform_later
  flash[:info] = 'System Configuration Refreshing in the Background'
  redirect_to index_path
rescue StandardError => error
  log_controller_error error, true
  redirect_to index_path
end

#updateObject

Update and log the system configuration changes



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/app/controllers/concerns/core_system_configuration_controller.rb', line 31

def update
  system_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
  system_configuration
  render :edit
end