rails_admin_settings 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 354ac1ea3f414693cec277ee8f2d92295d9ca5b1
4
- data.tar.gz: 6f4ecafee55ac66d6215ad25ea400a685195b674
2
+ SHA256:
3
+ metadata.gz: 2c3a2cc5a5dd0c4e77f1e05ef1447698edde1ba25344fc2e5baea2dc7c686427
4
+ data.tar.gz: 753783ad33100ef2d26891da3ecb909768f2b4c9e86242d1fedd44b388ee02ec
5
5
  SHA512:
6
- metadata.gz: 0e0ed9a6c11e4ee88b669ed7982d98095e56d5880fab2f26abcd51d6cdf6dfb75b71c66f9ab3c3651f5cf54fe615c2626a6b6197bdb3607fb937798187acd4e3
7
- data.tar.gz: 588d5ed55e2f5800ee23f0b3003f89c87d9de04c279c32ade06f933e9e7f6b4fbf661c203c232feb28d8f5940d27f19a0415ccee2fac5d3a6c395f6ad37ba436
6
+ metadata.gz: b8b2f3ac4d7218bd0840aba1965f499f5b56d4a0bb0f30a1e36cdb3ac411ab19e620cfc7c769989d66eab63fd7efd06c1a7356e21e1a3bd96e5f441ebd492ad0
7
+ data.tar.gz: 306df770d677bee42028699ded628aed3339aad936837383aefa2257cfe79badbdcbcfde7c618f745dd692b2d4a1d78c2254c2622f5dcca2f3596194f98a2f78
data/.travis.yml CHANGED
@@ -6,12 +6,15 @@ notifications:
6
6
 
7
7
  rvm:
8
8
  - 2.3.3
9
+ - 2.5.0
9
10
 
10
11
  env:
11
12
  - "UPLOADS=paperclip"
12
13
  - "UPLOADS=carrierwave"
14
+ - "RAILS=1 UPLOADS=paperclip"
15
+ - "RAILS=1 UPLOADS=carrierwave"
13
16
 
14
17
  gemfile:
15
18
  - gemfiles/mongoid-6.0.gemfile
16
- - gemfiles/mongoid-6.1.gemfile
19
+ - gemfiles/mongoid-6.3.gemfile
17
20
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 1.4.0
2
+
3
+ Add new kinds
4
+
5
+ strip_tags (uses strip_tags rails helper)
6
+ simple_format (uses simple_format rails helper)
7
+ simple_format_raw (does NOT sanitize (allows ANY javascript) - uses simple_format rails helper with sanitize: false)
8
+ json
9
+
10
+ Use Psych.safe_load for yaml if available
11
+
1
12
  ## 1.3.1
2
13
 
3
14
  add pt-BR locale (thanks @prem-prakash)
