administrate-field-jsonb 0.4.0 → 0.4.1

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: f063b7cfbb398bbce63a6be7cb36600c9eb1855b
4
- data.tar.gz: 4d6546c1ad1d4fa2b044143af2718b401543d3d2
3
+ metadata.gz: '016868c28cd126c1217bed6c8f2efe95322e5505'
4
+ data.tar.gz: 8c39f90fcbbda6711cd8df1fa4335155b2c37153
5
5
  SHA512:
6
- metadata.gz: 82b867137242cdcc301d81e95b23f7341db12ed53aaf1340e7547fd8f87dbc05523726fee627c4bf5c677a6636dc56d951e9f7ef7a45b606a2589aad35ea1bab
7
- data.tar.gz: 91b0ed65ecc649447841b0727fb021d811dc9c44d8c4b5e70c0e24c96f561d201e80a1d8fee8a5b447e5db2977f9b766b2ed2873b2107317ed35f3de942f4b9c
6
+ metadata.gz: 0ac43093244dc82f4a54443b510de3ed26831be95a33f43ba3d15827fd1c0a4c55c8063ec9caad4842f07e0388bf54b02e9cb497fafa98b8dc640c09a77a47bf
7
+ data.tar.gz: d827c6cb1a50b581c0757cdadb68a56ba5fd888cf7a626a30cd62ca72b1a4a953d4a71c8cc133fda363fadd78b5b38f01b7770baa77307fef207b55e4b06834f
data/README.md CHANGED
@@ -58,7 +58,18 @@ ATTRIBUTE_TYPES = {
58
58
  }.freeze
59
59
  ```
60
60
 
61
- NOTE: don't define `advanced_view` option if you want to display you JSON with the [jsoneditor](https://github.com/josdejong/jsoneditor).
61
+ NOTE: don't define `advanced_view` option if you want to display JSON with the [jsoneditor](https://github.com/josdejong/jsoneditor).
62
+
63
+ To customize what to display if you have an empty value, use `blank_sign` option, by default it's `-`.
64
+
65
+ ```ruby
66
+ ATTRIBUTE_TYPES = {
67
+ # ...
68
+ details: Field::JSONB.with_options(
69
+ blank_sign: 'oops, missed'
70
+ )
71
+ }.freeze
72
+ ```
62
73
 
63
74
  ## How it looks like
64
75
 
@@ -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.0'
5
+ gem.version = '0.4.1'
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'
@@ -1,5 +1,5 @@
1
1
  <% if field.transform.blank? %>
2
- <%= render field.to_partial_path('field'), type: ::Administrate::Field::String, key: field.attribute, value: '' %>
2
+ <%= field.blank_sign %>
3
3
  <% elsif field.advanced_view? %>
4
4
  <dl class='administrate-field-jsonb-wrapper'>
5
5
  <% if field.array? %>
@@ -35,6 +35,10 @@ module Administrate
35
35
  "/fields/jsonb/#{partial}"
36
36
  end
37
37
 
38
+ def blank_sign
39
+ options[:blank_sign] || '-'
40
+ end
41
+
38
42
  class Engine < ::Rails::Engine
39
43
 
40
44
  Administrate::Engine.add_javascript 'administrate-field-jsonb/application'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-field-jsonb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Volkov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-15 00:00:00.000000000 Z
12
+ date: 2019-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: administrate