th_simple_data_presentation 0.1.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/simple_data_presentation/html_options.rb +2 -0
- data/lib/simple_data_presentation/simple_data_list/base.rb +5 -1
- data/lib/simple_data_presentation/simple_table/head.rb +1 -1
- data/lib/simple_data_presentation/simple_table/row.rb +5 -1
- data/lib/simple_data_presentation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTZlN2FhYzFjNWY5YmE1OGNkNDU1MzdlZDMzMzE2ZDUwYTliM2JlZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTYxMTEyOGViMjRlZDczMGQyY2YyM2VjZmMyMTEyOWU5NWEwNTYyOA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmM4Y2JkNTg5ZTM2M2VkZGYxM2E2NjNlMzEyN2RjNGE4Mzg5MzQyM2Q0MjNm
|
10
|
+
MzlhZWY3OGU4MGQ1NjNiMjlmNGZjN2ViODRmZjUxYmU2YzdjOWJhY2RkYWFh
|
11
|
+
MTExY2M3NGVmZWI0Yjc0NThmZDg1YjgwMzZmYTM4ZGZkODA0NmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODdmODM5YTY5MGRlMDViODVjY2YyYzhmNGJjNjE2NzkwY2I0MDkwYmZiYzM4
|
14
|
+
NTU5YTE1ZmIyODJkY2FjNjY5MzRlM2M5ZDI2NDY2YTQ1ZTVmMTNiZWExOTNl
|
15
|
+
YjAwMmY2ZDBmZDc0MTNmOGRiNGQ0YzQzNzlhYWQ0YjkxN2Q5ZGQ=
|
@@ -5,6 +5,8 @@ class SimpleDataPresentation::HtmlOptions < HashWithIndifferentAccess
|
|
5
5
|
value.nil? ? nil : (self[key].present? ? self[key].to_s << " #{value}" : "#{value}")
|
6
6
|
when "data"
|
7
7
|
value.is_a?(Hash) ? (self[key].is_a?(Hash) ? self[key].merge(value) : value.with_indifferent_access) : value
|
8
|
+
when "style"
|
9
|
+
value.nil? ? nil : (self[key].present? ? self[key].to_s << " #{value}" : "#{value}")
|
8
10
|
else
|
9
11
|
"#{value}"
|
10
12
|
end
|
@@ -34,7 +34,11 @@ class SimpleDataPresentation::SimpleDataList::Base
|
|
34
34
|
if block.present?
|
35
35
|
content = @context.capture @resource, &block
|
36
36
|
else
|
37
|
-
|
37
|
+
if (value_option = options[:value]).present?
|
38
|
+
content = value_option.respond_to?(:call) ? value_option.call(@resource) : value_option
|
39
|
+
else
|
40
|
+
content = value_for_method_chain *args
|
41
|
+
end
|
38
42
|
as_formatter = options[:as]
|
39
43
|
if as_formatter.present?
|
40
44
|
as_formatter = @context.method(as_formatter).to_proc if as_formatter.is_a?(Symbol)
|
@@ -3,7 +3,7 @@ class SimpleDataPresentation::SimpleTable::Head < SimpleDataPresentation::Simple
|
|
3
3
|
@context = context
|
4
4
|
@options = options
|
5
5
|
@resource_class = resource_class
|
6
|
-
@search = @context.instance_variable_get(:"@search") if @context.instance_variable_get(:"@search").present? && @context.instance_variable_get(:"@search").
|
6
|
+
@search = @context.instance_variable_get(:"@search") if @context.instance_variable_get(:"@search").present? && @context.instance_variable_get(:"@search").klass == @resource_class
|
7
7
|
@content_block = content_block
|
8
8
|
end
|
9
9
|
|
@@ -11,7 +11,11 @@ class SimpleDataPresentation::SimpleTable::Row < SimpleDataPresentation::SimpleT
|
|
11
11
|
if block.present?
|
12
12
|
content = @context.capture @resource, &block
|
13
13
|
else
|
14
|
-
|
14
|
+
if (value_option = options[:value]).present?
|
15
|
+
content = value_option.respond_to?(:call) ? value_option.call(@resource) : value_option
|
16
|
+
else
|
17
|
+
content = value_for_method_chain *args
|
18
|
+
end
|
15
19
|
as_formatter = options[:as]
|
16
20
|
if as_formatter.present?
|
17
21
|
as_formatter = @context.method(as_formatter).to_proc if as_formatter.is_a?(Symbol)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: th_simple_data_presentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Hinloopen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Collection of visual helpers
|
14
14
|
email:
|