data/Gemfile.lock CHANGED
@@ -1,190 +1,193 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_admin_settings (1.3.2)
4
+ rails_admin_settings (1.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (5.1.1)
10
- actionpack (= 5.1.1)
9
+ actioncable (5.1.5)
10
+ actionpack (= 5.1.5)
11
11
  nio4r (~> 2.0)
12
12
  websocket-driver (~> 0.6.1)
13
- actionmailer (5.1.1)
14
- actionpack (= 5.1.1)
15
- actionview (= 5.1.1)
16
- activejob (= 5.1.1)
13
+ actionmailer (5.1.5)
14
+ actionpack (= 5.1.5)
15
+ actionview (= 5.1.5)
16
+ activejob (= 5.1.5)
17
17
  mail (~> 2.5, >= 2.5.4)
18
18
  rails-dom-testing (~> 2.0)
19
- actionpack (5.1.1)
20
- actionview (= 5.1.1)
21
- activesupport (= 5.1.1)
19
+ actionpack (5.1.5)
20
+ actionview (= 5.1.5)
21
+ activesupport (= 5.1.5)
22
22
  rack (~> 2.0)
23
- rack-test (~> 0.6.3)
23
+ rack-test (>= 0.6.3)
24
24
  rails-dom-testing (~> 2.0)
25
25
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
- actionview (5.1.1)
27
- activesupport (= 5.1.1)
26
+ actionview (5.1.5)
27
+ activesupport (= 5.1.5)
28
28
  builder (~> 3.1)
29
29
  erubi (~> 1.4)
30
30
  rails-dom-testing (~> 2.0)
31
31
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
- activejob (5.1.1)
33
- activesupport (= 5.1.1)
32
+ activejob (5.1.5)
33
+ activesupport (= 5.1.5)
34
34
  globalid (>= 0.3.6)
35
- activemodel (5.1.1)
36
- activesupport (= 5.1.1)
37
- activerecord (5.1.1)
38
- activemodel (= 5.1.1)
39
- activesupport (= 5.1.1)
35
+ activemodel (5.1.5)
36
+ activesupport (= 5.1.5)
37
+ activerecord (5.1.5)
38
+ activemodel (= 5.1.5)
39
+ activesupport (= 5.1.5)
40
40
  arel (~> 8.0)
41
- activesupport (5.1.1)
41
+ activesupport (5.1.5)
42
42
  concurrent-ruby (~> 1.0, >= 1.0.2)
43
43
  i18n (~> 0.7)
44
44
  minitest (~> 5.1)
45
45
  tzinfo (~> 1.1)
46
- addressable (2.5.1)
47
- public_suffix (~> 2.0, >= 2.0.2)
46
+ addressable (2.5.2)
47
+ public_suffix (>= 2.0.2, < 4.0)
48
48
  arel (8.0.0)
49
- bson (4.2.1)
49
+ bson (4.3.0)
50
50
  builder (3.2.3)
51
- carrierwave (0.11.2)
52
- activemodel (>= 3.2.0)
53
- activesupport (>= 3.2.0)
54
- json (>= 1.7)
51
+ carrierwave (1.2.2)
52
+ activemodel (>= 4.0.0)
53
+ activesupport (>= 4.0.0)
55
54
  mime-types (>= 1.16)
56
- mimemagic (>= 0.3.0)
57
- carrierwave-mongoid (0.10.0)
58
- carrierwave (>= 0.8.0, < 0.12.0)
55
+ carrierwave-mongoid (1.0.0)
56
+ carrierwave (>= 0.8, < 1.3)
59
57
  mongoid (>= 3.0, < 7.0)
60
58
  mongoid-grid_fs (>= 1.3, < 3.0)
61
59
  climate_control (0.2.0)
62
60
  cocaine (0.5.8)
63
61
  climate_control (>= 0.0.3, < 1.0)
64
- coderay (1.1.1)
62
+ coderay (1.1.2)
65
63
  concurrent-ruby (1.0.5)
66
- crass (1.0.2)
67
- database_cleaner (1.6.1)
64
+ crass (1.0.3)
65
+ database_cleaner (1.6.2)
68
66
  diff-lcs (1.3)
69
67
  docile (1.1.5)
70
- erubi (1.6.0)
71
- factory_girl (4.8.0)
68
+ erubi (1.7.1)
69
+ factory_bot (4.8.2)
72
70
  activesupport (>= 3.0.0)
73
- geocoder (1.4.4)
74
- globalid (0.4.0)
71
+ geocoder (1.4.6)
72
+ globalid (0.4.1)
75
73
  activesupport (>= 4.2.0)
76
- i18n (0.8.4)
74
+ i18n (0.9.5)
75
+ concurrent-ruby (~> 1.0)
77
76
  json (2.1.0)
78
- loofah (2.0.3)
77
+ loofah (2.2.0)
78
+ crass (~> 1.0.2)
79
79
  nokogiri (>= 1.5.9)
80
- mail (2.6.6)
81
- mime-types (>= 1.16, < 4)
82
- method_source (0.8.2)
80
+ mail (2.7.0)
81
+ mini_mime (>= 0.1.1)
82
+ method_source (0.9.0)
83
83
  mime-types (3.1)
84
84
  mime-types-data (~> 3.2015)
85
85
  mime-types-data (3.2016.0521)
86
86
  mimemagic (0.3.2)
87
- mini_portile2 (2.2.0)
88
- minitest (5.10.2)
89
- mongo (2.4.2)
90
- bson (>= 4.2.1, < 5.0.0)
91
- mongoid (6.2.0)
87
+ mini_mime (1.0.0)
88
+ mini_portile2 (2.3.0)
89
+ minitest (5.11.3)
90
+ mongo (2.5.1)
91
+ bson (>= 4.3.0, < 5.0.0)
92
+ mongoid (6.3.0)
92
93
  activemodel (~> 5.1)
93
- mongo (>= 2.4.1, < 3.0.0)
94
+ mongo (>= 2.5.0, < 3.0.0)
95
+ mongoid-compatibility (0.5.1)
96
+ activesupport
97
+ mongoid (>= 2.0)
94
98
  mongoid-grid_fs (2.3.0)
95
99
  mime-types (>= 1.0, < 4.0)
96
100
  mongoid (>= 3.0, < 7.0)
97
101
  mongoid-paperclip (0.0.11)
98
102
  mongoid
99
103
  paperclip (>= 2.3.6, != 4.3.0)
100
- mongoid-rspec (1.10.0)
101
- mongoid (>= 3.0.1)
102
- rake
103
- rspec (>= 2.14)
104
- nio4r (2.1.0)
105
- nokogiri (1.8.0)
106
- mini_portile2 (~> 2.2.0)
107
- nokogumbo (1.4.13)
104
+ mongoid-rspec (4.0.0)
105
+ activesupport (>= 3.0.0)
106
+ mongoid (>= 2.0)
107
+ mongoid-compatibility
108
+ rspec (~> 3.3)
109
+ nio4r (2.2.0)
110
+ nokogiri (1.8.2)
111
+ mini_portile2 (~> 2.3.0)
112
+ nokogumbo (1.5.0)
108
113
  nokogiri
109
- paperclip (5.1.0)
114
+ paperclip (5.2.1)
110
115
  activemodel (>= 4.2.0)
111
116
  activesupport (>= 4.2.0)
112
117
  cocaine (~> 0.5.5)
113
118
  mime-types
114
119
  mimemagic (~> 0.3.0)
115
- pry (0.10.4)
120
+ pry (0.11.3)
116
121
  coderay (~> 1.1.0)
117
- method_source (~> 0.8.1)
118
- slop (~> 3.4)
119
- public_suffix (2.0.5)
120
- rack (2.0.3)
121
- rack-test (0.6.3)
122
- rack (>= 1.0)
123
- rails (5.1.1)
124
- actioncable (= 5.1.1)
125
- actionmailer (= 5.1.1)
126
- actionpack (= 5.1.1)
127
- actionview (= 5.1.1)
128
- activejob (= 5.1.1)
129
- activemodel (= 5.1.1)
130
- activerecord (= 5.1.1)
131
- activesupport (= 5.1.1)
132
- bundler (>= 1.3.0, < 2.0)
133
- railties (= 5.1.1)
122
+ method_source (~> 0.9.0)
123
+ public_suffix (3.0.2)
124
+ rack (2.0.4)
125
+ rack-test (0.8.3)
126
+ rack (>= 1.0, < 3)
127
+ rails (5.1.5)
128
+ actioncable (= 5.1.5)
129
+ actionmailer (= 5.1.5)
130
+ actionpack (= 5.1.5)
131
+ actionview (= 5.1.5)
132
+ activejob (= 5.1.5)
133
+ activemodel (= 5.1.5)
134
+ activerecord (= 5.1.5)
135
+ activesupport (= 5.1.5)
136
+ bundler (>= 1.3.0)
137
+ railties (= 5.1.5)
134
138
  sprockets-rails (>= 2.0.0)
135
139
  rails-dom-testing (2.0.3)
136
140
  activesupport (>= 4.2.0)
137
141
  nokogiri (>= 1.6)
138
142
  rails-html-sanitizer (1.0.3)
139
143
  loofah (~> 2.0)
140
- railties (5.1.1)
141
- actionpack (= 5.1.1)
142
- activesupport (= 5.1.1)
144
+ railties (5.1.5)
145
+ actionpack (= 5.1.5)
146
+ activesupport (= 5.1.5)
143
147
  method_source
144
148
  rake (>= 0.8.7)
145
149
  thor (>= 0.18.1, < 2.0)
146
- rake (12.0.0)
147
- rspec (3.6.0)
148
- rspec-core (~> 3.6.0)
149
- rspec-expectations (~> 3.6.0)
150
- rspec-mocks (~> 3.6.0)
151
- rspec-core (3.6.0)
152
- rspec-support (~> 3.6.0)
153
- rspec-expectations (3.6.0)
150
+ rake (12.3.0)
151
+ rspec (3.7.0)
152
+ rspec-core (~> 3.7.0)
153
+ rspec-expectations (~> 3.7.0)
154
+ rspec-mocks (~> 3.7.0)
155
+ rspec-core (3.7.1)
156
+ rspec-support (~> 3.7.0)
157
+ rspec-expectations (3.7.0)
154
158
  diff-lcs (>= 1.2.0, < 2.0)
155
- rspec-support (~> 3.6.0)
156
- rspec-mocks (3.6.0)
159
+ rspec-support (~> 3.7.0)
160
+ rspec-mocks (3.7.0)
157
161
  diff-lcs (>= 1.2.0, < 2.0)
158
- rspec-support (~> 3.6.0)
159
- rspec-support (3.6.0)
162
+ rspec-support (~> 3.7.0)
163
+ rspec-support (3.7.1)
160
164
  russian_phone (0.6.0)
161
165
  safe_yaml (1.0.4)
162
- sanitize (4.5.0)
166
+ sanitize (4.6.0)
163
167
  crass (~> 1.0.2)
164
168
  nokogiri (>= 1.4.4)
165
- nokogumbo (~> 1.4.1)
166
- simplecov (0.14.1)
169
+ nokogumbo (~> 1.4)
170
+ simplecov (0.15.1)
167
171
  docile (~> 1.1.0)
168
172
  json (>= 1.8, < 3)
169
173
  simplecov-html (~> 0.10.0)
170
- simplecov-html (0.10.1)
171
- slop (3.6.0)
174
+ simplecov-html (0.10.2)
172
175
  sprockets (3.7.1)
173
176
  concurrent-ruby (~> 1.0)
174
177
  rack (> 1, < 3)
175
- sprockets-rails (3.2.0)
178
+ sprockets-rails (3.2.1)
176
179
  actionpack (>= 4.0)
177
180
  activesupport (>= 4.0)
178
181
  sprockets (>= 3.0.0)
179
- thor (0.19.4)
182
+ thor (0.20.0)
180
183
  thread_safe (0.3.6)
181
- tzinfo (1.2.3)
184
+ tzinfo (1.2.5)
182
185
  thread_safe (~> 0.1)
183
186
  validates_email_format_of (1.6.3)
184
187
  i18n
185
188
  websocket-driver (0.6.5)
186
189
  websocket-extensions (>= 0.1.0)
187
- websocket-extensions (0.1.2)
190
+ websocket-extensions (0.1.3)
188
191
 
189
192
  PLATFORMS
190
193
  ruby
@@ -194,9 +197,9 @@ DEPENDENCIES
194
197
  bundler
195
198
  carrierwave-mongoid
196
199
  database_cleaner
197
- factory_girl
200
+ factory_bot
198
201
  geocoder
199
- mongoid (~> 6.1)
202
+ mongoid (~> 6.3)
200
203
  mongoid-paperclip
201
204
  mongoid-rspec
202
205
  pry
@@ -211,4 +214,4 @@ DEPENDENCIES
211
214
  validates_email_format_of
212
215
 
213
216
  BUNDLED WITH
214
- 1.15.1
217
+ 1.16.1
data/README.md CHANGED
@@ -57,7 +57,7 @@ Or install it yourself as:
57
57
 
58
58
  ## Advanced Usage
59
59
 
60
- Settings.content_block_1(kind: 'html', default: 'test')
60
+ Settings.content_block_1(kind: 'html', default: 'test', label: "Test Value")
61
61
  Settings.data(kind: 'yaml')
62
62
  Settings.data = [1, 2, 3]
63
63
 
@@ -95,23 +95,41 @@ Supported types:
95
95
  text (textarea)
96
96
  boolean (checkbox)
97
97
  color (uses built-in RailsAdmin color picker)
98
- html (supports Rich, glebtv-ckeditor, ckeditor, but does not require any of them)
99
- sanitized (requires sanitize -- sanitizes HTML before saving to DB [Warning: uses RELAXED config!])
98
+ html (does NOT sanitize (allows ANY javascript) - for trusted admin, supports Rich, glebtv-ckeditor, ckeditor, but does not require any of them)
99
+ code (does NOT sanitize (allows ANY javascript) - shows as codemirror, requires glebtv-ckeditor for codemirror)
100
+ sanitized (requires sanitize gem -- sanitizes HTML before saving to DB [Warning: uses RELAXED config!])
100
101
  integer (stored as string)
101
102
  yaml (requires safe_yaml)
102
103
  phone (requires russian_phone)
104
+ phones (requires russian_phone - multiple phones)
103
105
  email (requires validates_email_format_of)
104
106
  address (requires geocoder)
105
107
  file (requires paperclip or carrierwave)
106
108
  url (requires addressable)
107
109
  domain (requires addressable)
110
+ sanitize (uses rails sanitize helper with default settings, shows as html)
111
+ sanitize_code (uses rails sanitize helper with default settings, shows as codemirror textarea, can provide custom scrubber, defaults to Rails::Html::WhiteListSanitizer)
112
+ strip_tags (uses strip_tags rails helper)
113
+ simple_format (uses simple_format rails helper)
114
+ simple_format_raw (does NOT sanitize (allows ANY javascript) - uses simple_format rails helper with sanitize: false)
115
+ json
108
116
 
117
+ #### Sanitize settings
118
+
119
+ Sanitizer can be changed like this:
120
+ ```
121
+ RalsAdminSettings.scrubber = Rails::Html::WhiteListSanitizer.new
122
+ ```
123
+ defaults to Rails::Html::WhiteListSanitizer
109
124
 
110
125
  Strings and html support following replacement patterns:
111
126
 
112
127
  {{year}} -> current year
113
128
  {{year|2013}} -> 2013 in 2013, 2013-2014 in 2014, etc
114
129
 
130
+ Sanitized types sanitize before storing to DB and not on display for performance.
131
+ Simple format types are stored in db as-is.
132
+
115
133
  ## Usage with Rails Admin
116
134
 
117
135
  Rails admin management for settings is supported out of the box
@@ -4,9 +4,9 @@
4
4
  = form.check_box :raw, {:value => field.value}, 'true', 'false'
5
5
  - if @object.type == 'color'
6
6
  = form.text_field :raw, :value => field.value, 'data-color' => true, style: "background-color: ##{field.value}"
7
- - elsif %w(text yaml phones).include?( @object.type )
7
+ - elsif %w(text simple_format simple_format_raw strip_tags yaml json phones).include?( @object.type )
8
8
  = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
9
- - elsif @object.type == 'code'
9
+ - elsif @object.type == 'code' || @object.type == 'sanitize_code'
10
10
  :ruby
11
11
  #binding.pry
12
12
  js_data = {
@@ -24,7 +24,7 @@
24
24
  }
25
25
 
26
26
  = form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'codemirror', options: js_data.to_json }).reverse_merge({ value: field.form_value })
