rails_admin_settings 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db230b6a4b80bd678989685aad32c79b1244349e7d443d1182697b97d986f9a
4
- data.tar.gz: 44e67607c57e54cbec2dfa03f31870bac02d81215564839a01209d25b898d73f
3
+ metadata.gz: 1f0216fdfa5010a28eaade776ffc755f2f161b01fdc39c75de1486d8ffa37fcf
4
+ data.tar.gz: f9982da8b4e0418541728ffa56d9ee64f713e6749e81e0f890784d33102433ab
5
5
  SHA512:
6
- metadata.gz: ecaf2246f2badf0669f0c4e207a3f1c9ac525563ab204f8990c0443d8bd2abaea42df5e6bde43afaa43470aac6390b68fe171c0b6eb51f0bc1c74beb4347059a
7
- data.tar.gz: d7dd09c6b125b70084f6d43b9d215b462f3fa0be3bb1c36fc659f46bdca48207f026d7b359fb13a6771c90ce13a05be67c51b4443371c78adf69b746e210be21
6
+ metadata.gz: 0d1f2caa066ed8a582e5d2f08b2953418bb3d7439fe3e8269edccf8037dc77e660b0afde4245306c3e7fb82f887877b79ff7185120ea0f3b6998509024f36b41
7
+ data.tar.gz: 178029e94d0a928a7498b6d345d56423f85ad5ad9a96f2c1c00ac01f4747da9088dea03bdff8e070b5c97ca5ab6eb81864c3ebd81a695cbf3c9bd4b7fb58162b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.5.0 (2018-06-09)
2
+
3
+ Add float type
4
+
1
5
  ## 1.4.1 (2018-03-07)
2
6
 
