rails_admin_json_translate 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 4d46b96692b3e83119f755ec33f6093bb72d19e4
4
- data.tar.gz: 119bb58dee75c615386c357b2e7b7764f4eeb237
3
+ metadata.gz: 11d63c2457f0afb48811e0c1ce2fd9a0d675f3e4
4
+ data.tar.gz: 1c22fcf300fa8e1068f9b5813d130c6670cffdf7
5
5
  SHA512:
6
- metadata.gz: a5cc62922e9d9970e4491cfdb522e2d9eaf18671ae2087f9d43126ab575d668304141dd88c5cf3dcf813493b6bcc3ed5dbac1d49c493825091649b20331bb611
7
- data.tar.gz: 879351fee21a2571922c6ec79c9107e1b319f10c26b45eee2e868410d2938af10c1509846c55c9434885c3e5790562ab87a3b22716760403bcffa7d553e89f91
6
+ metadata.gz: 63df774a37a3bba4b690c9f9905696c1f2eb6af848698b3582c39c13a5f2057ec01f305e4543d13458e8ae142feca7cc6bcb092501269397ab08f49ef0dcab41
7
+ data.tar.gz: '0469a8f368c16a3137eab9bd31458e1c16af3b4876f625d24f4c951802e0f308dd3949792d30c5994c7a824b5f61b6d94dc4af8ad834ab6c5aeb92ca1f8cd1dc'
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  module Config
10
10
  module Fields
11
11
  module Types
12
- class JsonTranslate < RailsAdmin::Config::Fields::Base
12
+ class JsonTranslate < RailsAdmin::Config::Fields::Types::Text
13
13
  RailsAdmin::Config::Fields::Types.register(:json_translate, self)
14
14
 
15
15
  register_instance_option :partial do
@@ -24,6 +24,14 @@ module RailsAdmin
24
24
  I18n.available_locales
25
25
  end
26
26
 
27
+ def parse_value(value)
28
+ value.present? ? JSON.parse(value) : nil
29
+ end
30
+
31
+ def parse_input(params)
32
+ params[name] = parse_value(params[name]) if params[name].is_a?(::String)
33
+ end
34
+
27
35
  def value_for_locale(locale)
28
36
  val = @bindings[:object].send(name)
29
37
  return '' unless val
@@ -1,3 +1,3 @@
1
1
  module RailsAdminJsonTranslate
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_json_translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Venneman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-26 00:00:00.000000000 Z
11
+ date: 2017-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  requirements: []
190
190
  rubyforge_project:
191
- rubygems_version: 2.5.1
191
+ rubygems_version: 2.5.2
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Integrate json_translate into rails_admin