administrate-field-jsonb 0.4.0 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +21 -1
- data/administrate-field-jsonb.gemspec +2 -2
- data/app/assets/javascripts/administrate-field-jsonb/components/accordion.js +2 -2
- data/app/assets/javascripts/administrate-field-jsonb/components/editor.js +3 -3
- data/app/assets/javascripts/administrate-field-jsonb/components/viewer.js +1 -1
- data/app/assets/stylesheets/administrate-field-jsonb/application.css +1 -1
- data/app/views/fields/jsonb/_show.html.erb +1 -1
- data/lib/administrate/field/jsonb.rb +4 -0
- data/vendor/assets/stylesheets/jsoneditor.scss +2051 -0
- metadata +7 -14
- data/vendor/assets/stylesheets/jsoneditor.min.css +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4d1b00158b771122554eee9bf66a5ea9be2531a154a39599824cca08b2580736
|
4
|
+
data.tar.gz: c189cf1d7a7c7599af35a9935c057a6e6a3064cb8bb13c422031b86ad3ad2151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef54adbd97f8dfd9151af88e419eb26dd78c88fee1c4b7eebe790c6d4514f24c363f732c348c12789ef268c24b596e96b025717db46829fe9a3a128d535bcb45
|
7
|
+
data.tar.gz: 9c2d9180b29c40f42f98b0c73de7b9efa8998cfdd3aeb3b54f8039fd165b761c6bc60c245e11ff1792512a182de6dd6fe646aa9ae658307d10fe29e93ff11788
|
data/README.md
CHANGED
@@ -18,6 +18,15 @@ And then execute:
|
|
18
18
|
bundle
|
19
19
|
```
|
20
20
|
|
21
|
+
If you are using asset pipeline, add the following lines to your `manifest.js`:
|
22
|
+
|
23
|
+
```js
|
24
|
+
//= link administrate-field-jsonb/application.css
|
25
|
+
//= link administrate-field-jsonb/application.js
|
26
|
+
```
|
27
|
+
|
28
|
+
The manifest file is at `app/assets/config` by default.
|
29
|
+
|
21
30
|
## Usage
|
22
31
|
|
23
32
|
```ruby
|
@@ -58,7 +67,18 @@ ATTRIBUTE_TYPES = {
|
|
58
67
|
}.freeze
|
59
68
|
```
|
60
69
|
|
61
|
-
NOTE: don't define `advanced_view` option if you want to display
|
70
|
+
NOTE: don't define `advanced_view` option if you want to display JSON with the [jsoneditor](https://github.com/josdejong/jsoneditor).
|
71
|
+
|
72
|
+
To customize what to display if you have an empty value, use `blank_sign` option, by default it's `-`.
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
ATTRIBUTE_TYPES = {
|
76
|
+
# ...
|
77
|
+
details: Field::JSONB.with_options(
|
78
|
+
blank_sign: 'oops, missed'
|
79
|
+
)
|
80
|
+
}.freeze
|
81
|
+
```
|
62
82
|
|
63
83
|
## How it looks like
|
64
84
|
|
@@ -2,7 +2,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'administrate-field-jsonb'
|
5
|
-
gem.version = '0.4.
|
5
|
+
gem.version = '0.4.4'
|
6
6
|
gem.authors = ['Sergey Volkov', 'Codica']
|
7
7
|
gem.email = ['sergvolkov.codica@gmail.com']
|
8
8
|
gem.homepage = 'https://github.com/codica2/administrate-field-jsonb'
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
|
17
17
|
gem.add_runtime_dependency 'administrate', '< 1.0.0'
|
18
|
-
gem.add_runtime_dependency 'rails', '>= 4.2'
|
18
|
+
gem.add_runtime_dependency 'rails', '>= 4.2'
|
19
19
|
|
20
20
|
gem.add_development_dependency 'rspec', '~> 3.7'
|
21
21
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
$(function
|
2
|
-
$(".administrate-field-jsonb-accordion").each(function
|
1
|
+
$(document).on(typeof Turbolinks === 'undefined' ? 'ready' : 'turbolinks:load', function() {
|
2
|
+
$(".administrate-field-jsonb-accordion").each(function() {
|
3
3
|
$(this).click(function() {
|
4
4
|
$(this).toggleClass("administrate-field-jsonb-active").next().toggle();
|
5
5
|
});
|
@@ -1,6 +1,6 @@
|
|
1
|
-
$(function
|
1
|
+
$(document).on(typeof Turbolinks === 'undefined' ? 'ready' : 'turbolinks:load', function() {
|
2
2
|
let editor, updatedJson;
|
3
|
-
$('.administrate-jsoneditor').each(function
|
3
|
+
$('.administrate-jsoneditor').each(function(index) {
|
4
4
|
|
5
5
|
let $current = $(this).find("textarea");
|
6
6
|
|
@@ -14,7 +14,7 @@ $(function () {
|
|
14
14
|
|
15
15
|
$current.val(JSON.stringify(updatedJson));
|
16
16
|
},
|
17
|
-
onError: function
|
17
|
+
onError: function(err) {
|
18
18
|
alert(err.toString());
|
19
19
|
},
|
20
20
|
navigationBar: false,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if field.transform.blank? %>
|
2
|
-
<%=
|
2
|
+
<%= field.blank_sign %>
|
3
3
|
<% elsif field.advanced_view? %>
|
4
4
|
<dl class='administrate-field-jsonb-wrapper'>
|
5
5
|
<% if field.array? %>
|