27
- - elsif @object.type == 'html' || @object.type == 'sanitized'
27
+ - elsif @object.type == 'html' || @object.type == 'sanitized' || @object.type == 'sanitize'
28
28
  - if form.respond_to?(:cktext_area)
29
29
  = javascript_include_tag "ckeditor/init"
30
30
  = form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
@@ -7,6 +7,7 @@ en:
7
7
  phones_invalid: "Incorrect phone: %{phones}"
8
8
  email_invalid: Incorrect email
9
9
  yaml_invalid: Incorrect YAML
10
+ json_invalid: Incorrect JSON
10
11
  color_invalid: Incorrect color
11
12
  mongoid: &mongoid
12
13
  models:
@@ -7,6 +7,7 @@ pt-BR:
7
7
  phones_invalid: "Telefone incorreto: %{phones}"
8
8
  email_invalid: Email incorreto
9
9
  yaml_invalid: YAML incorreto
10
+ json_invalid: JSON incorreto
10
11
  color_invalid: Cor incorreta
11
12
  mongoid: &mongoid
12
13
  models:
@@ -7,6 +7,7 @@ ru:
7
7
  phones_invalid: "Неверный телефонный номер: %{phones}"
8
8
  email_invalid: Неверный email
9
9
  yaml_invalid: Неверный синтаксис YAML
