Module: ActiveadminSettings

Defined in:
lib/activeadmin-settings.rb,
lib/activeadmin-settings/engine.rb,
lib/activeadmin-settings/helper.rb,
lib/activeadmin-settings/version.rb,
app/models/activeadmin_settings/picture.rb,
app/models/activeadmin_settings/setting.rb,
lib/generators/activeadmin_settings/install_generator.rb

Defined Under Namespace

Modules: Generators, Helpers, PictureMethods, SettingMethods Classes: AdminUsersController, Engine, Picture, PicturesController, RedactorPictureUploader, Setting, SettingsController, SettingsFileUploader

Constant Summary collapse

IMAGE_TYPES =
[ 'image/jpeg',
'image/png',
'image/gif',
'image/jpg',
'image/pjpeg',
'image/tiff',
'image/x-png' ]
VERSION =
"0.4.4"
@@image_file_types =
["jpg", "jpeg", "png", "gif", "tiff"]
@@config_file =
"config/activeadmin_settings.yml"

Class Method Summary collapse

Class Method Details

.all_settingsObject



38
39
40
41
42
43
44
# File 'lib/activeadmin-settings.rb', line 38

def self.all_settings
  @all_settings = {}
  load_config.each do |key, settings|
    @all_settings.merge!(settings)
  end
  @all_settings
end

.groupsObject



46
47
48
49
50
51
52
53
54
55
# File 'lib/activeadmin-settings.rb', line 46

def self.groups
  @groups = []
  load_config.each do |key, settings|
    @groups << {:name     => key,
                :slug     => key.downcase.gsub(" ", "_"),
                :default_settings => settings,
                :settings => [] }
  end
  @groups
end

.load_configObject

Load configuration from config/activeadmin_settings.yml



27
28
29
30
31
32
33
34
35
36
# File 'lib/activeadmin-settings.rb', line 27

def self.load_config
  config_file = ::Rails.root.join(@@config_file)
  @load_config = {}

  if File.exists?(config_file)
    data = YAML::load(ERB.new(IO.read(config_file)).result)
    @load_config = data if data
  end
  @load_config
end

.table_name_prefixObject



4
5
6
# File 'lib/activeadmin-settings.rb', line 4

def self.table_name_prefix
  'activeadmin_settings_'
end