3
7
  Fix activerecord + paperclip uploads
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_admin_settings (1.4.2)
4
+ rails_admin_settings (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -66,11 +66,11 @@ GEM
66
66
  crass (1.0.4)
67
67
  database_cleaner (1.7.0)
68
68
  diff-lcs (1.3)
69
- docile (1.3.0)
69
+ docile (1.3.1)
70
70
  erubi (1.7.1)
71
- factory_bot (4.8.2)
71
+ factory_bot (4.10.0)
72
72
  activesupport (>= 3.0.0)
73
- geocoder (1.4.7)
73
+ geocoder (1.4.9)
74
74
  globalid (0.4.1)
75
75
  activesupport (>= 4.2.0)
76
76
  i18n (1.0.1)
@@ -166,9 +166,9 @@ GEM
166
166
  diff-lcs (>= 1.2.0, < 2.0)
167
167
  rspec-support (~> 3.7.0)
168
168
  rspec-support (3.7.1)
169
- russian_phone (0.6.0)
169
+ russian_phone (0.6.1)
170
170
  safe_yaml (1.0.4)
171
- sanitize (4.6.4)
171
+ sanitize (4.6.5)
172
172
  crass (~> 1.0.2)
173
173
  nokogiri (>= 1.4.4)
174
174
  nokogumbo (~> 1.4)
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # RailsAdminSettings
2
2
 
3
+ Master repository has moved to gitlab, all new code will be there:
4
+
5
+ https://gitlab.com/rocket-science/rails_admin_settings
6
+
7
+
3
8
  [![Build Status](https://secure.travis-ci.org/rs-pro/rails_admin_settings.png?branch=master)](http://travis-ci.org/rs-pro/rails_admin_settings)
4
9
  [![Dependency Status](https://gemnasium.com/rs-pro/rails_admin_settings.svg)](https://gemnasium.com/rs-pro/rails_admin_settings)
5
10
  [![Gem Version](https://badge.fury.io/rb/rails_admin_settings.svg)](https://badge.fury.io/rb/rails_admin_settings)
@@ -1,4 +1,4 @@
1
- - if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
1
+ - if ['string', 'integer', 'float', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
2
2
  = form.text_field :raw, :value => field.value
3
3
  - if @object.type == 'boolean'
4
4
  = form.check_box :raw, {:value => field.value}, 'true', 'false'
@@ -4,6 +4,7 @@ module RailsAdminSettings
4
4
  'string',
5
5
  'text',
6
6
  'integer',
7
+ 'float',
7
8
  'boolean',
8
9
  'html',
9
10
  'code',
@@ -10,7 +10,7 @@ module RailsAdminSettings
10
10
  end
11
11
 
12
12
  def text_kind?
13
- (RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'yaml', 'json', 'boolean']).include? kind
13
+ (RailsAdminSettings.kinds - ['phone', 'phones', 'integer', 'float', 'yaml', 'json', 'boolean']).include? kind
14
14
  end
15
15
 
16
16
  def upload_kind?
@@ -54,7 +54,8 @@ module RailsAdminSettings
54
54
  end
55
55
 
56
56
  def to_s
57
- if yaml_kind? || json_kind? || phone_kind? || integer_kind?
57
+ if yaml_kind? || json_kind? || phone_kind? || integer_kind? || float_kind?
58
+
58
59
  raw
59
60
  else
60
61
  value
@@ -94,6 +95,8 @@ module RailsAdminSettings
94
95
  ''
95
96
  elsif integer_kind?
96
97
  0
98
+ elsif float_kind?
99
+ 0
97
100
  elsif yaml_kind?
98
101
  nil
99
102
  elsif json_kind?
@@ -181,6 +184,8 @@ module RailsAdminSettings
181
184
  process_text
182
185
  elsif integer_kind?
183
186
  raw.to_i
187
+ elsif float_kind?
188
+ raw.to_f
184
189
  elsif yaml_kind?
185
190
  load_yaml
186
191
  elsif json_kind?
@@ -9,6 +9,7 @@ module RailsAdminSettings
9
9
  base.validates_uniqueness_of :key, scope: :ns
10
10
  base.validates_inclusion_of :kind, in: RailsAdminSettings.kinds
11
11
  base.validates_numericality_of :raw, if: :integer_kind?
12
+ base.validates_numericality_of :raw, if: :float_kind?
12
13
 
13
14
  add_validators(base)
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module RailsAdminSettings
2
- VERSION = "1.4.2"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["glebtv@gmail.com"]
11
11
  spec.description = %q{Mongoid / ActiveRecord + RailsAdmin App Settings management}
12
12
  spec.summary = %q{}
13
- spec.homepage = "https://github.com/rs-pro/rails_admin_settings"
13
+ spec.homepage = "https://gitlab.com/rocket-science/rails_admin_settings"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
data/spec/types_spec.rb CHANGED
@@ -23,6 +23,13 @@ describe 'Settings kind' do
23
23
  expect(Settings.testint2).to eq 5
24
24
  end
25
25
 
26
+ it 'float' do
27
+ expect(Settings.get(:testfloat, kind: 'float').value).to eq 0
28
+ expect(Settings.get(:testfloat, default: 5.2, kind: 'float').value).to eq 0
29
+ expect(Settings.get(:testfloat2, default: 5.5, kind: 'float').value).to eq 5.5
30
+ expect(Settings.testfloat2).to eq 5.5
31
+ end
32
+
26
33
  it 'does yaml' do
27
34
  Settings.set(:data, '[one, two, three]', kind: 'yaml')
28
35
  expect(Settings.get(:data).raw).to eq '[one, two, three]'
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.4.2
4
+ version: 1.5.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: 2018-05-11 00:00:00.000000000 Z
11
+ date: 2018-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -326,7 +326,7 @@ files:
326
326
  - spec/support/mongoid.rb
327
327
  - spec/support/mongoid.yml
328
328
  - spec/types_spec.rb
329
- homepage: https://github.com/rs-pro/rails_admin_settings
329
+ homepage: https://gitlab.com/rocket-science/rails_admin_settings
330
330
  licenses:
331
331
  - MIT
332
332
  metadata: {}
@@ -346,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
346
  version: '0'
347
347
  requirements: []
348
348
  rubyforge_project:
349
- rubygems_version: 2.7.6
349
+ rubygems_version: 2.7.7
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: ''