rails_admin_settings 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -1
- data/app/views/rails_admin/main/_setting_value.html.haml +21 -21
- data/config/locales/en.rails_admin_settings.yml +1 -1
- data/lib/rails_admin_settings/engine.rb +13 -13
- data/lib/rails_admin_settings/hex_color_validator.rb +11 -11
- data/lib/rails_admin_settings/processing.rb +120 -120
- data/lib/rails_admin_settings/rails_admin_config.rb +53 -53
- data/lib/rails_admin_settings/require_helpers.rb +66 -66
- data/lib/rails_admin_settings/settings.rb +176 -176
- data/lib/rails_admin_settings/storage/carrierwave.rb +8 -8
- data/lib/rails_admin_settings/types.rb +4 -4
- data/lib/rails_admin_settings/uploads.rb +30 -29
- data/lib/rails_admin_settings/validation.rb +72 -72
- data/lib/rails_admin_settings/version.rb +1 -1
- data/spec/advanced_usage_spec.rb +10 -10
- data/spec/database_trickery_spec.rb +50 -50
- data/spec/factories/setting.rb +8 -8
- data/spec/model_spec.rb +44 -44
- data/spec/types_spec.rb +62 -62
- metadata +11 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 66ba2afcaf621ca4720db9bff8c52aa997790d7e
|
4
|
+
data.tar.gz: 89e895d2dcd841405111ca542ec7552aa79917d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f004401b57d40d96ad953855d9b3ca41ddb59de9781ddc4aaff517d35b898c59c29244b862e87541d362ae8ba9c0517177d558e53a35e80b444a5b79cab564a2
|
7
|
+
data.tar.gz: 2628bd81d95ec2ebc169e33f7016ecfb508b2217914449a779a1de6770b15577900386f66e91e5d7633285f5285057a047687c2d8b95913e743142b0f9925bdc
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0-p195
|
@@ -1,22 +1,22 @@
|
|
1
|
-
- if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
|
2
|
-
= form.text_field :raw, :value => field.value
|
3
|
-
- if @object.type == 'color'
|
4
|
-
= form.text_field :raw, :value => field.value, 'data-color' => true
|
5
|
-
- elsif @object.type == 'text' || @object.type == 'yaml'
|
6
|
-
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
7
|
-
- elsif @object.type == 'html'
|
8
|
-
- if form.respond_to?(:cktext_area)
|
9
|
-
= javascript_include_tag "ckeditor/init"
|
10
|
-
= form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
|
11
|
-
- elsif Object.const_defined?('Rich')
|
12
|
-
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
13
|
-
|
14
|
-
= javascript_include_tag "rich/base.js"
|
15
|
-
:javascript
|
16
|
-
var instance = CKEDITOR.instances['#{form.dom_id(field)}'];
|
17
|
-
if(instance) { CKEDITOR.remove(instance); }
|
18
|
-
CKEDITOR.replace('#{form.dom_id(field)}', #{Rich.options().to_json.html_safe});
|
19
|
-
- else
|
20
|
-
.alert.alert-error
|
21
|
-
= t('admin.settings.no_ckeditor_detected')
|
1
|
+
- if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
|
2
|
+
= form.text_field :raw, :value => field.value
|
3
|
+
- if @object.type == 'color'
|
4
|
+
= form.text_field :raw, :value => field.value, 'data-color' => true
|
5
|
+
- elsif @object.type == 'text' || @object.type == 'yaml'
|
6
|
+
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
7
|
+
- elsif @object.type == 'html'
|
8
|
+
- if form.respond_to?(:cktext_area)
|
9
|
+
= javascript_include_tag "ckeditor/init"
|
10
|
+
= form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
|
11
|
+
- elsif Object.const_defined?('Rich')
|
12
|
+
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
13
|
+
|
14
|
+
= javascript_include_tag "rich/base.js"
|
15
|
+
:javascript
|
16
|
+
var instance = CKEDITOR.instances['#{form.dom_id(field)}'];
|
17
|
+
if(instance) { CKEDITOR.remove(instance); }
|
18
|
+
CKEDITOR.replace('#{form.dom_id(field)}', #{Rich.options().to_json.html_safe});
|
19
|
+
- else
|
20
|
+
.alert.alert-error
|
21
|
+
= t('admin.settings.no_ckeditor_detected')
|
22
22
|
= form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module RailsAdminSettings
|
2
|
-
class Engine < ::Rails::Engine
|
3
|
-
initializer 'RailsAdminSettings Install after_filter' do |app|
|
4
|
-
require File.dirname(__FILE__) + '/../../app/models/rails_admin_settings/setting.rb'
|
5
|
-
|
6
|
-
if defined?(ActionController) and defined?(ActionController::Base)
|
7
|
-
ActionController::Base.class_eval do
|
8
|
-
after_filter { Settings.unload! }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
module RailsAdminSettings
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
initializer 'RailsAdminSettings Install after_filter' do |app|
|
4
|
+
require File.dirname(__FILE__) + '/../../app/models/rails_admin_settings/setting.rb'
|
5
|
+
|
6
|
+
if defined?(ActionController) and defined?(ActionController::Base)
|
7
|
+
ActionController::Base.class_eval do
|
8
|
+
after_filter { Settings.unload! }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module RailsAdminSettings
|
2
|
-
class HexColorValidator < ActiveModel::EachValidator
|
3
|
-
def validate_each(record, attribute, value)
|
4
|
-
record.errors[attribute] << (options[:message] || I18n.t('admin.settings.invalid_color')) unless value.blank? || self.class.matches?(value)
|
5
|
-
end
|
6
|
-
def self.matches?(value)
|
7
|
-
return false unless value
|
8
|
-
/^(?:[0-9a-f]{3})(?:[0-9a-f]{3})?$/i.match(value).nil? ? false : true
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module RailsAdminSettings
|
2
|
+
class HexColorValidator < ActiveModel::EachValidator
|
3
|
+
def validate_each(record, attribute, value)
|
4
|
+
record.errors[attribute] << (options[:message] || I18n.t('admin.settings.invalid_color')) unless value.blank? || self.class.matches?(value)
|
5
|
+
end
|
6
|
+
def self.matches?(value)
|
7
|
+
return false unless value
|
8
|
+
/^(?:[0-9a-f]{3})(?:[0-9a-f]{3})?$/i.match(value).nil? ? false : true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,120 +1,120 @@
|
|
1
|
-
module RailsAdminSettings
|
2
|
-
module Processing
|
3
|
-
RailsAdminSettings.types.each do |dtype|
|
4
|
-
define_method "#{dtype}_type?" do
|
5
|
-
dtype == type
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def text_type?
|
10
|
-
(RailsAdminSettings.types - ['phone', 'integer', 'yaml']).include? type
|
11
|
-
end
|
12
|
-
|
13
|
-
def html_type?
|
14
|
-
['html', 'sanitized'].include? type
|
15
|
-
end
|
16
|
-
|
17
|
-
def value
|
18
|
-
if file_type?
|
19
|
-
file.url
|
20
|
-
elsif raw.blank? || disabled?
|
21
|
-
default_value
|
22
|
-
else
|
23
|
-
processed_value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def blank?
|
28
|
-
if file_type?
|
29
|
-
file.url.nil?
|
30
|
-
elsif raw.blank? || disabled?
|
31
|
-
true
|
32
|
-
else
|
33
|
-
false
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_s
|
38
|
-
if yaml_type? || phone_type? || integer_type?
|
39
|
-
raw
|
40
|
-
else
|
41
|
-
value
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def sanitize_value
|
48
|
-
require_sanitize do
|
49
|
-
self.raw = Sanitize.clean(value, Sanitize::Config::RELAXED)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def default_value
|
54
|
-
if html_type?
|
55
|
-
''.html_safe
|
56
|
-
elsif text_type?
|
57
|
-
''
|
58
|
-
elsif integer_type?
|
59
|
-
0
|
60
|
-
elsif yaml_type?
|
61
|
-
nil
|
62
|
-
elsif phone_type?
|
63
|
-
require_russian_phone do
|
64
|
-
RussianPhone::Number.new('')
|
65
|
-
end
|
66
|
-
else
|
67
|
-
nil
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def process_text
|
72
|
-
text = raw.dup
|
73
|
-
text.gsub!('{{year}}', Time.now.strftime('%Y'))
|
74
|
-
text.gsub! /\{\{year\|([\d]{4})\}\}/ do
|
75
|
-
if Time.now.strftime('%Y') == $1
|
76
|
-
$1
|
77
|
-
else
|
78
|
-
"#{$1}-#{Time.now.strftime('%Y')}"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
text = text.html_safe if html_type?
|
82
|
-
text
|
83
|
-
end
|
84
|
-
|
85
|
-
def load_phone
|
86
|
-
require_russian_phone do
|
87
|
-
RussianPhone::Number.new(raw)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def load_yaml
|
92
|
-
require_safe_yaml do
|
93
|
-
YAML.safe_load(raw)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def processed_value
|
98
|
-
if text_type?
|
99
|
-
process_text
|
100
|
-
elsif integer_type?
|
101
|
-
raw.to_i
|
102
|
-
elsif yaml_type?
|
103
|
-
load_yaml
|
104
|
-
elsif phone_type?
|
105
|
-
load_phone
|
106
|
-
elsif file_type?
|
107
|
-
file.url
|
108
|
-
else
|
109
|
-
puts "[rails_admin_settings] Unknown field type: #{type}"
|
110
|
-
nil
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.included(base)
|
115
|
-
base.class_eval do
|
116
|
-
alias_method :val, :value
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
1
|
+
module RailsAdminSettings
|
2
|
+
module Processing
|
3
|
+
RailsAdminSettings.types.each do |dtype|
|
4
|
+
define_method "#{dtype}_type?" do
|
5
|
+
dtype == type
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def text_type?
|
10
|
+
(RailsAdminSettings.types - ['phone', 'integer', 'yaml']).include? type
|
11
|
+
end
|
12
|
+
|
13
|
+
def html_type?
|
14
|
+
['html', 'sanitized'].include? type
|
15
|
+
end
|
16
|
+
|
17
|
+
def value
|
18
|
+
if file_type?
|
19
|
+
file.url
|
20
|
+
elsif raw.blank? || disabled?
|
21
|
+
default_value
|
22
|
+
else
|
23
|
+
processed_value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def blank?
|
28
|
+
if file_type?
|
29
|
+
file.url.nil?
|
30
|
+
elsif raw.blank? || disabled?
|
31
|
+
true
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
if yaml_type? || phone_type? || integer_type?
|
39
|
+
raw
|
40
|
+
else
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def sanitize_value
|
48
|
+
require_sanitize do
|
49
|
+
self.raw = Sanitize.clean(value, Sanitize::Config::RELAXED)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_value
|
54
|
+
if html_type?
|
55
|
+
''.html_safe
|
56
|
+
elsif text_type?
|
57
|
+
''
|
58
|
+
elsif integer_type?
|
59
|
+
0
|
60
|
+
elsif yaml_type?
|
61
|
+
nil
|
62
|
+
elsif phone_type?
|
63
|
+
require_russian_phone do
|
64
|
+
RussianPhone::Number.new('')
|
65
|
+
end
|
66
|
+
else
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def process_text
|
72
|
+
text = raw.dup
|
73
|
+
text.gsub!('{{year}}', Time.now.strftime('%Y'))
|
74
|
+
text.gsub! /\{\{year\|([\d]{4})\}\}/ do
|
75
|
+
if Time.now.strftime('%Y') == $1
|
76
|
+
$1
|
77
|
+
else
|
78
|
+
"#{$1}-#{Time.now.strftime('%Y')}"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
text = text.html_safe if html_type?
|
82
|
+
text
|
83
|
+
end
|
84
|
+
|
85
|
+
def load_phone
|
86
|
+
require_russian_phone do
|
87
|
+
RussianPhone::Number.new(raw)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def load_yaml
|
92
|
+
require_safe_yaml do
|
93
|
+
YAML.safe_load(raw)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def processed_value
|
98
|
+
if text_type?
|
99
|
+
process_text
|
100
|
+
elsif integer_type?
|
101
|
+
raw.to_i
|
102
|
+
elsif yaml_type?
|
103
|
+
load_yaml
|
104
|
+
elsif phone_type?
|
105
|
+
load_phone
|
106
|
+
elsif file_type?
|
107
|
+
file.url
|
108
|
+
else
|
109
|
+
puts "[rails_admin_settings] Unknown field type: #{type}"
|
110
|
+
nil
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.included(base)
|
115
|
+
base.class_eval do
|
116
|
+
alias_method :val, :value
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
module RailsAdminSettings
|
2
|
-
module RailsAdminConfig
|
3
|
-
def self.included(base)
|
4
|
-
if base.respond_to?(:rails_admin)
|
5
|
-
base.rails_admin do
|
6
|
-
navigation_label I18n.t('admin.settings.label')
|
7
|
-
|
8
|
-
object_label_method do
|
9
|
-
:label
|
10
|
-
end
|
11
|
-
|
12
|
-
list do
|
13
|
-
if Object.const_defined?('RailsAdminToggleable')
|
14
|
-
field :enabled, :toggle
|
15
|
-
else
|
16
|
-
field :enabled
|
17
|
-
end
|
18
|
-
field :label
|
19
|
-
field :raw
|
20
|
-
field :type
|
21
|
-
end
|
22
|
-
|
23
|
-
edit do
|
24
|
-
field :enabled
|
25
|
-
field :label do
|
26
|
-
read_only true
|
27
|
-
help false
|
28
|
-
end
|
29
|
-
field :type do
|
30
|
-
read_only true
|
31
|
-
help false
|
32
|
-
end
|
33
|
-
field :raw do
|
34
|
-
partial "setting_value"
|
35
|
-
visible do
|
36
|
-
!bindings[:object].file_type?
|
37
|
-
end
|
38
|
-
end
|
39
|
-
if Settings.file_uploads_supported
|
40
|
-
field :file, Settings.file_uploads_engine do
|
41
|
-
visible do
|
42
|
-
bindings[:object].file_type?
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
else
|
49
|
-
puts "[rails_admin_settings] Problem: model does not respond to rails_admin: this should not happen"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
module RailsAdminSettings
|
2
|
+
module RailsAdminConfig
|
3
|
+
def self.included(base)
|
4
|
+
if base.respond_to?(:rails_admin)
|
5
|
+
base.rails_admin do
|
6
|
+
navigation_label I18n.t('admin.settings.label')
|
7
|
+
|
8
|
+
object_label_method do
|
9
|
+
:label
|
10
|
+
end
|
11
|
+
|
12
|
+
list do
|
13
|
+
if Object.const_defined?('RailsAdminToggleable')
|
14
|
+
field :enabled, :toggle
|
15
|
+
else
|
16
|
+
field :enabled
|
17
|
+
end
|
18
|
+
field :label
|
19
|
+
field :raw
|
20
|
+
field :type
|
21
|
+
end
|
22
|
+
|
23
|
+
edit do
|
24
|
+
field :enabled
|
25
|
+
field :label do
|
26
|
+
read_only true
|
27
|
+
help false
|
28
|
+
end
|
29
|
+
field :type do
|
30
|
+
read_only true
|
31
|
+
help false
|
32
|
+
end
|
33
|
+
field :raw do
|
34
|
+
partial "setting_value"
|
35
|
+
visible do
|
36
|
+
!bindings[:object].file_type?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if Settings.file_uploads_supported
|
40
|
+
field :file, Settings.file_uploads_engine do
|
41
|
+
visible do
|
42
|
+
bindings[:object].file_type?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
puts "[rails_admin_settings] Problem: model does not respond to rails_admin: this should not happen"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,66 +1,66 @@
|
|
1
|
-
module RailsAdminSettings
|
2
|
-
module RequireHelpers
|
3
|
-
private
|
4
|
-
|
5
|
-
def require_russian_phone
|
6
|
-
begin
|
7
|
-
require 'russian_phone'
|
8
|
-
yield
|
9
|
-
rescue LoadError => e
|
10
|
-
e.message << " [rails_admin_settings] Please add gem 'russian_phone' to use phone settings"
|
11
|
-
raise e
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def require_safe_yaml
|
16
|
-
begin
|
17
|
-
require 'safe_yaml'
|
18
|
-
yield
|
19
|
-
rescue LoadError => e
|
20
|
-
e.message << " [rails_admin_settings] Please add gem 'safe_yaml' to your Gemfile to use yaml settings"
|
21
|
-
raise e
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def require_sanitize
|
26
|
-
begin
|
27
|
-
require 'sanitize'
|
28
|
-
yield
|
29
|
-
rescue LoadError => e
|
30
|
-
e.message << " [rails_admin_settings] Please add gem 'sanitize' to your Gemfile to use sanitized settings"
|
31
|
-
raise e
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def require_validates_email_format_of
|
36
|
-
begin
|
37
|
-
require 'validates_email_format_of'
|
38
|
-
yield
|
39
|
-
rescue LoadError => e
|
40
|
-
e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
|
41
|
-
raise e
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def require_geocoder
|
46
|
-
begin
|
47
|
-
require 'geocoder'
|
48
|
-
yield
|
49
|
-
rescue LoadError => e
|
50
|
-
e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
|
51
|
-
raise e
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def require_addressable
|
56
|
-
begin
|
57
|
-
require 'addressable/uri'
|
58
|
-
yield
|
59
|
-
rescue LoadError => e
|
60
|
-
e.message << " [rails_admin_settings] Please add gem 'addressable' to your Gemfile to use url/domain type settings"
|
61
|
-
raise e
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
1
|
+
module RailsAdminSettings
|
2
|
+
module RequireHelpers
|
3
|
+
private
|
4
|
+
|
5
|
+
def require_russian_phone
|
6
|
+
begin
|
7
|
+
require 'russian_phone'
|
8
|
+
yield
|
9
|
+
rescue LoadError => e
|
10
|
+
e.message << " [rails_admin_settings] Please add gem 'russian_phone' to use phone settings"
|
11
|
+
raise e
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def require_safe_yaml
|
16
|
+
begin
|
17
|
+
require 'safe_yaml'
|
18
|
+
yield
|
19
|
+
rescue LoadError => e
|
20
|
+
e.message << " [rails_admin_settings] Please add gem 'safe_yaml' to your Gemfile to use yaml settings"
|
21
|
+
raise e
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def require_sanitize
|
26
|
+
begin
|
27
|
+
require 'sanitize'
|
28
|
+
yield
|
29
|
+
rescue LoadError => e
|
30
|
+
e.message << " [rails_admin_settings] Please add gem 'sanitize' to your Gemfile to use sanitized settings"
|
31
|
+
raise e
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def require_validates_email_format_of
|
36
|
+
begin
|
37
|
+
require 'validates_email_format_of'
|
38
|
+
yield
|
39
|
+
rescue LoadError => e
|
40
|
+
e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
|
41
|
+
raise e
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def require_geocoder
|
46
|
+
begin
|
47
|
+
require 'geocoder'
|
48
|
+
yield
|
49
|
+
rescue LoadError => e
|
50
|
+
e.message << " [rails_admin_settings] Please add gem 'validates_email_format_of' to your Gemfile to use email type settings"
|
51
|
+
raise e
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def require_addressable
|
56
|
+
begin
|
57
|
+
require 'addressable/uri'
|
58
|
+
yield
|
59
|
+
rescue LoadError => e
|
60
|
+
e.message << " [rails_admin_settings] Please add gem 'addressable' to your Gemfile to use url/domain type settings"
|
61
|
+
raise e
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|