roda-component 0.1.65 → 0.1.66
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/roda/component.rb +13 -11
- data/lib/roda/component/events.rb +1 -1
- data/lib/roda/component/form.rb +1 -1
- data/lib/roda/component/version.rb +1 -1
- data/lib/roda/plugins/component.rb +2 -2
- 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: 23c5468778c982bcaa2ccfce82c5172a4e74e1f8
|
4
|
+
data.tar.gz: 82aa7a44b790a0861f9ab6a71181219465ee5693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e824c8d84f59329bc3223f3aaa939ea6d53d9d33b5afbc2f2986a9ac8b6e3af41d195a16fb7e4c28beab7986097bef992cdbf4dd156a48530801692680f4347
|
7
|
+
data.tar.gz: 5d19cb6664d78019e88c471d6ebb2cc68e86d762464908dcb0ab97d603572b15e70807b02242625853b1a148af7a1faca9a227dff3d3e23b9ac0d9728a61b72d
|
data/lib/roda/component.rb
CHANGED
@@ -31,16 +31,18 @@ unless RUBY_ENGINE == 'opal'
|
|
31
31
|
module Nokogiri
|
32
32
|
module XML
|
33
33
|
class NodeSet
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
# fix: this is really shity
|
35
|
+
alias_method :original_to_html, :to_html
|
36
|
+
def to_html *args
|
37
|
+
original_to_html(*args).gsub(/%7B(|;)/, "{").gsub(/%7D(|;)/, "}")
|
38
|
+
end
|
38
39
|
end
|
39
40
|
class Node
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
# fix: this is really shity
|
42
|
+
alias_method :original_to_html, :to_html
|
43
|
+
def to_html *args
|
44
|
+
original_to_html(*args).gsub(/%7B(|;)/, "{").gsub(/%7D(|;)/, "}")
|
45
|
+
end
|
44
46
|
|
45
47
|
private
|
46
48
|
|
@@ -271,7 +273,7 @@ class Roda
|
|
271
273
|
cache[:html] = yield
|
272
274
|
end
|
273
275
|
|
274
|
-
cache[:html] = cache[:html]
|
276
|
+
cache[:html] = cache[:html]
|
275
277
|
cache[:dom] = DOM.new(cache[:html])
|
276
278
|
end
|
277
279
|
end
|
@@ -341,7 +343,7 @@ class Roda
|
|
341
343
|
def tmpl name, dom = false, remove = true
|
342
344
|
if dom
|
343
345
|
cache[:tmpl][name] = { dom: remove ? dom.remove : dom }
|
344
|
-
cache[:tmpl][name][:html] = cache[:tmpl][name][:dom].
|
346
|
+
cache[:tmpl][name][:html] = cache[:tmpl][name][:dom].to_html
|
345
347
|
cache[:tmpl][name]
|
346
348
|
elsif t = cache[:tmpl][name]
|
347
349
|
DOM.new t[:html]
|
@@ -389,7 +391,7 @@ class Roda
|
|
389
391
|
def dom
|
390
392
|
if server?
|
391
393
|
# TODO: duplicate cache[:dom] so we don't need to parse all the html again
|
392
|
-
@_dom ||= DOM.new(cache[:dom].dom.
|
394
|
+
@_dom ||= DOM.new(cache[:dom].dom.to_html)
|
393
395
|
else
|
394
396
|
@_dom ||= DOM.new(Element)
|
395
397
|
end
|
@@ -123,7 +123,7 @@ class Roda
|
|
123
123
|
response = Component::Instance.new(component(comp), scope).instance_exec options, &block
|
124
124
|
|
125
125
|
if response.is_a? Roda::Component::DOM
|
126
|
-
content = response.
|
126
|
+
content = response.to_html
|
127
127
|
else
|
128
128
|
content = response
|
129
129
|
end
|
data/lib/roda/component/form.rb
CHANGED
@@ -224,7 +224,7 @@ class Roda
|
|
224
224
|
if client?
|
225
225
|
field_error_dom = DOM.new(`#{tmpl.dom}[0].outerHTML`)
|
226
226
|
else
|
227
|
-
field_error_dom = DOM.new(tmpl.dom.
|
227
|
+
field_error_dom = DOM.new(tmpl.dom.to_html)
|
228
228
|
end
|
229
229
|
else
|
230
230
|
field_error_dom = DOM.new('<span class="field-error"><span>')
|
@@ -64,7 +64,7 @@ class Roda
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def loaded_component_js
|
67
|
-
request.env['loaded_component_js'] ||= []
|
67
|
+
request ? (request.env['loaded_component_js'] ||= []) : (@_loaded_component_js ||= [])
|
68
68
|
end
|
69
69
|
|
70
70
|
def load_component name, options = {}
|
@@ -183,7 +183,7 @@ class Roda
|
|
183
183
|
load_component_js comp, action, options
|
184
184
|
|
185
185
|
if js && comp_response.is_a?(Roda::Component::DOM)
|
186
|
-
comp_response = comp_response.
|
186
|
+
comp_response = comp_response.to_html
|
187
187
|
end
|
188
188
|
|
189
189
|
if comp_response.is_a?(String) && js
|