10
+ json_invalid: Неверный синтаксис JSON
10
11
  color_invalid: Неверный цвет
11
12
  mongoid: &mongoid
12
13
  models:
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "mongoid", "~> 6.1.0"
3
+ gem "mongoid", "~> 6.3.0"
4
4
 
5
5
  gemspec path: "../"
@@ -1,6 +1,11 @@
1
1
  require "rails_admin_settings/version"
2
2
 
3
3
  module RailsAdminSettings
4
+ if defined?(Rails) && defined?(Rails::Html) && defined?(Rails::Html::WhiteListSanitizer)
5
+ @@scrubber = Rails::Html::WhiteListSanitizer.new
6
+ end
7
+ cattr_accessor :scrubber
8
+
4
9
  class << self
5
10
  def orm
6
11
  if defined?(::Mongoid)
@@ -17,7 +17,13 @@ module RailsAdminSettings
17
17
  'image',
18
18
  'url',
19
19
  'domain',
20
- 'color'
20
+ 'color',
21
+ 'strip_tags',
22
+ 'sanitize',
23
+ 'sanitize_code',
24
+ 'simple_format',
25
+ 'simple_format_raw',
26
+ 'json',
21
27
  ]
22
28
  end
23
29
 
@@ -10,7 +10,7 @@ module RailsAdminSettings
10
10
  end
11
11
 
12
12
  def text_kind?
