simple_model_view 0.1.4 → 0.1.5

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: 164311a9bb5ffabe4d687523face9a09ec8c060d056d8b1f5f79f97174c525e7
4
- data.tar.gz: 60e15aa8e5810c0d8de9ede3b17cac55f4cbb0460f4cf120075e715041b48ecd
3
+ metadata.gz: e4b832cc0f2224c2912daf65fa7376b2a9f42e7335ce98ff9da0d97f1d9e2ee5
4
+ data.tar.gz: 04d5692291d958a2650f1a182d3a4e9e2b2d5963b0622b387e88aee80bb712f6
5
5
  SHA512:
6
- metadata.gz: 64b3dedbb5ee9c72e9b8927a16f20c0039c4443f701870aa17dcdcd124b83a8447d18ce47a333bf66fa1603287d4c143bea0cd4864b67a3eb00bcd2d487d3d8a
7
- data.tar.gz: 8704db907d53e9259fa4962189497bf96d810d36bc36d4e31a110509d4012227d36b00094344bcd29e6927309f7cc20584ac1bd2d5268bffc8e4df59e7079d31
6
+ metadata.gz: 5216e91596e617b8f22ee3e89692180ac823687db753906ceb95ae5d1e500c03468a09df71d5b5c646c5018f1573b2b904a2c819cbc3b149be601299c9403f69
7
+ data.tar.gz: 9ee99c2fb1a631080173bcb3ecb2d4adfc706f1c91e681d6d207c8a0dce1eafb49a7b10f500cfb38303519f7d6881d6991ce3093e35b83aaeb61e8f7caab586a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.5
2
+ * no_blank_block options is added
3
+ * translation for empty span
4
+
1
5
  ## 0.1.4
2
6
  * Fixed bug with rendering collection with block
3
7
  * Updated rack to 2.0.8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_model_view (0.1.4)
4
+ simple_model_view (0.1.5)
5
5
  actionview (>= 5.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -95,6 +95,8 @@ Renders model attributes table using simple helpers.
95
95
 
96
96
  `<%= t.row :price, format: '%.2f' %>`
97
97
 
98
+ * `no_blank_block` if `true` it will render blank span instead of block for `nil` value
99
+
98
100
  ### Options for `row`
99
101
 
100
102
  * `label_html` is a hash of html attributes to be added to label (th tag)
@@ -110,7 +110,10 @@ module SimpleModelView # rubocop:disable
110
110
  end
111
111
 
112
112
  def format_value_or_block(value, type, **options, &block)
113
- return yield value if block
113
+ if block
114
+ return blank_span if value.nil? && options[:no_blank_block]
115
+ return yield value
116
+ end
114
117
  return blank_span if value.nil?
115
118
 
116
119
  format value, type, **options
@@ -7,7 +7,7 @@ module SimpleModelView
7
7
  end
8
8
 
9
9
  def blank_span
10
- template.content_tag :span, 'empty', class: :empty
10
+ template.content_tag :span, I18n.t('simple_model_view.empty'), class: :empty
11
11
  end
12
12
 
13
13
  def merge_html_attrs(default, input)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleModelView
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_model_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuriy Esaulov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-30 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview