view_component 2.25.0 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/lib/view_component/base.rb +8 -0
- data/lib/view_component/compiler.rb +2 -0
- data/lib/view_component/slot_v2.rb +9 -1
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c411f9f34b25054093f7abe23c5842c7523f083ecdb1ba586429545548eca423
|
4
|
+
data.tar.gz: 744c27c0907544dfb93eb37ecf47c74dd7df86855c0e2b91f9619a77bd8eefc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bee62ecbcfecbc53146b8a8e55207baf2d14769adda2bb2349494a82224acf12fa6584bfc32512e96474f28f011823f2c5712cbc021773d439c43fab8b090503
|
7
|
+
data.tar.gz: 3f519b85b066d89fdf75afb17563cb868bb4fb673caa21326661f0738b9b4398af068421064ca6f77abf08b7b46bdc549c132252b111b8fb3009809d430b9682
|
data/CHANGELOG.md
CHANGED
@@ -2,11 +2,21 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 2.25.1
|
6
|
+
|
7
|
+
* Experimental: call `._after_compile` class method after a component is compiled.
|
8
|
+
|
9
|
+
*Joel Hawksley*
|
10
|
+
|
11
|
+
* Fix bug where SlotV2 was rendered as an HTML string when using Slim.
|
12
|
+
|
13
|
+
*Manuel Puyol*
|
14
|
+
|
5
15
|
## 2.25.0
|
6
16
|
|
7
17
|
* Add `--preview` generator option to create an associated preview file.
|
8
18
|
|
9
|
-
|
19
|
+
*Bob Maerten*
|
10
20
|
|
11
21
|
* Add argument validation to avoid `content` override.
|
12
22
|
|
data/lib/view_component/base.rb
CHANGED
@@ -23,6 +23,14 @@ module ViewComponent
|
|
23
23
|
class_attribute :content_areas
|
24
24
|
self.content_areas = [] # class_attribute:default doesn't work until Rails 5.2
|
25
25
|
|
26
|
+
# EXPERIMENTAL: This API is experimental and may be removed at any time.
|
27
|
+
# Hook for allowing components to do work as part of the compilation process.
|
28
|
+
#
|
29
|
+
# For example, one might compile component-specific assets at this point.
|
30
|
+
def self._after_compile
|
31
|
+
# noop
|
32
|
+
end
|
33
|
+
|
26
34
|
# Entrypoint for rendering components.
|
27
35
|
#
|
28
36
|
# view_context: ActionView context from calling view
|
@@ -22,8 +22,10 @@ module ViewComponent
|
|
22
22
|
# If there is no slot renderable, we evaluate the block passed to
|
23
23
|
# the slot and return it.
|
24
24
|
def to_s
|
25
|
+
return @content if defined?(@content)
|
26
|
+
|
25
27
|
view_context = @parent.send(:view_context)
|
26
|
-
view_context.capture do
|
28
|
+
@content = view_context.capture do
|
27
29
|
if defined?(@_component_instance)
|
28
30
|
# render_in is faster than `parent.render`
|
29
31
|
@_component_instance.render_in(view_context, &@_content_block)
|
@@ -33,6 +35,8 @@ module ViewComponent
|
|
33
35
|
@_content_block.call
|
34
36
|
end
|
35
37
|
end
|
38
|
+
|
39
|
+
@content
|
36
40
|
end
|
37
41
|
|
38
42
|
# Allow access to public component methods via the wrapper
|
@@ -58,6 +62,10 @@ module ViewComponent
|
|
58
62
|
@_component_instance.public_send(symbol, *args, &block)
|
59
63
|
end
|
60
64
|
|
65
|
+
def html_safe?
|
66
|
+
to_s.html_safe?
|
67
|
+
end
|
68
|
+
|
61
69
|
def respond_to_missing?(symbol, include_all = false)
|
62
70
|
defined?(@_component_instance) && @_component_instance.respond_to?(symbol, include_all)
|
63
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.25.
|
4
|
+
version: 2.25.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|