13
- (RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml', 'boolean']).include? kind
13
+ (RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml', 'json', 'boolean']).include? kind
14
14
  end
15
15
 
16
16
  def upload_kind?
@@ -18,8 +18,13 @@ module RailsAdminSettings
18
18
  end
19
19
 
20
20
  def html_kind?
21
- ['html', 'code', 'sanitized'].include? kind
21
+ ['html', 'code', 'sanitize', 'sanitize_code', 'strip_tags', 'simple_format', 'simple_format_raw', 'sanitized'].include? kind
22
22
  end
23
+
24
+ def preprocessed_kind?
25
+ ['sanitize', 'sanitize_code', 'strip_tags', 'simple_format', 'simple_format_raw', 'sanitized'].include? kind
26
+ end
27
+
23
28
  alias_method :text_type?, :text_kind?
24
29
  alias_method :upload_type?, :upload_kind?
25
30
  alias_method :html_type?, :html_kind?
@@ -49,7 +54,7 @@ module RailsAdminSettings
49
54
  end
50
55
 
51
56
  def to_s
52
- if yaml_kind? || phone_kind? || integer_kind?
57
+ if yaml_kind? || json_kind? || phone_kind? || integer_kind?
53
58
  raw
54
59
  else
55
60
  value
@@ -58,9 +63,27 @@ module RailsAdminSettings
58
63
 
59
64
  private
60
65
 
61
- def sanitize_value
62
- require_sanitize do
63
- self.raw = Sanitize.clean(value, Sanitize::Config::RELAXED)
66
+ def preprocess_value
67
+ case kind
68
+ # just to raise error if not in rails
69
+ when 'simple_format'
70
+ require_rails do
71
+ end
72
+ when 'simple_format_raw'
73
+ require_rails do
74
+ end
75
+ when 'strip_tags'
76
+ require_rails do
77
+ self.raw = ActionController::Base.helpers.strip_tags(raw)
78
+ end
79
+ when 'sanitize', 'sanitize_code'
80
+ require_rails do
81
+ self.raw = RailsAdminSettings.scrubber.sanitize(raw)
82
+ end
83
+ when 'sanitized'
84
+ require_sanitize do
85
+ self.raw = Sanitize.clean(value, Sanitize::Config::RELAXED)
86
+ end
64
87
  end
65
88
  end
66
89
 
@@ -72,10 +95,11 @@ module RailsAdminSettings
72
95
  elsif integer_kind?
73
96
  0
74
97
  elsif yaml_kind?
98
+ nil
99
+ elsif json_kind?
100
+ nil
75
101
  elsif boolean_kind?
76
102
  false
77
- elsif yaml_type?
78
- nil
79
103
  elsif phone_kind?
80
104
  require_russian_phone do
81
105
  RussianPhone::Number.new('')
@@ -97,6 +121,20 @@ module RailsAdminSettings
97
121
  end
98
122
  end
99
123
 
124
+ def process_html_types(text)
125
+ case kind
126
+ when 'simple_format'
127
+ require_rails do
128
+ text = ActionController::Base.helpers.simple_format(text)
129
+ end
130
+ when 'simple_format_raw'
131
+ require_rails do
132
+ text = ActionController::Base.helpers.simple_format(text, {}, sanitize: false)
133
+ end
134
+ end
135
+ text
136
+ end
137
+
100
138
  def process_text
101
139
  text = raw.dup
102
140
  text.gsub!('{{year}}', Time.now.strftime('%Y'))
@@ -107,6 +145,7 @@ module RailsAdminSettings
107
145
  "#{$1}-#{Time.now.strftime('%Y')}"
108
146
  end
109
147
  end
148
+ text = process_html_types(text)
110
149
  text = text.html_safe if html_kind?
111
150
  text
112
151
  end
@@ -124,11 +163,19 @@ module RailsAdminSettings
124
163
  end
125
164
 
126
165
  def load_yaml
127
- require_safe_yaml do
128
- YAML.safe_load(raw)
166
+ if defined?(Psych) && Psych.respond_to?(:safe_load)
167
+ Psych.safe_load(raw)
168
+ else
169
+ require_safe_yaml do
170
+ YAML.safe_load(raw)
171
+ end
129
172
  end
130
173
  end
131
174
 
175
+ def load_json
176
+ JSON.load(raw)
177
+ end
178
+
132
179
  def processed_value
133
180
  if text_kind?
134
181
  process_text
@@ -136,6 +183,8 @@ module RailsAdminSettings
136
183
  raw.to_i
137
184
  elsif yaml_kind?
138
185
  load_yaml
186
+ elsif json_kind?
187
+ load_json
139
188
  elsif boolean_kind?
140
189
  raw == 'true'
141
190
  elsif phone_kind?
@@ -1,4 +1,13 @@
1
1
  module RailsAdminSettings
2
+ class NoRailsError < StandardError
3
+ def initialize(message)
4
+ @message = message
5
+ end
6
+ def to_s
7
+ @message
8
+ end
9
+ end
10
+
2
11
  module RequireHelpers
3
12
  private
4
13
 
@@ -32,6 +41,17 @@ module RailsAdminSettings
32
41
  end
33
42
  end
34
43
 
44
+ def require_rails
45
+ if defined?(Rails) &&
46
+ defined?(ActionController) &&
47
+ defined?(ActionController::Base) &&
48
+ !RailsAdminSettings.scrubber.nil?
49
+ yield
50
+ else
51
+ raise NoRailsError.new("[rails_admin_settings] sanitize, simple_format and strip_tags types require Rails, please add this gem after Rails in your Gemfile")
52
+ end
53
+ end
54
+
35
55
  def require_validates_email_format_of
36
56
  begin
37
57
  require 'validates_email_format_of'
@@ -56,7 +56,7 @@ class Settings < BasicObject
56
56
  end
57
57
 
58
58
  def root_file_path
59
- if Object.const_defined?('Rails')
59
+ if defined?(Rails)
60
60
  Rails.root
61
61
  else
62
62
  Pathname.new(File.dirname(__FILE__)).join('../..')
@@ -66,7 +66,11 @@ class Settings < BasicObject
66
66
  def apply_defaults!(file, verbose = false)
67
67
  if File.file?(file)
68
68
  puts "[settings] Loading from #{file}" if verbose
69
- yaml = YAML.load(File.read(file), safe: true)
69
+ if defined?(Psych) && Psych.respond_to?(:safe_load)
70
+ yaml = Psych.safe_load(File.read(file))
71
+ else
72
+ yaml = YAML.load(File.read(file), safe: true)
73
+ end
70
74
  yaml.each_pair do |namespace, vals|
71
75
  vals.symbolize_keys!
72
76
  n = ns(namespace)
@@ -1,9 +1,9 @@
1
1
  module RailsAdminSettings
2
2
  module Uploads
3
- class CarrierWave < CarrierWave::Uploader::Base
3
+ class CarrierWaveUploader < CarrierWave::Uploader::Base
4
4
  def extension_white_list
5
5
  %w(jpg jpeg gif png tiff psd ai txt rtf doc docx xls xlsx ppt pptx odt odx zip rar 7z pdf)
6
6
  end
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -21,7 +21,7 @@ namespace :settings do
21
21
  RailsAdminSettings::Dumper.dump(path)
22
22
  puts "dumped settings to #{path}"
23
23
  end
24
-
24
+
25
25
  desc "Load settings from config/settings.yml without overwriting current values"
26
26
  task :load => ['settings:require'] do
27
27
  Settings.apply_defaults!(Rails.root.join("config/settings.#{Rails.env.to_s}.yml"), true)
@@ -1,12 +1,21 @@
1
1
  module RailsAdminSettings
2
2
  module Uploads
3
- autoload :CarrierWave, "rails_admin_settings/storage/carrierwave"
3
+ autoload :CarrierWaveUploader, "rails_admin_settings/storage/carrier_wave_uploader"
4
+
5
+ def self.paperclip_options
6
+ if defined?(Rails)
7
+ {}
8
+ else
9
+ {path: "#{File.dirname(__FILE__)}/../../uploads/:filename", url: '/uploads/:filename'}
10
+ end
11
+ end
12
+
4
13
  def self.included(base)
5
14
  # carrierwave
6
15
  if base.respond_to?(:mount_uploader)
7
16
  # puts "[rails_admin_settings] CarrierWave detected"
8
17
  # base.field(:file, type: String)
9
- base.mount_uploader(:file, RailsAdminSettings::Uploads::CarrierWave)
18
+ base.mount_uploader(:file, RailsAdminSettings::Uploads::CarrierWaveUploader)
10
19
  Settings.file_uploads_supported = true
11
20
  Settings.file_uploads_engine = :carrierwave
12
21
  # mongoid-paperclip
@@ -14,11 +23,7 @@ module RailsAdminSettings
14
23
  base.send(:include, ::Mongoid::Paperclip)
15
24
  # puts "[rails_admin_settings] PaperClip detected"
16
25
  base.field(:file, type: String)
17
- if defined?(Rails)
18
- base.has_mongoid_attached_file(:file)
19
- else
20
- base.has_mongoid_attached_file(:file, path: "#{File.dirname(__FILE__)}/../../uploads/:filename", url: '/uploads/:filename')
21
- end
26
+ base.has_mongoid_attached_file(:file, self.paperclip_options)
22
27
  if base.respond_to?(:do_not_validate_attachment_file_type)
23
28
  base.do_not_validate_attachment_file_type :file
24
29
  end
@@ -26,11 +31,7 @@ module RailsAdminSettings
26
31
  Settings.file_uploads_supported = true
27
32
  Settings.file_uploads_engine = :paperclip
28
33
  elsif RailsAdminSettings.active_record? && defined?(Paperclip)
29
- if defined?(Rails)
30
- base.has_attached_file(:file)
31
- else
32
- base.has_attached_file(:file, path: "#{File.dirname(__FILE__)}/../../uploads/:filename", url: '/uploads/:filename')
33
- end
34
+ base.has_mongoid_attached_file(:file, self.paperclip_options)
34
35
  if base.respond_to?(:do_not_validate_attachment_file_type)
35
36
  base.do_not_validate_attachment_file_type :file
36
37
  end
@@ -4,7 +4,7 @@ module RailsAdminSettings
4
4
  base.before_validation do
5
5
  self.raw = default_serializable_value if raw.blank?
6
6
  end
7
- base.before_validation :sanitize_value, if: :sanitized_kind?
7
+ base.before_validation :preprocess_value, if: :preprocessed_kind?
8
8
  base.validates_uniqueness_of :key, scope: :ns
9
9
  base.validates_inclusion_of :kind, in: RailsAdminSettings.kinds
10
10
  base.validates_numericality_of :raw, if: :integer_kind?
@@ -79,6 +79,16 @@ module RailsAdminSettings
79
79
  end
80
80
  end
81
81
  end
82
+
83
+ base.validate if: :json_kind? do
84
+ unless raw.blank?
85
+ begin
86
+ JSON.load(raw)
87
+ rescue JSON::ParserError => e
88
+ errors.add(:raw, I18n.t('admin.settings.json_invalid'))
89
+ end
90
+ end
91
+ end
82
92
  end
83
93
  end
84
94
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminSettings
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
File without changes
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
 
22
- spec.add_development_dependency "mongoid", '~> 6.1'
22
+ spec.add_development_dependency "mongoid", '~> 6.3'
23
23
  spec.add_development_dependency "rails"
24
24
  spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rake"
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "mongoid-rspec"
28
28
  spec.add_development_dependency "simplecov"
29
29
  spec.add_development_dependency "database_cleaner"
30
- spec.add_development_dependency "factory_girl"
30
+ spec.add_development_dependency "factory_bot"
31
31
  spec.add_development_dependency "safe_yaml"
32
32
  spec.add_development_dependency "russian_phone"
33
33
  spec.add_development_dependency "sanitize"
@@ -52,12 +52,12 @@ describe 'Settings loading defaults' do
52
52
  expect(Settings.ns(:main).footer).to eq 'test <b></b>'
53
53
  expect(Settings.footer).to eq 'zzz'
54
54
 
55
- Settings.ns(:main).phone.should eq '906 1111111'
56
- Settings.ns(:main).true_setting.should be true
57
- Settings.ns(:main).false_setting.should be false
58
- Settings.ns(:other).footer.should eq 'zzz'
59
- Settings.ns(:main).footer.should eq 'test <b></b>'
60
- Settings.footer.should eq 'zzz'
55
+ expect(Settings.ns(:main).phone).to eq '906 1111111'
56
+ expect(Settings.ns(:main).true_setting).to be true
57
+ expect(Settings.ns(:main).false_setting).to be false
58
+ expect(Settings.ns(:other).footer).to eq 'zzz'
59
+ expect(Settings.ns(:main).footer).to eq 'test <b></b>'
60
+ expect(Settings.footer).to eq 'zzz'
61
61
 
62
62
  expect(Settings.ns(:etc, fallback: :main).phone).to eq '906 1111111'
63
63
  expect(Settings.ns(:etc, fallback: :main).footer).to eq 'test <b></b>'
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :setting, class: RailsAdminSettings::Setting do
5
5
  sequence(:key){|n| "setting_#{n}" }
6
6
  raw "Контент 1"
data/spec/label_spec.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe 'Settings label' do
6
-
7
6
  it "should have label" do
8
7
  label = "E-Mail"
9
8
  Settings.email(label: label, default: "my@mail.ru")
@@ -14,5 +13,4 @@ describe 'Settings label' do
14
13
  Settings.email(default: "my@mail.ru")
15
14
  expect(Settings.get(:email).name).to eq('email')
16
15
  end
17
-
18
16
  end
@@ -11,10 +11,10 @@ describe 'Migrating from old versions' do
11
11
  coll.insert({enabled: true, key: 'test', raw: '9060000000', type: 'phone'})
12
12
  end
13
13
  RailsAdminSettings.migrate!
14
- RailsAdminSettings::Setting.first.key.should eq 'test'
15
- RailsAdminSettings::Setting.first.raw.should eq '9060000000'
16
- RailsAdminSettings::Setting.first.ns.should eq 'main'
17
- RailsAdminSettings::Setting.first.kind.should eq 'phone'
14
+ expect(RailsAdminSettings::Setting.first.key).to eq 'test'
15
+ expect(RailsAdminSettings::Setting.first.raw).to eq '9060000000'
16
+ expect(RailsAdminSettings::Setting.first.ns).to eq 'main'
17
+ expect(RailsAdminSettings::Setting.first.kind).to eq 'phone'
18
18
  end
19
19
  end
20
20
 
data/spec/model_spec.rb CHANGED
@@ -6,40 +6,100 @@ describe RailsAdminSettings::Setting do
6
6
  it { is_expected.to have_fields(:enabled, :key, :kind, :raw) }
7
7
 
8
8
  it "correctly return content when enabled" do
9
- setting = FactoryGirl.create(:setting)
9
+ setting = FactoryBot.create(:setting)
10
10
  expect(setting.to_s).to eq "Контент 1"
11
11
  end
12
12
 
13
13
  it "return empty string when disabled" do
14
- setting = FactoryGirl.create(:setting, enabled: false)
14
+ setting = FactoryBot.create(:setting, enabled: false)
15
15
  expect(setting.to_s).to eq ""
16
16
  end
17
17
 
18
18
  it "correctly process {{year}}" do
19
- setting = FactoryGirl.create(:setting, raw: '&copy; {{year}} company')
19
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company')
20
20
  expect(setting.val).to eq "&copy; #{Time.now.strftime('%Y')} company"
21
21
  end
22
22
 
23
23
  it "correctly process {{year|2010}}" do
24
- setting = FactoryGirl.create(:setting, raw: '&copy; {{year|2010}} company')
24
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year|2010}} company')
25
25
  expect(setting.val).to eq "&copy; 2010-#{Time.now.strftime('%Y')} company"
