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 +4 -4
- data/lib/iquest/simple_table/table_builder.rb +19 -4
- data/lib/iquest/simple_table/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09b641c1701185c2668a73f4707ce1a77d7caee5
|
4
|
+
data.tar.gz: ca666022e049a175bd90b16a04d28d380874fa6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
228
|
-
|
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
|
-
|
248
|
+
object = args.first
|
249
|
+
value = args.second
|
242
250
|
if block_given?
|
243
|
-
block.
|
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
|