props_template 1.0.0.alpha.2 → 1.0.0.alpha.3
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 +4 -4
- data/lib/props_template/layout_patch.rb +1 -1
- data/lib/props_template/searcher.rb +16 -4
- data/lib/props_template/version.rb +1 -1
- data/lib/props_template.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47eaa94bedc38645ef945eb7308cdc257497b063b5a9df481d491ec3bb1ae3ca
|
4
|
+
data.tar.gz: 48da4764807eb7924b224e98175f81c822a67e6ead927904df452d620d39e6e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40c1e3bfc2c99a3b37834abec4e9b8463d4585203583f9f2f7ba710d775e714a7950bf1bf60f9d86b67c34de6742a5b5a0d249e0154fb50736288123e9ebb1e4
|
7
|
+
data.tar.gz: 70953db156e838cf72b220f9549c3a4abc6684d5bf0b0ad8a6305b15abf56cd1bd876635248fa2c8f1e43f21241475716d1dca49605fe65279951a8f2e59ed84
|
@@ -3,7 +3,7 @@ module Props
|
|
3
3
|
def render_template(view, template, layout_name, locals)
|
4
4
|
if !view.respond_to?(:active_template_virtual_path) && template.respond_to?(:virtual_path)
|
5
5
|
view.instance_eval <<~RUBY, __FILE__, __LINE__ + 1
|
6
|
-
def active_template_virtual_path; "#{template.virtual_path}";end
|
6
|
+
def active_template_virtual_path; @_active_template_virtual_path || "#{template.virtual_path}";end
|
7
7
|
RUBY
|
8
8
|
end
|
9
9
|
|
@@ -33,11 +33,12 @@ module Props
|
|
33
33
|
fragment_name = Fragment.fragment_name_from_options(pass_opts)
|
34
34
|
if fragment_name
|
35
35
|
@fragment_name = fragment_name
|
36
|
-
@
|
36
|
+
@fragment_path = @traveled_path.clone
|
37
37
|
end
|
38
38
|
|
39
39
|
fragment_context = @fragment_name
|
40
|
-
|
40
|
+
|
41
|
+
[@found_block, @traveled_path, pass_opts, @fragment_path, fragment_context]
|
41
42
|
end
|
42
43
|
|
43
44
|
def set_block_content!(*args)
|
@@ -61,7 +62,7 @@ module Props
|
|
61
62
|
fragment_name = Fragment.fragment_name_from_options(options)
|
62
63
|
if fragment_name
|
63
64
|
@fragment_name = fragment_name
|
64
|
-
@
|
65
|
+
@fragment_path = @traveled_path.clone
|
65
66
|
end
|
66
67
|
|
67
68
|
@partialer.handle(options)
|
@@ -96,6 +97,17 @@ module Props
|
|
96
97
|
|
97
98
|
if item
|
98
99
|
pass_opts = @partialer.refine_options(options, item)
|
100
|
+
|
101
|
+
if (key = pass_opts[:key])
|
102
|
+
val = if item.respond_to? key
|
103
|
+
item.send(key)
|
104
|
+
elsif item.is_a? Hash
|
105
|
+
item[key] || item[key.to_sym]
|
106
|
+
end
|
107
|
+
|
108
|
+
pass_opts[:key] = [pass_opts[:key], val]
|
109
|
+
end
|
110
|
+
|
99
111
|
@traveled_path.push(key_index)
|
100
112
|
|
101
113
|
if @depth == @search_path.size - 1
|
@@ -111,7 +123,7 @@ module Props
|
|
111
123
|
fragment_name = Fragment.fragment_name_from_options(pass_opts)
|
112
124
|
if fragment_name
|
113
125
|
@fragment_name = fragment_name
|
114
|
-
@
|
126
|
+
@fragment_path = @traveled_path.clone
|
115
127
|
end
|
116
128
|
# todo: what happens when cached: true is passed?
|
117
129
|
# would there be any problems with not using the collection_rende?
|
data/lib/props_template.rb
CHANGED
@@ -51,10 +51,11 @@ module Props
|
|
51
51
|
options.delete(:dig)
|
52
52
|
|
53
53
|
@builder.set!(key, options, &block)
|
54
|
-
found_block, found_path, found_options, fragment_context = @builder.found!
|
54
|
+
found_block, found_path, found_options, fragment_path, fragment_context = @builder.found!
|
55
55
|
@found_path = found_path || []
|
56
56
|
@fragment_context = fragment_context
|
57
57
|
@builder = prev_builder
|
58
|
+
@fragment_path = fragment_path
|
58
59
|
|
59
60
|
if found_block
|
60
61
|
set!(key, found_options, &found_block)
|
@@ -69,7 +70,7 @@ module Props
|
|
69
70
|
end
|
70
71
|
|
71
72
|
def found_path!
|
72
|
-
@found_path.join(".")
|
73
|
+
@found_path[@fragment_path.size..].join(".")
|
73
74
|
end
|
74
75
|
|
75
76
|
def fragment_context!
|