26
26
  end
27
27
 
28
28
  it "correctly process {{year|current_year}}" do
29
- setting = FactoryGirl.create(:setting, raw: '&copy; {{year|' + Time.now.strftime('%Y') + '}} company')
29
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year|' + Time.now.strftime('%Y') + '}} company')
30
30
  expect(setting.val).to eq "&copy; #{Time.now.strftime('%Y')} company"
31
31
  expect(setting.val.class.name).not_to eq "ActiveSupport::SafeBuffer"
32
32
  end
33
33
 
34
34
  it 'return html_safe string when in html mode' do
35
- setting = FactoryGirl.create(:setting, raw: '&copy; {{year}} company', kind: 'html')
35
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company', kind: 'html')
36
36
  expect(setting.val).to eq "&copy; #{Time.now.strftime('%Y')} company"
37
37
  expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
38
38
  end
39
39
 
40
40
  it 'sanitize html when in sanitized mode' do
41
- setting = FactoryGirl.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitized')
41
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitized')
42
42
  expect(setting.val).to eq "© #{Time.now.strftime('%Y')} company <a>test</a>"
43
43
  expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
44
44
  end
45
- end
45
+
46
+ it 'sanitize html when in sanitize mode' do
47
+ if defined?(Rails)
48
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitize')
49
+ expect(setting.val).to eq "© #{Time.now.strftime('%Y')} company <a>test</a>"
50
+ expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
51
+ else
52
+ expect {
53
+ FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitize')
54
+ }.to raise_error(RailsAdminSettings::NoRailsError)
55
+ end
56
+ end
57
+
58
+ it 'sanitize html when in sanitize_code mode' do
59
+ if defined?(Rails)
60
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitize_code')
61
+ expect(setting.val).to eq "© #{Time.now.strftime('%Y')} company <a>test</a>"
62
+ expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
63
+ else
64
+ expect {
65
+ FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'sanitize_code')
66
+ }.to raise_error(RailsAdminSettings::NoRailsError)
67
+ end
68
+ end
69
+
70
+ it 'remove html when in strip_tags mode' do
71
+ if defined?(Rails)
72
+ setting = FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'strip_tags')
73
+ expect(setting.val).to eq "© #{Time.now.strftime('%Y')} company test"
74
+ expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
75
+ else
76
+ expect {
77
+ FactoryBot.create(:setting, raw: '&copy; {{year}} company <a href="javascript:alert()">test</a>', kind: 'strip_tags')
78
+ }.to raise_error(RailsAdminSettings::NoRailsError)
79
+ end
80
+ end
81
+
82
+ it 'formats text and cleans html in simple_format mode' do
83
+ if defined?(Rails)
84
+ setting = FactoryBot.create(:setting, raw: "&copy; {{year}}\n\ncompany <a href='javascript:alert()'>test</a>", kind: 'simple_format')
85
+ expect(setting.val).to eq "<p>© #{Time.now.strftime('%Y')}</p>\n\n<p>company <a>test</a></p>"
86
+ expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
87
+ else
88
+ expect {
89
+ FactoryBot.create(:setting, raw: "&copy; {{year}}\n\ncompany <a href='javascript:alert()'>test</a>", kind: 'simple_format')
90
+ }.to raise_error(RailsAdminSettings::NoRailsError)
91
+ end
92
+ end
93
+
94
+ it 'formats text and DOESNT html in simple_format_raw mode' do
95
+ if defined?(Rails)
96
+ setting = FactoryBot.create(:setting, raw: "&copy; {{year}}\n\ncompany <a href='javascript:alert()'>test</a>", kind: 'simple_format_raw')
97
+ expect(setting.val).to eq "<p>&copy; #{Time.now.strftime('%Y')}</p>\n\n<p>company <a href='javascript:alert()'>test</a></p>"
98
+ expect(setting.val.class.name).to eq "ActiveSupport::SafeBuffer"
99
+ else
100
+ expect {
101
+ FactoryBot.create(:setting, raw: "&copy; {{year}}\n\ncompany <a href='javascript:alert()'>test</a>", kind: 'simple_format_raw')
102
+ }.to raise_error(RailsAdminSettings::NoRailsError)
103
+ end
104
+ end
105
+ end
@@ -17,7 +17,6 @@ describe "Uploads" do
17
17
  expect(Settings.get(:file).file_file_name).to eq '1024x768.gif'
18
18
  expect(Settings.get(:file).file_file_size).to eq 4357
19
19
  expect(Settings.file[0..21]).to eq '/uploads/1024x768.gif?'
20
-
21
20
  expect(File.exists?("#{File.dirname(__FILE__)}/../uploads/1024x768.gif")).to be_truthy
22
21
  end
23
22
 
@@ -48,7 +48,7 @@ describe 'Settings' do
48
48
  Settings.phone = '906 222 22 22'
49
49
  expect(Settings.phone(kind: 'phone', default: '906 111 11 11')).to eq '+7 (906) 222-22-22'
50
50
  end
51
-
51
+
52
52
  it 'should properly store settings to DB' do
53
53
  Settings.unload!
54
54
  expect(Settings.loaded).to eq false
data/spec/spec_helper.rb CHANGED
@@ -15,10 +15,13 @@ unless ENV['ACTIVERECORD']
15
15
  end
16
16
 
17
17
  require 'database_cleaner'
18
- require 'factory_girl'
18
+ require 'factory_bot'
19
19
  require 'mongoid-rspec'
20
20
 
21
- require "mongoid-paperclip" if ENV['UPLOADS'] == 'paperclip'
21
+ p ENV["UPLOADS"]
22
+ if ENV['UPLOADS'] == 'paperclip'
23
+ require "mongoid-paperclip"
24
+ end
22
25
  if ENV['UPLOADS'] == 'carrierwave'
