class Hippo::SystemSettings
Public Class Methods
config()
click to toggle source
# File lib/hippo/system_settings.rb, line 42 def config Tenant.current.system_settings || Tenant.current.create_system_settings end
for_ext(extension_id)
click to toggle source
# File lib/hippo/system_settings.rb, line 50 def for_ext(extension_id) config.for_ext(extension_id) end
get_handler()
click to toggle source
# File lib/hippo/system_settings.rb, line 60 def get_handler Hippo::API::RequestWrapper.with_authenticated_user( role: 'administrator', with_transaction: false ) do |user, req| req.std_api_reply :get, Hippo::SystemSettings.config.as_json( include: ['logo', 'print_logo'] ) end end
persist!(extension_id, update)
click to toggle source
# File lib/hippo/system_settings.rb, line 54 def persist!(extension_id, update) config.settings[extension_id] = update config.settings_will_change! config.save! end
public_json()
click to toggle source
# File lib/hippo/system_settings.rb, line 46 def public_json config.public_json end
update_handler()
click to toggle source
# File lib/hippo/system_settings.rb, line 71 def update_handler Hippo::API::RequestWrapper.with_authenticated_user( role: 'administrator', with_transaction: false ) do |user, req| config = SystemSettings.config if req.data['settings'].is_a?(Hash) config.update_attributes!(settings: req.data['settings']) end req.std_api_reply :update, { settings: config.settings }, success: true end end
Public Instance Methods
for_ext(extension_id)
click to toggle source
# File lib/hippo/system_settings.rb, line 29 def for_ext(extension_id) ExtensionSettings.new(extension_id, settings[extension_id.to_s]) end
notify_updated()
click to toggle source
# File lib/hippo/system_settings.rb, line 25 def notify_updated Hippo.redis_connection.publish('hippo-system-configuration-update', self.id) end
public_json()
click to toggle source
# File lib/hippo/system_settings.rb, line 33 def public_json { 'logo' => Hippo::SystemSettings.config .as_json(include: ['logo']) .dig('logo', 'file_data') } end