rails_admin_settings 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/app/models/rails_admin_settings/setting.rb +6 -1
- data/config/locales/ru.rails_admin_settings.yml +2 -1
- data/lib/rails_admin_settings/rails_admin_config.rb +3 -3
- data/lib/rails_admin_settings/settings.rb +5 -1
- data/lib/rails_admin_settings/version.rb +1 -1
- data/rails_admin_settings.gemspec +1 -1
- data/spec/label_spec.rb +18 -0
- data/spec/settings_spec.rb +1 -0
- metadata +10 -7
- data/.rvmrc +0 -1
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rails_admin_settings
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p392
|
@@ -18,6 +18,7 @@ module RailsAdminSettings
|
|
18
18
|
|
19
19
|
field :key, type: String
|
20
20
|
field :raw, type: String, default: ''
|
21
|
+
field :label
|
21
22
|
|
22
23
|
include RailsAdminSettings::RequireHelpers
|
23
24
|
include RailsAdminSettings::Processing
|
@@ -33,6 +34,10 @@ module RailsAdminSettings
|
|
33
34
|
enabled
|
34
35
|
end
|
35
36
|
|
37
|
+
before_save do
|
38
|
+
self.label = self.key unless self.label.present?
|
39
|
+
end
|
40
|
+
|
36
41
|
index(key: 1)
|
37
42
|
|
38
43
|
if Object.const_defined?('RailsAdmin')
|
@@ -41,4 +46,4 @@ module RailsAdminSettings
|
|
41
46
|
puts "[rails_admin_settings] Rails Admin not detected -- put this gem after rails_admin in gemfile"
|
42
47
|
end
|
43
48
|
end
|
44
|
-
end
|
49
|
+
end
|
@@ -6,7 +6,7 @@ module RailsAdminSettings
|
|
6
6
|
navigation_label I18n.t('admin.settings.label')
|
7
7
|
|
8
8
|
object_label_method do
|
9
|
-
:
|
9
|
+
:label
|
10
10
|
end
|
11
11
|
|
12
12
|
list do
|
@@ -15,14 +15,14 @@ module RailsAdminSettings
|
|
15
15
|
else
|
16
16
|
field :enabled
|
17
17
|
end
|
18
|
-
field :
|
18
|
+
field :label
|
19
19
|
field :raw
|
20
20
|
field :type
|
21
21
|
end
|
22
22
|
|
23
23
|
edit do
|
24
24
|
field :enabled
|
25
|
-
field :
|
25
|
+
field :label do
|
26
26
|
read_only true
|
27
27
|
help false
|
28
28
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "mongoid",
|
21
|
+
spec.add_runtime_dependency "mongoid", ">= 3.1"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0.3"
|
data/spec/label_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Settings label' do
|
6
|
+
|
7
|
+
it "should have label" do
|
8
|
+
label = "E-Mail"
|
9
|
+
Settings.email(label: label, default: "my@mail.ru")
|
10
|
+
Settings.label(:email).should == label
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should properly set label as key if blank" do
|
14
|
+
Settings.email(default: "my@mail.ru")
|
15
|
+
Settings.label(:email).should == 'email'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/spec/settings_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -244,7 +244,8 @@ extra_rdoc_files: []
|
|
244
244
|
files:
|
245
245
|
- .gitignore
|
246
246
|
- .rspec
|
247
|
-
- .
|
247
|
+
- .ruby-gemset
|
248
|
+
- .ruby-version
|
248
249
|
- .travis.yml
|
249
250
|
- Gemfile
|
250
251
|
- LICENSE.txt
|
@@ -270,6 +271,7 @@ files:
|
|
270
271
|
- spec/advanced_usage_spec.rb
|
271
272
|
- spec/database_trickery_spec.rb
|
272
273
|
- spec/factories/setting.rb
|
274
|
+
- spec/label_spec.rb
|
273
275
|
- spec/model_spec.rb
|
274
276
|
- spec/settings_spec.rb
|
275
277
|
- spec/spec_helper.rb
|
@@ -292,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
292
294
|
version: '0'
|
293
295
|
segments:
|
294
296
|
- 0
|
295
|
-
hash:
|
297
|
+
hash: 1108480110300401227
|
296
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
297
299
|
none: false
|
298
300
|
requirements:
|
@@ -301,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
303
|
version: '0'
|
302
304
|
segments:
|
303
305
|
- 0
|
304
|
-
hash:
|
306
|
+
hash: 1108480110300401227
|
305
307
|
requirements: []
|
306
308
|
rubyforge_project:
|
307
309
|
rubygems_version: 1.8.25
|
@@ -312,6 +314,7 @@ test_files:
|
|
312
314
|
- spec/advanced_usage_spec.rb
|
313
315
|
- spec/database_trickery_spec.rb
|
314
316
|
- spec/factories/setting.rb
|
317
|
+
- spec/label_spec.rb
|
315
318
|
- spec/model_spec.rb
|
316
319
|
- spec/settings_spec.rb
|
317
320
|
- spec/spec_helper.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3-p392@rails_admin_settings --create
|