activeadmin_json_editor 0.0.5 → 0.0.6

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
2
  SHA1:
3
- metadata.gz: d9226eb046c2107188b6149e3fe33a16dd03e2e9
4
- data.tar.gz: f1c088d26a59ed7897fb81ce299b323066eeba64
3
+ metadata.gz: bbef1ee8e097aad025b4a7febfc5f6e9fc4dcbf9
4
+ data.tar.gz: 4c8d99161fbd5dbddb8fd98619f9117e314b2b2b
5
5
  SHA512:
6
- metadata.gz: aff6e2ba0879883c2dbea683f3af89a448e7c58a7110c29e30930e4ac0d9a4618e5410f6f5f6bdff85b923a3170cc55a955db403f4343dd4a43aa24c25e83ac5
7
- data.tar.gz: 0c07ecb48da6f5c031618c59af87f18598b9a0bdee56cc5701918127bd61ed55aa24440e3d2c99d73e26f486908233d74a310bc4ef5e1f5e1363c0e9560e0568
6
+ metadata.gz: 52b5e34e12f30c0f5f24b380704f90a0db9bdf90085df6ecef6a78703382c61242b49d7a02b7aa18a96a40062aaab9b80c856339e1148ced5f5254ab471e1671
7
+ data.tar.gz: 311f2eadac714faff1f6b144fa400c0d777bc616297273e4b0941a10f6b452a3da481bb1a1f7d5d84761beef9e6c2996670d30b354db00115eb8a74fc86a1f06
@@ -1,26 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activeadmin_json_editor (0.0.5)
4
+ activeadmin_json_editor (0.0.6)
5
+ ace-rails-ap
5
6
  railties (>= 3.0, < 5.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- actionpack (4.2.5.1)
11
- actionview (= 4.2.5.1)
12
- activesupport (= 4.2.5.1)
11
+ ace-rails-ap (4.1.0)
12
+ actionpack (4.2.7)
13
+ actionview (= 4.2.7)
14
+ activesupport (= 4.2.7)
13
15
  rack (~> 1.6)
14
16
  rack-test (~> 0.6.2)
15
17
  rails-dom-testing (~> 1.0, >= 1.0.5)
16
18
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
17
- actionview (4.2.5.1)
18
- activesupport (= 4.2.5.1)
19
+ actionview (4.2.7)
20
+ activesupport (= 4.2.7)
19
21
  builder (~> 3.1)
20
22
  erubis (~> 2.7.0)
21
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
22
24
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- activesupport (4.2.5.1)
25
+ activesupport (4.2.7)
24
26
  i18n (~> 0.7)
25
27
  json (~> 1.7, >= 1.7.7)
26
28
  minitest (~> 5.1)
@@ -32,10 +34,12 @@ GEM
32
34
  json (1.8.3)
33
35
  loofah (2.0.3)
34
36
  nokogiri (>= 1.5.9)
35
- mini_portile2 (2.0.0)
36
- minitest (5.8.4)
37
- nokogiri (1.6.7.2)
38
- mini_portile2 (~> 2.0.0.rc2)
37
+ mini_portile2 (2.1.0)
38
+ minitest (5.9.0)
39
+ nokogiri (1.6.8)
40
+ mini_portile2 (~> 2.1.0)
41
+ pkg-config (~> 1.1.7)
42
+ pkg-config (1.1.7)
39
43
  rack (1.6.4)
40
44
  rack-test (0.6.3)
41
45
  rack (>= 1.0)
@@ -47,12 +51,12 @@ GEM
47
51
  rails-deprecated_sanitizer (>= 1.0.1)
48
52
  rails-html-sanitizer (1.0.3)
49
53
  loofah (~> 2.0)
50
- railties (4.2.5.1)
51
- actionpack (= 4.2.5.1)
52
- activesupport (= 4.2.5.1)
54
+ railties (4.2.7)
55
+ actionpack (= 4.2.7)
56
+ activesupport (= 4.2.7)
53
57
  rake (>= 0.8.7)
54
58
  thor (>= 0.18.1, < 2.0)
55
- rake (10.5.0)
59
+ rake (11.2.2)
56
60
  thor (0.19.1)
57
61
  thread_safe (0.3.5)
58
62
  tzinfo (1.2.2)
@@ -66,4 +70,4 @@ DEPENDENCIES
66
70
  bundler (~> 1.5)
67
71
 
68
72
  BUNDLED WITH
69
- 1.11.2
73
+ 1.12.5
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # ActiveAdmin::JsonEditor
2
2
 
3
- "json_input" field type to active_admin that allow to edit Postgresql json values as json tree.
3
+ [![Gem Version](https://badge.fury.io/rb/activeadmin_json_editor.svg)](https://badge.fury.io/rb/activeadmin_json_editor)
4
+
5
+ "json_input" and "jsonb_input" field type to active_admin that allow to edit Postgresql json and jsonb values as json tree.
4
6
  Data shown by using jsoneditor.js from http://jsoneditoronline.org
5
7
 
6
8
  ## Installation
7
9
 
8
10
  Add this line to your application's Gemfile:
9
11
 
10
- gem 'activeadmin_json_editor', github: 'udacity/activeadmin_json_editor', branch: 'master'
12
+ gem 'activeadmin_json_editor', '~> 0.0.6'
11
13
 
12
14
  And then execute:
13
15
 
@@ -36,6 +38,7 @@ ActiveAdmin.register User do
36
38
  form do |f|
37
39
  f.inputs do
38
40
  f.input :settings, as: :json
41
+ f.input :other_settings, as: :jsonb
39
42
  end
40
43
 
41
44
  f.actions
@@ -45,7 +48,7 @@ end
45
48
 
46
49
  ## Contributing
47
50
 
48
- 1. Fork it ( http://github.com/wild-ex/activeadmin_json_editor/fork )
51
+ 1. Fork it ( http://github.com/udacity/activeadmin_json_editor/fork )
49
52
  2. Create your feature branch (`git checkout -b my-new-feature`)
50
53
  3. Commit your changes (`git commit -am 'Add some feature'`)
51
54
  4. Push to the branch (`git push origin my-new-feature`)
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.version = ActiveAdmin::JsonEditor::VERSION
7
7
  spec.authors = ['allanbreyes']
8
8
  spec.email = ['allan@udacity.com']
9
- spec.summary = 'add "json_input" field type to active_admin that allow to edit Postgresql json values'
9
+ spec.summary = 'add "json_input" and "jsonb_input" field type to active_admin that allow to edit Postgresql json and jsonb values'
10
10
  spec.description = '"json_input" field allow to edit json value as json array with using jsoneditor.js from http://jsoneditoronline.org'
11
11
  spec.homepage = 'https://github.com/wild-r/activeadmin_json_editor'
12
12
  spec.license = 'MIT'
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'railties', '>= 3.0', '< 5.0'
22
22
  # spec.add_development_dependency "rake", "~> 0"
23
23
  # spec.add_dependency "active_admin", "~> 1.0.0"
24
+ spec.add_dependency 'ace-rails-ap'
24
25
  end
@@ -4,13 +4,25 @@
4
4
  ;(function(window, $) {
5
5
  $(function() {
6
6
  $('div.jsoneditor-wrap').each(function(i,wrap){
7
+ var fieldset = $(wrap).parents('li:eq(0)');
7
8
  var container = $(wrap)[0];
8
9
  var textarea = $($(wrap).find('textarea'));
9
10
  var editor;
10
11
  var options = {
12
+ modes: ['tree', 'text'],
11
13
  mode: 'tree',
12
14
  change: function(ev){
13
- textarea.text(JSON.stringify(editor.get()));
15
+ try {
16
+ var text = JSON.stringify(editor.get());
17
+ textarea.text(text);
18
+ $(fieldset).toggleClass('error',false);
19
+ textarea.text(JSON.stringify(editor.get()));
20
+ } catch (e) {
21
+ editor.options.error(e);
22
+ }
23
+ },
24
+ error: function(e){
25
+ $(fieldset).toggleClass('error',true);
14
26
  }
15
27
  };
16
28
  editor = new JSONEditor(container, options,JSON.parse(textarea.val()));
@@ -44,3 +44,21 @@
44
44
  .jsoneditor .search .frame {
45
45
  border-color: rgb(201, 208, 214);
46
46
  }
47
+
48
+
49
+ /*
50
+ * Use text mode
51
+ */
52
+ .jsoneditor-wrap textarea.text {
53
+ display: block;
54
+ }
55
+ .jsoneditor .menu button.separator {
56
+ color: black;
57
+ text-shadow: none;
58
+ }
59
+ .jsoneditor-contextmenu ul li button {
60
+ text-shadow: none;
61
+ }
62
+ form fieldset > ol > li.error .jsoneditor {
63
+ border: 1px solid #932419;
64
+ }
@@ -0,0 +1,3 @@
1
+ class JsonbInput < JsonInput
2
+
3
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module JsonEditor
3
- VERSION = '0.0.5'.freeze
3
+ VERSION = '0.0.6'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_json_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - allanbreyes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '5.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: ace-rails-ap
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  description: '"json_input" field allow to edit json value as json array with using
48
62
  jsoneditor.js from http://jsoneditoronline.org'
49
63
  email:
@@ -61,6 +75,7 @@ files:
61
75
  - app/assets/javascripts/active_admin/json_editor.js
62
76
  - app/assets/stylesheets/active_admin/json_editor.css
63
77
  - app/inputs/json_input.rb
78
+ - app/inputs/jsonb_input.rb
64
79
  - lib/activeadmin/json_editor.rb
65
80
  - lib/activeadmin/json_editor/version.rb
66
81
  - lib/activeadmin/resource_dsl.rb
@@ -104,6 +119,6 @@ rubyforge_project:
104
119
  rubygems_version: 2.4.5.1
105
120
  signing_key:
106
121
  specification_version: 4
107
- summary: add "json_input" field type to active_admin that allow to edit Postgresql
108
- json values
122
+ summary: add "json_input" and "jsonb_input" field type to active_admin that allow
123
+ to edit Postgresql json and jsonb values
109
124
  test_files: []