23
26
  require "carrierwave/mongoid"
24
27
  CarrierWave.configure do |config|
@@ -35,8 +38,34 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each do |f|
35
38
  require f
36
39
  end
37
40
 
41
+ if ENV['RAILS'] == '1'
42
+ require "active_model/railtie"
43
+ require "action_controller/railtie"
44
+ require "action_view/railtie"
45
+ module RAS
46
+ class Application < Rails::Application
47
+ end
48
+ end
49
+ # Initialize the Rails application.
50
+ Rails.application.initialize!
51
+ end
52
+
38
53
  require 'rails_admin_settings'
39
54
 
55
+
56
+ if ENV['UPLOADS'] == 'paperclip'
57
+ module RailsAdminSettings::Uploads
58
+ def self.paperclip_options
59
+ {path: "#{File.dirname(__FILE__)}/../uploads/:filename", url: '/uploads/:filename'}
60
+ end
61
+ end
62
+ end
63
+
64
+
40
65
  Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each do |f|
41
66
  require f
42
67
  end
68
+
69
+ #RSpec.configure do |config|
70
+ #config.expect_with(:rspec) { |c| c.syntax = :should }
71
+ #end
data/spec/types_spec.rb CHANGED
@@ -4,12 +4,12 @@ require 'spec_helper'
4
4
 
5
5
  describe 'Settings kind' do
6
6
  it 'boolean' do
7
- Settings.get(:testbool, kind: 'boolean').value.should be false
8
- Settings.get(:testbool, default: true, kind: 'boolean').value.should be false
9
- Settings.get(:testbool2, default: true, kind: 'boolean').value.should be true
10
- Settings.testbool2.should be true
7
+ expect(Settings.get(:testbool, kind: 'boolean').value).to be(false)
8
+ expect(Settings.get(:testbool, default: true, kind: 'boolean').value).to be(false)
9
+ expect(Settings.get(:testbool2, default: true, kind: 'boolean').value).to be(true)
10
+ expect(Settings.testbool2).to be(true)
11
11
  Settings.set(:testbool3, true, kind: 'boolean')
12
- Settings.testbool3.should be true
12
+ expect(Settings.testbool3).to be(true)
13
13
  end
14
14
 
15
15
  it 'html' do
@@ -23,12 +23,18 @@ describe 'Settings kind' do
23
23
  expect(Settings.testint2).to eq 5
24
24
  end
25
25
 
26
- it 'yaml' do
26
+ it 'does yaml' do
27
27
  Settings.set(:data, '[one, two, three]', kind: 'yaml')
28
28
  expect(Settings.get(:data).raw).to eq '[one, two, three]'
29
29
  expect(Settings.data).to eq ['one', 'two', 'three']
30
30
  end
31
31
 
32
+ it 'does json' do
33
+ Settings.set(:data, '{"a": 1, "b": 2}', kind: 'json')
34
+ expect(Settings.get(:data).raw).to eq '{"a": 1, "b": 2}'
35
+ expect(Settings.data).to eq({"a" => 1, "b" => 2})
36
+ end
37
+
32
38
  it 'phone' do
33
39
  Settings.set(:tphone, '906 111 11 11', kind: 'phone')
34
40
  expect(Settings.get(:tphone).val.class.name).to eq 'RussianPhone::Number'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Tv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.1'
19
+ version: '6.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.1'
26
+ version: '6.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: factory_girl
126
+ name: factory_bot
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -286,7 +286,7 @@ files:
286
286
  - config/locales/pt-BR.yml
287
287
  - config/locales/ru.yml
288
288
  - gemfiles/mongoid-6.0.gemfile
289
- - gemfiles/mongoid-6.1.gemfile
289
+ - gemfiles/mongoid-6.3.gemfile
290
290
  - lib/generators/rails_admin_settings/migration_generator.rb
291
291
  - lib/generators/rails_admin_settings/templates/migration.rb
292
292
  - lib/rails_admin_settings.rb
@@ -301,11 +301,12 @@ files:
301
301
  - lib/rails_admin_settings/rails_admin_config.rb
302
302
  - lib/rails_admin_settings/require_helpers.rb
303
303
  - lib/rails_admin_settings/settings.rb
304
- - lib/rails_admin_settings/storage/carrierwave.rb
304
+ - lib/rails_admin_settings/storage/carrier_wave_uploader.rb
305
305
  - lib/rails_admin_settings/tasks.rb
306
306
  - lib/rails_admin_settings/uploads.rb
307
307
  - lib/rails_admin_settings/validation.rb
308
308
  - lib/rails_admin_settings/version.rb
309
+ - log/development.log
309
310
  - rails_admin_settings.gemspec
310
311
  - spec/advanced_usage_spec.rb
311
312
  - spec/carrierwave_spec.rb
@@ -347,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
348
  version: '0'
348
349
  requirements: []
349
350
  rubyforge_project:
350
- rubygems_version: 2.6.11
351
+ rubygems_version: 2.7.6
351
352
  signing_key:
352
353
  specification_version: 4
353
354
  summary: ''