Class: RailsAdminSettings::Setting
Instance Method Summary
collapse
included
Methods included from Validation
included
Methods included from Uploads
included
Methods included from Processing
#blank?, #html_kind?, #text_kind?, #to_s, #upload_kind?, #value
Instance Method Details
#as_yaml(options = {}) ⇒ Object
56
57
58
59
60
61
62
63
64
65
|
# File 'app/models/rails_admin_settings/setting.rb', line 56
def as_yaml(options = {})
v = {type: type, enabled: enabled, label: label}
if upload_type?
v[:value] = to_path
else
v[:value] = raw
end
v.stringify_keys!
v
end
|
#disabled? ⇒ Boolean
32
33
34
|
# File 'app/models/rails_admin_settings/setting.rb', line 32
def disabled?
!enabled
end
|
#enabled? ⇒ Boolean
36
37
38
|
# File 'app/models/rails_admin_settings/setting.rb', line 36
def enabled?
enabled
end
|
#name ⇒ Object
40
41
42
|
# File 'app/models/rails_admin_settings/setting.rb', line 40
def name
label.blank? ? key : label
end
|
#to_path ⇒ Object
48
49
50
51
52
53
54
|
# File 'app/models/rails_admin_settings/setting.rb', line 48
def to_path
if value.nil?
nil
else
'public' + URI.parse(value).path
end
end
|
#type ⇒ Object
44
45
46
|
# File 'app/models/rails_admin_settings/setting.rb', line 44
def type
kind
end
|