view_component 4.0.0.rc4 → 4.0.0.rc5
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/docs/CHANGELOG.md +14 -0
- data/lib/view_component/base.rb +0 -6
- data/lib/view_component/compiler.rb +0 -10
- data/lib/view_component/template.rb +2 -2
- data/lib/view_component/version.rb +1 -1
- 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: 2022f4dafcbde4a0b374fc19399e58a9a7ff97ba64b3567de75ec24c9bb9e8eb
|
4
|
+
data.tar.gz: 2936979e68ecbe66cc0cc0b8a9ab77064265cb4d0763974daa6eb22c4b2a4e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c124cc7b4de10d07896f5c1fd80a2533a606f29de5406836b6d63968261e1de54e1cbe682879a2e20fe66e3173f1178111ce5047177b9130ac359cbdb7b759d0
|
7
|
+
data.tar.gz: 228eee5270b9d0b6d2ac0395151255759fb73faea87365a79fc42b301b7d5ddac0f6d260f040a5801981a067f84f02735624236af86937ed5eee7a2080aad2c9
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,20 @@ nav_order: 6
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## 4.0.0.rc5
|
14
|
+
|
15
|
+
* Revert change setting `#format`. In GitHub's codebase, the change led to hard-to-detect failures. For example, components rendered from controllers included layouts when they didn't before. In other cases, the response `content_type` changed, breaking downstream consumers. For cases where a specific content type is needed, use:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
respond_to do |f|
|
19
|
+
f.html_fragment do
|
20
|
+
render(MyComponent.new)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
*Joel Hawksley*
|
26
|
+
|
13
27
|
## 4.0.0.rc4
|
14
28
|
|
15
29
|
* Fix issue where generators were not included in published gem.
|
data/lib/view_component/base.rb
CHANGED
@@ -71,8 +71,6 @@ module ViewComponent
|
|
71
71
|
# Config option that strips trailing whitespace in templates before compiling them.
|
72
72
|
class_attribute :__vc_strip_trailing_whitespace, instance_accessor: false, instance_predicate: false, default: false
|
73
73
|
|
74
|
-
class_attribute :__vc_response_format, instance_accessor: false, instance_predicate: false, default: nil
|
75
|
-
|
76
74
|
attr_accessor :__vc_original_view_context
|
77
75
|
attr_reader :current_template
|
78
76
|
|
@@ -356,10 +354,6 @@ module ViewComponent
|
|
356
354
|
__vc_render_in_block_provided? || __vc_content_set_by_with_content_defined?
|
357
355
|
end
|
358
356
|
|
359
|
-
def format
|
360
|
-
self.class.__vc_response_format
|
361
|
-
end
|
362
|
-
|
363
357
|
# @private
|
364
358
|
def with_original_virtual_path
|
365
359
|
@view_context.instance_variable_set(:@virtual_path, @old_virtual_path)
|
@@ -48,15 +48,6 @@ module ViewComponent
|
|
48
48
|
|
49
49
|
define_render_template_for
|
50
50
|
|
51
|
-
# Set the format if the component only responds to a single format.
|
52
|
-
# Unfortunately we cannot determine which format a multi-format
|
53
|
-
# component will respond to until render time, so those components
|
54
|
-
# will not set the response format.
|
55
|
-
#
|
56
|
-
# TODO: Investigate upstream changes necessary to support multi-format renderables
|
57
|
-
unique_formats = templates.map(&:format).uniq
|
58
|
-
@component.__vc_response_format = unique_formats.last if unique_formats.one?
|
59
|
-
|
60
51
|
@component.__vc_register_default_slots
|
61
52
|
@component.__vc_build_i18n_backend
|
62
53
|
|
@@ -118,7 +109,6 @@ module ViewComponent
|
|
118
109
|
errors << "Couldn't find a template file or inline render method for #{@component}." if @templates.empty?
|
119
110
|
|
120
111
|
@templates
|
121
|
-
.reject { |template| template.inline_call? && !template.defined_on_self? }
|
122
112
|
.map { |template| [template.variant, template.format] }
|
123
113
|
.tally
|
124
114
|
.select { |_, count| count > 1 }
|
@@ -43,7 +43,7 @@ module ViewComponent
|
|
43
43
|
attr_reader :source
|
44
44
|
|
45
45
|
def initialize(component:, inline_template:)
|
46
|
-
details = ActionView::TemplateDetails.new(nil, inline_template.language.to_sym,
|
46
|
+
details = ActionView::TemplateDetails.new(nil, inline_template.language.to_sym, nil, nil)
|
47
47
|
|
48
48
|
super(
|
49
49
|
component: component,
|
@@ -63,7 +63,7 @@ module ViewComponent
|
|
63
63
|
class InlineCall < Template
|
64
64
|
def initialize(component:, method_name:, defined_on_self:)
|
65
65
|
variant = method_name.to_s.include?("call_") ? method_name.to_s.sub("call_", "").to_sym : nil
|
66
|
-
details = ActionView::TemplateDetails.new(nil, nil,
|
66
|
+
details = ActionView::TemplateDetails.new(nil, nil, nil, variant)
|
67
67
|
|
68
68
|
super(component: component, details: details)
|
69
69
|
|