iquest-simple_table 0.1.7 → 0.2.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: 7ab59378988a3966d251551b568147b400a333c9
4
- data.tar.gz: 5dfc55a27e2721ea26cd6a7fa75c2c949a653700
3
+ metadata.gz: 09b641c1701185c2668a73f4707ce1a77d7caee5
4
+ data.tar.gz: ca666022e049a175bd90b16a04d28d380874fa6d
5
5
  SHA512:
6
- metadata.gz: f334c5745d16a39c1a68cd9ca8b466a9da4a710162771d13051026decb6fdc4f523300b4781f2d4e1e0af0cc0658ace95502401b6d95f85baa298876476452e3
7
- data.tar.gz: 203a8bd294eed93ac7c71676073021a6c1496d2376d190d169ec3194783e4cddd04572ed9c4bbad9420c28fba2deca60d94be80586e306a9d76814cf78635f2c
6
+ metadata.gz: f1d312f4d1a3a98eed3618877e6dde9cfebad2937304261f4ff00c3c0f9a6c61001c7f45cbb42bcf52d7ffebcb5bd11b20138b58bb7fe6bbab2df2fad305c66b
7
+ data.tar.gz: 37097a334b9c2a2eb7f7d4ecd24215fd4294a44f02562f7d0fef5fa5fadf21d88c548592b35391bb5df51cacf736dde336495659c7d5694b5683cded5df4a3a3
@@ -224,8 +224,11 @@ module Iquest
224
224
  obj = args.second
225
225
  value = get_value(attr, obj)
226
226
  formatter = options[:formatter]
227
- content_tag :td, class: options[:class] do
228
- render_value(value, &formatter)
227
+ cell_value = render_value(obj, value, &formatter)
228
+ cell_class = "rowlink-skip" if include_link?(cell_value)
229
+ cell_class = "#{cell_class} options[:class]"
230
+ content_tag :td, class: cell_class do
231
+ cell_value
229
232
  end
230
233
  end
231
234
 
@@ -237,10 +240,22 @@ module Iquest
237
240
  end
238
241
  end
239
242
 
243
+ def include_link?(string)
244
+ string.try(:include?, '<a')
245
+ end
246
+
240
247
  def render_value(*args, &block)
241
- value = args.first
248
+ object = args.first
249
+ value = args.second
242
250
  if block_given?
243
- block.call(value)
251
+ case block.arity
252
+ when 1
253
+ block.call(value)
254
+ when 2
255
+ block.call(object, value)
256
+ else
257
+ block.call
258
+ end
244
259
  else
245
260
  format_value(value)
246
261
  end
@@ -1,5 +1,5 @@
1
1
  module Iquest
2
2
  module SimpleTable
3
- VERSION = "0.1.7"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iquest-simple_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Dusanek