view_component 3.8.0 → 3.11.0
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 +93 -0
- data/lib/rails/generators/locale/component_generator.rb +3 -3
- data/lib/view_component/base.rb +58 -4
- data/lib/view_component/compiler.rb +8 -2
- data/lib/view_component/engine.rb +14 -0
- data/lib/view_component/preview.rb +5 -1
- data/lib/view_component/rails/tasks/view_component.rake +2 -1
- data/lib/view_component/slotable.rb +6 -6
- data/lib/view_component/test_helpers.rb +10 -2
- data/lib/view_component/translatable.rb +11 -4
- data/lib/view_component/version.rb +1 -1
- metadata +147 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dad3e67f83aa23cac53f816d751a652b229a1cbee327e753dbcdb9814549cf03
|
4
|
+
data.tar.gz: 15e2fdafbb4132567a3b81bfeb7723704ffc5824aa82eb8083f2f79f48505ad3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fc84bada7187832e5cf4dba96b864e177260f6db88d9b9af78bee95b11ce7a3197d59d1f1171a9b4f473c62230e385b5b922b0536084c86ee73b80e6b9d293d
|
7
|
+
data.tar.gz: 100e6e5e8f7d06848790906ee5b6ecc106a53d3c018c7bccfd303097ec2c126ee4511b409ff42513ae3b98ac7441cf6c0ecd1f0d0404b936529c78e8fdebef88
|
data/docs/CHANGELOG.md
CHANGED
@@ -10,6 +10,88 @@ nav_order: 5
|
|
10
10
|
|
11
11
|
## main
|
12
12
|
|
13
|
+
## 3.11.0
|
14
|
+
|
15
|
+
* Fix running non-integration tests under Rails main.
|
16
|
+
|
17
|
+
*Cameron Dutro*
|
18
|
+
|
19
|
+
* Better name and link for Avo.
|
20
|
+
|
21
|
+
*Adrian Marin*
|
22
|
+
|
23
|
+
* Document using rack-mini-profiler with ViewComponent.
|
24
|
+
|
25
|
+
*Thomas Carr*
|
26
|
+
|
27
|
+
* Move dependencies to gemspec.
|
28
|
+
|
29
|
+
*Joel Hawksley*
|
30
|
+
|
31
|
+
* Include ViewComponent::UseHelpers by default.
|
32
|
+
|
33
|
+
*Reegan Viljoen*
|
34
|
+
|
35
|
+
* Bump `puma` in Gemfile.lock.
|
36
|
+
|
37
|
+
*Cameron Dutro*
|
38
|
+
|
39
|
+
* Add Keenly to users list.
|
40
|
+
|
41
|
+
*Vinoth*
|
42
|
+
|
43
|
+
## 3.10.0
|
44
|
+
|
45
|
+
* Fix html escaping in `#call` for non-strings.
|
46
|
+
|
47
|
+
*Reegan Viljoen, Cameron Dutro*
|
48
|
+
|
49
|
+
* Add `output_preamble` to match `output_postamble`, using the same safety checks.
|
50
|
+
|
51
|
+
*Kali Donovan, Michael Daross*
|
52
|
+
|
53
|
+
* Exclude html escaping of I18n reserved keys with `I18n::RESERVED_KEYS` rather than `I18n.reserved_keys_pattern`.
|
54
|
+
|
55
|
+
*Nick Coyne*
|
56
|
+
|
57
|
+
* Update CI configuration to use `Appraisal`.
|
58
|
+
|
59
|
+
*Hans Lemuet, Simon Fish*
|
60
|
+
|
61
|
+
## 3.9.0
|
62
|
+
|
63
|
+
* Don’t break `rails stats` if ViewComponent path is missing.
|
64
|
+
|
65
|
+
*Claudio Baccigalupo*
|
66
|
+
|
67
|
+
* Add deprecation warnings for EOL ruby and Rails versions and patches associated with them.
|
68
|
+
|
69
|
+
*Reegan Viljoen*
|
70
|
+
|
71
|
+
* Add support for Ruby 3.3.
|
72
|
+
|
73
|
+
*Reegan Viljoen*
|
74
|
+
|
75
|
+
* Allow translations to be inherited and overridden in subclasses.
|
76
|
+
|
77
|
+
*Elia Schito*
|
78
|
+
|
79
|
+
* Resolve console warnings when running test suite.
|
80
|
+
|
81
|
+
*Joel Hawksley*
|
82
|
+
|
83
|
+
* Fix spelling in a local variable.
|
84
|
+
|
85
|
+
*Olle Jonsson*
|
86
|
+
|
87
|
+
* Avoid duplicating rendered string when `output_postamble` is blank.
|
88
|
+
|
89
|
+
*Mitchell Henke*
|
90
|
+
|
91
|
+
* Ensure HTML output safety.
|
92
|
+
|
93
|
+
*Cameron Dutro*
|
94
|
+
|
13
95
|
## 3.8.0
|
14
96
|
|
15
97
|
* Use correct value for the `config.action_dispatch.show_exceptions` config option for edge Rails.
|
@@ -225,6 +307,17 @@ This release makes the following breaking changes, many of which have long been
|
|
225
307
|
|
226
308
|
*Joel Hawksley*
|
227
309
|
|
310
|
+
For example:
|
311
|
+
|
312
|
+
```diff
|
313
|
+
<%= render BlogComponent.new do |component| %>
|
314
|
+
- <% component.header do %>
|
315
|
+
+ <% component.with_header do %>
|
316
|
+
<%= link_to "My blog", root_path %>
|
317
|
+
<% end %>
|
318
|
+
<% end %>
|
319
|
+
```
|
320
|
+
|
228
321
|
* BREAKING: Remove deprecated SlotsV1 in favor of current SlotsV2.
|
229
322
|
|
230
323
|
*Joel Hawksley*
|
@@ -34,11 +34,11 @@ module Locale
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def destination(locale = nil)
|
37
|
-
|
37
|
+
extension = ".#{locale}" if locale
|
38
38
|
if sidecar?
|
39
|
-
File.join(component_path, class_path, "#{file_name}_component", "#{file_name}_component#{
|
39
|
+
File.join(component_path, class_path, "#{file_name}_component", "#{file_name}_component#{extension}.yml")
|
40
40
|
else
|
41
|
-
File.join(component_path, class_path, "#{file_name}_component#{
|
41
|
+
File.join(component_path, class_path, "#{file_name}_component#{extension}.yml")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/lib/view_component/base.rb
CHANGED
@@ -28,6 +28,7 @@ module ViewComponent
|
|
28
28
|
end
|
29
29
|
|
30
30
|
include ViewComponent::InlineTemplate
|
31
|
+
include ViewComponent::UseHelpers
|
31
32
|
include ViewComponent::Slotable
|
32
33
|
include ViewComponent::Translatable
|
33
34
|
include ViewComponent::WithContentHelper
|
@@ -104,7 +105,14 @@ module ViewComponent
|
|
104
105
|
before_render
|
105
106
|
|
106
107
|
if render?
|
107
|
-
|
108
|
+
# Avoid allocating new string when output_preamble and output_postamble are blank
|
109
|
+
rendered_template = safe_render_template_for(@__vc_variant).to_s
|
110
|
+
|
111
|
+
if output_preamble.blank? && output_postamble.blank?
|
112
|
+
rendered_template
|
113
|
+
else
|
114
|
+
safe_output_preamble + rendered_template + safe_output_postamble
|
115
|
+
end
|
108
116
|
else
|
109
117
|
""
|
110
118
|
end
|
@@ -151,11 +159,18 @@ module ViewComponent
|
|
151
159
|
end
|
152
160
|
end
|
153
161
|
|
162
|
+
# Optional content to be returned before the rendered template.
|
163
|
+
#
|
164
|
+
# @return [String]
|
165
|
+
def output_preamble
|
166
|
+
@@default_output_preamble ||= "".html_safe
|
167
|
+
end
|
168
|
+
|
154
169
|
# Optional content to be returned after the rendered template.
|
155
170
|
#
|
156
171
|
# @return [String]
|
157
172
|
def output_postamble
|
158
|
-
""
|
173
|
+
@@default_output_postamble ||= "".html_safe
|
159
174
|
end
|
160
175
|
|
161
176
|
# Called before rendering the component. Override to perform operations that
|
@@ -221,6 +236,7 @@ module ViewComponent
|
|
221
236
|
end
|
222
237
|
|
223
238
|
if ::Rails.env.development? || ::Rails.env.test?
|
239
|
+
# @private
|
224
240
|
def method_missing(method_name, *args) # rubocop:disable Style/MissingRespondToMissing
|
225
241
|
super
|
226
242
|
rescue => e # rubocop:disable Style/RescueStandardError
|
@@ -301,6 +317,44 @@ module ViewComponent
|
|
301
317
|
defined?(@__vc_content_evaluated) && @__vc_content_evaluated
|
302
318
|
end
|
303
319
|
|
320
|
+
def maybe_escape_html(text)
|
321
|
+
return text if request && !request.format.html?
|
322
|
+
return text if text.blank?
|
323
|
+
|
324
|
+
if text.html_safe?
|
325
|
+
text
|
326
|
+
else
|
327
|
+
yield
|
328
|
+
html_escape(text)
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def safe_render_template_for(variant)
|
333
|
+
if compiler.renders_template_for_variant?(variant)
|
334
|
+
render_template_for(variant)
|
335
|
+
else
|
336
|
+
maybe_escape_html(render_template_for(variant)) do
|
337
|
+
Kernel.warn("WARNING: The #{self.class} component rendered HTML-unsafe output. The output will be automatically escaped, but you may want to investigate.")
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def safe_output_preamble
|
343
|
+
maybe_escape_html(output_preamble) do
|
344
|
+
Kernel.warn("WARNING: The #{self.class} component was provided an HTML-unsafe preamble. The preamble will be automatically escaped, but you may want to investigate.")
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def safe_output_postamble
|
349
|
+
maybe_escape_html(output_postamble) do
|
350
|
+
Kernel.warn("WARNING: The #{self.class} component was provided an HTML-unsafe postamble. The postamble will be automatically escaped, but you may want to investigate.")
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
def compiler
|
355
|
+
@compiler ||= self.class.compiler
|
356
|
+
end
|
357
|
+
|
304
358
|
# Set the controller used for testing components:
|
305
359
|
#
|
306
360
|
# ```ruby
|
@@ -616,7 +670,7 @@ module ViewComponent
|
|
616
670
|
|
617
671
|
# @private
|
618
672
|
def collection_counter_parameter
|
619
|
-
"#{collection_parameter}_counter"
|
673
|
+
:"#{collection_parameter}_counter"
|
620
674
|
end
|
621
675
|
|
622
676
|
# @private
|
@@ -626,7 +680,7 @@ module ViewComponent
|
|
626
680
|
|
627
681
|
# @private
|
628
682
|
def collection_iteration_parameter
|
629
|
-
"#{collection_parameter}_iteration"
|
683
|
+
:"#{collection_parameter}_iteration"
|
630
684
|
end
|
631
685
|
|
632
686
|
# @private
|
@@ -16,6 +16,7 @@ module ViewComponent
|
|
16
16
|
def initialize(component_class)
|
17
17
|
@component_class = component_class
|
18
18
|
@redefinition_lock = Mutex.new
|
19
|
+
@variants_rendering_templates = Set.new
|
19
20
|
end
|
20
21
|
|
21
22
|
def compiled?
|
@@ -56,7 +57,7 @@ module ViewComponent
|
|
56
57
|
RUBY
|
57
58
|
# rubocop:enable Style/EvalWithLocation
|
58
59
|
|
59
|
-
component_class.define_method("_call_#{safe_class_name}", component_class.instance_method(:call))
|
60
|
+
component_class.define_method(:"_call_#{safe_class_name}", component_class.instance_method(:call))
|
60
61
|
|
61
62
|
component_class.silence_redefinition_of_method("render_template_for")
|
62
63
|
component_class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
@@ -68,6 +69,7 @@ module ViewComponent
|
|
68
69
|
else
|
69
70
|
templates.each do |template|
|
70
71
|
method_name = call_method_name(template[:variant])
|
72
|
+
@variants_rendering_templates << template[:variant]
|
71
73
|
|
72
74
|
redefinition_lock.synchronize do
|
73
75
|
component_class.silence_redefinition_of_method(method_name)
|
@@ -89,6 +91,10 @@ module ViewComponent
|
|
89
91
|
CompileCache.register(component_class)
|
90
92
|
end
|
91
93
|
|
94
|
+
def renders_template_for_variant?(variant)
|
95
|
+
@variants_rendering_templates.include?(variant)
|
96
|
+
end
|
97
|
+
|
92
98
|
private
|
93
99
|
|
94
100
|
attr_reader :component_class, :redefinition_lock
|
@@ -101,7 +107,7 @@ module ViewComponent
|
|
101
107
|
"elsif variant.to_sym == :'#{variant}'\n #{safe_name}"
|
102
108
|
end.join("\n")
|
103
109
|
|
104
|
-
component_class.define_method("_call_#{safe_class_name}", component_class.instance_method(:call))
|
110
|
+
component_class.define_method(:"_call_#{safe_class_name}", component_class.instance_method(:call))
|
105
111
|
|
106
112
|
body = <<-RUBY
|
107
113
|
if variant.nil?
|
@@ -81,6 +81,8 @@ module ViewComponent
|
|
81
81
|
next if Rails.version.to_f >= 6.1 || !app.config.view_component.render_monkey_patch_enabled
|
82
82
|
|
83
83
|
# :nocov:
|
84
|
+
ViewComponent::Deprecation.deprecation_warning("Monkey patching `render`", "ViewComponent 4.0 will remove the `render` monkey patch")
|
85
|
+
|
84
86
|
ActiveSupport.on_load(:action_view) do
|
85
87
|
require "view_component/render_monkey_patch"
|
86
88
|
ActionView::Base.prepend ViewComponent::RenderMonkeyPatch
|
@@ -99,6 +101,8 @@ module ViewComponent
|
|
99
101
|
next if Rails.version.to_f >= 6.1
|
100
102
|
|
101
103
|
# :nocov:
|
104
|
+
ViewComponent::Deprecation.deprecation_warning("using `render_component`", "ViewComponent 4.0 will remove `render_component`")
|
105
|
+
|
102
106
|
ActiveSupport.on_load(:action_view) do
|
103
107
|
require "view_component/render_component_helper"
|
104
108
|
ActionView::Base.include ViewComponent::RenderComponentHelper
|
@@ -160,6 +164,16 @@ module ViewComponent
|
|
160
164
|
end
|
161
165
|
end
|
162
166
|
|
167
|
+
# :nocov:
|
168
|
+
if RUBY_VERSION < "3.0.0"
|
169
|
+
ViewComponent::Deprecation.deprecation_warning("Support for Ruby versions < 3.0.0", "ViewComponent 4.0 will remove support for Ruby versions < 3.0.0 ")
|
170
|
+
end
|
171
|
+
|
172
|
+
if Rails.version.to_f < 6.1
|
173
|
+
ViewComponent::Deprecation.deprecation_warning("Support for Rails versions < 6.1", "ViewComponent 4.0 will remove support for Rails versions < 6.1 ")
|
174
|
+
end
|
175
|
+
# :nocov:
|
176
|
+
|
163
177
|
app.executor.to_run :before do
|
164
178
|
CompileCache.invalidate! unless ActionView::Base.cache_template_loading
|
165
179
|
end
|
@@ -4,7 +4,11 @@ require "active_support/descendants_tracker"
|
|
4
4
|
|
5
5
|
module ViewComponent # :nodoc:
|
6
6
|
class Preview
|
7
|
-
|
7
|
+
if defined?(Rails.application.routes.url_helpers)
|
8
|
+
# Workaround from https://stackoverflow.com/questions/20853526/make-yard-ignore-certain-class-extensions to appease YARD
|
9
|
+
send(:include, Rails.application.routes.url_helpers)
|
10
|
+
end
|
11
|
+
|
8
12
|
include ActionView::Helpers::TagHelper
|
9
13
|
include ActionView::Helpers::AssetTagHelper
|
10
14
|
extend ActiveSupport::DescendantsTracker
|
@@ -7,7 +7,8 @@ namespace :view_component do
|
|
7
7
|
# :nocov:
|
8
8
|
require "rails/code_statistics"
|
9
9
|
|
10
|
-
|
10
|
+
dir = ViewComponent::Base.view_component_path
|
11
|
+
::STATS_DIRECTORIES << ["ViewComponents", dir] if File.directory?(Rails.root + dir)
|
11
12
|
# :nocov:
|
12
13
|
end
|
13
14
|
end
|
@@ -93,11 +93,11 @@ module ViewComponent
|
|
93
93
|
get_slot(slot_name)
|
94
94
|
end
|
95
95
|
|
96
|
-
define_method "#{slot_name}?" do
|
96
|
+
define_method :"#{slot_name}?" do
|
97
97
|
get_slot(slot_name).present?
|
98
98
|
end
|
99
99
|
|
100
|
-
define_method "with_#{slot_name}_content" do |content|
|
100
|
+
define_method :"with_#{slot_name}_content" do |content|
|
101
101
|
send(setter_method_name) { content.to_s }
|
102
102
|
|
103
103
|
self
|
@@ -160,7 +160,7 @@ module ViewComponent
|
|
160
160
|
end
|
161
161
|
ruby2_keywords(setter_method_name) if respond_to?(:ruby2_keywords, true)
|
162
162
|
|
163
|
-
define_method "with_#{singular_name}_content" do |content|
|
163
|
+
define_method :"with_#{singular_name}_content" do |content|
|
164
164
|
send(setter_method_name) { content.to_s }
|
165
165
|
|
166
166
|
self
|
@@ -180,7 +180,7 @@ module ViewComponent
|
|
180
180
|
get_slot(slot_name)
|
181
181
|
end
|
182
182
|
|
183
|
-
define_method "#{slot_name}?" do
|
183
|
+
define_method :"#{slot_name}?" do
|
184
184
|
get_slot(slot_name).present?
|
185
185
|
end
|
186
186
|
|
@@ -211,7 +211,7 @@ module ViewComponent
|
|
211
211
|
get_slot(slot_name)
|
212
212
|
end
|
213
213
|
|
214
|
-
define_method("#{slot_name}?") do
|
214
|
+
define_method(:"#{slot_name}?") do
|
215
215
|
get_slot(slot_name).present?
|
216
216
|
end
|
217
217
|
|
@@ -246,7 +246,7 @@ module ViewComponent
|
|
246
246
|
end
|
247
247
|
ruby2_keywords(setter_method_name) if respond_to?(:ruby2_keywords, true)
|
248
248
|
|
249
|
-
define_method "with_#{poly_slot_name}_content" do |content|
|
249
|
+
define_method :"with_#{poly_slot_name}_content" do |content|
|
250
250
|
send(setter_method_name) { content.to_s }
|
251
251
|
|
252
252
|
self
|
@@ -175,16 +175,17 @@ module ViewComponent
|
|
175
175
|
# end
|
176
176
|
# ```
|
177
177
|
#
|
178
|
-
# @param
|
178
|
+
# @param full_path [String] The path to set for the current request.
|
179
179
|
# @param host [String] The host to set for the current request.
|
180
180
|
# @param method [String] The request method to set for the current request.
|
181
|
-
def with_request_url(full_path, host: nil, method: nil)
|
181
|
+
def with_request_url(full_path, host: nil, method: nil, format: :html)
|
182
182
|
old_request_host = vc_test_request.host
|
183
183
|
old_request_method = vc_test_request.request_method
|
184
184
|
old_request_path_info = vc_test_request.path_info
|
185
185
|
old_request_path_parameters = vc_test_request.path_parameters
|
186
186
|
old_request_query_parameters = vc_test_request.query_parameters
|
187
187
|
old_request_query_string = vc_test_request.query_string
|
188
|
+
old_request_format = vc_test_request.format.symbol
|
188
189
|
old_controller = defined?(@vc_test_controller) && @vc_test_controller
|
189
190
|
|
190
191
|
path, query = full_path.split("?", 2)
|
@@ -197,6 +198,7 @@ module ViewComponent
|
|
197
198
|
vc_test_request.set_header("action_dispatch.request.query_parameters",
|
198
199
|
Rack::Utils.parse_nested_query(query).with_indifferent_access)
|
199
200
|
vc_test_request.set_header(Rack::QUERY_STRING, query)
|
201
|
+
vc_test_request.format = format
|
200
202
|
yield
|
201
203
|
ensure
|
202
204
|
vc_test_request.host = old_request_host
|
@@ -205,6 +207,7 @@ module ViewComponent
|
|
205
207
|
vc_test_request.path_parameters = old_request_path_parameters
|
206
208
|
vc_test_request.set_header("action_dispatch.request.query_parameters", old_request_query_parameters)
|
207
209
|
vc_test_request.set_header(Rack::QUERY_STRING, old_request_query_string)
|
210
|
+
vc_test_request.format = old_request_format
|
208
211
|
@vc_test_controller = old_controller
|
209
212
|
end
|
210
213
|
|
@@ -235,6 +238,8 @@ module ViewComponent
|
|
235
238
|
#
|
236
239
|
# @return [ActionDispatch::TestRequest]
|
237
240
|
def vc_test_request
|
241
|
+
require "action_controller/test_case"
|
242
|
+
|
238
243
|
@vc_test_request ||=
|
239
244
|
begin
|
240
245
|
out = ActionDispatch::TestRequest.create
|
@@ -252,9 +257,11 @@ module ViewComponent
|
|
252
257
|
|
253
258
|
def __vc_test_helpers_preview_class
|
254
259
|
result = if respond_to?(:described_class)
|
260
|
+
# :nocov:
|
255
261
|
raise "`render_preview` expected a described_class, but it is nil." if described_class.nil?
|
256
262
|
|
257
263
|
"#{described_class}Preview"
|
264
|
+
# :nocov:
|
258
265
|
else
|
259
266
|
self.class.name.gsub("Test", "Preview")
|
260
267
|
end
|
@@ -262,5 +269,6 @@ module ViewComponent
|
|
262
269
|
rescue NameError
|
263
270
|
raise NameError, "`render_preview` expected to find #{result}, but it does not exist."
|
264
271
|
end
|
272
|
+
# :nocov:
|
265
273
|
end
|
266
274
|
end
|
@@ -10,6 +10,7 @@ module ViewComponent
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
HTML_SAFE_TRANSLATION_KEY = /(?:_|\b)html\z/
|
13
|
+
TRANSLATION_EXTENSIONS = %w[yml yaml].freeze
|
13
14
|
|
14
15
|
included do
|
15
16
|
class_attribute :i18n_backend, instance_writer: false, instance_predicate: false
|
@@ -23,9 +24,16 @@ module ViewComponent
|
|
23
24
|
def build_i18n_backend
|
24
25
|
return if compiled?
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
# We need to load the translations files from the ancestors so a component
|
28
|
+
# can inherit translations from its parent and is able to overwrite them.
|
29
|
+
translation_files = ancestors.reverse_each.with_object([]) do |ancestor, files|
|
30
|
+
if ancestor.is_a?(Class) && ancestor < ViewComponent::Base
|
31
|
+
files.concat(ancestor.sidecar_files(TRANSLATION_EXTENSIONS))
|
32
|
+
end
|
33
|
+
end
|
28
34
|
|
35
|
+
# In development it will become nil if the translations file is removed
|
36
|
+
self.i18n_backend = if translation_files.any?
|
29
37
|
I18nBackend.new(
|
30
38
|
i18n_scope: i18n_scope,
|
31
39
|
load_paths: translation_files
|
@@ -130,8 +138,7 @@ module ViewComponent
|
|
130
138
|
end
|
131
139
|
|
132
140
|
def html_escape_translation_options!(options)
|
133
|
-
options.each do |name, value|
|
134
|
-
next if ::I18n.reserved_keys_pattern.match?(name)
|
141
|
+
options.except(*::I18n::RESERVED_KEYS).each do |name, value|
|
135
142
|
next if name == :count && value.is_a?(Numeric)
|
136
143
|
|
137
144
|
options[name] = ERB::Util.html_escape(value.to_s)
|
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: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 2.
|
81
|
+
version: 2.13.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 2.
|
88
|
+
version: 2.13.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: better_html
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,48 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '2'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: capybara
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '3'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '3'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: cuprite
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0.15'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0.15'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: debug
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
117
159
|
- !ruby/object:Gem::Dependency
|
118
160
|
name: erb_lint
|
119
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,6 +240,20 @@ dependencies:
|
|
198
240
|
- - "~>"
|
199
241
|
- !ruby/object:Gem::Version
|
200
242
|
version: '0.13'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: puma
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - "~>"
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '6'
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - "~>"
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '6'
|
201
257
|
- !ruby/object:Gem::Dependency
|
202
258
|
name: rake
|
203
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,6 +268,20 @@ dependencies:
|
|
212
268
|
- - "~>"
|
213
269
|
- !ruby/object:Gem::Version
|
214
270
|
version: '13.0'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: rspec-rails
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - "~>"
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '5'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - "~>"
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '5'
|
215
285
|
- !ruby/object:Gem::Dependency
|
216
286
|
name: rubocop-md
|
217
287
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,6 +296,20 @@ dependencies:
|
|
226
296
|
- - "~>"
|
227
297
|
- !ruby/object:Gem::Version
|
228
298
|
version: '1'
|
299
|
+
- !ruby/object:Gem::Dependency
|
300
|
+
name: selenium-webdriver
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - '='
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: 4.9.0
|
306
|
+
type: :development
|
307
|
+
prerelease: false
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
309
|
+
requirements:
|
310
|
+
- - '='
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
version: 4.9.0
|
229
313
|
- !ruby/object:Gem::Dependency
|
230
314
|
name: standard
|
231
315
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,20 +380,34 @@ dependencies:
|
|
296
380
|
- - "~>"
|
297
381
|
- !ruby/object:Gem::Version
|
298
382
|
version: 3.4.2
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: warning
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - ">="
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: '0'
|
390
|
+
type: :development
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - ">="
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: '0'
|
299
397
|
- !ruby/object:Gem::Dependency
|
300
398
|
name: yard
|
301
399
|
requirement: !ruby/object:Gem::Requirement
|
302
400
|
requirements:
|
303
401
|
- - "~>"
|
304
402
|
- !ruby/object:Gem::Version
|
305
|
-
version: 0.9.
|
403
|
+
version: 0.9.34
|
306
404
|
type: :development
|
307
405
|
prerelease: false
|
308
406
|
version_requirements: !ruby/object:Gem::Requirement
|
309
407
|
requirements:
|
310
408
|
- - "~>"
|
311
409
|
- !ruby/object:Gem::Version
|
312
|
-
version: 0.9.
|
410
|
+
version: 0.9.34
|
313
411
|
- !ruby/object:Gem::Dependency
|
314
412
|
name: yard-activesupport-concern
|
315
413
|
requirement: !ruby/object:Gem::Requirement
|
@@ -324,6 +422,48 @@ dependencies:
|
|
324
422
|
- - "~>"
|
325
423
|
- !ruby/object:Gem::Version
|
326
424
|
version: 0.0.1
|
425
|
+
- !ruby/object:Gem::Dependency
|
426
|
+
name: net-imap
|
427
|
+
requirement: !ruby/object:Gem::Requirement
|
428
|
+
requirements:
|
429
|
+
- - ">="
|
430
|
+
- !ruby/object:Gem::Version
|
431
|
+
version: '0'
|
432
|
+
type: :development
|
433
|
+
prerelease: false
|
434
|
+
version_requirements: !ruby/object:Gem::Requirement
|
435
|
+
requirements:
|
436
|
+
- - ">="
|
437
|
+
- !ruby/object:Gem::Version
|
438
|
+
version: '0'
|
439
|
+
- !ruby/object:Gem::Dependency
|
440
|
+
name: net-pop
|
441
|
+
requirement: !ruby/object:Gem::Requirement
|
442
|
+
requirements:
|
443
|
+
- - ">="
|
444
|
+
- !ruby/object:Gem::Version
|
445
|
+
version: '0'
|
446
|
+
type: :development
|
447
|
+
prerelease: false
|
448
|
+
version_requirements: !ruby/object:Gem::Requirement
|
449
|
+
requirements:
|
450
|
+
- - ">="
|
451
|
+
- !ruby/object:Gem::Version
|
452
|
+
version: '0'
|
453
|
+
- !ruby/object:Gem::Dependency
|
454
|
+
name: net-smtp
|
455
|
+
requirement: !ruby/object:Gem::Requirement
|
456
|
+
requirements:
|
457
|
+
- - ">="
|
458
|
+
- !ruby/object:Gem::Version
|
459
|
+
version: '0'
|
460
|
+
type: :development
|
461
|
+
prerelease: false
|
462
|
+
version_requirements: !ruby/object:Gem::Requirement
|
463
|
+
requirements:
|
464
|
+
- - ">="
|
465
|
+
- !ruby/object:Gem::Version
|
466
|
+
version: '0'
|
327
467
|
description:
|
328
468
|
email:
|
329
469
|
executables: []
|
@@ -421,7 +561,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
421
561
|
- !ruby/object:Gem::Version
|
422
562
|
version: '0'
|
423
563
|
requirements: []
|
424
|
-
rubygems_version: 3.
|
564
|
+
rubygems_version: 3.5.3
|
425
565
|
signing_key:
|
426
566
|
specification_version: 4
|
427
567
|
summary: A framework for building reusable, testable & encapsulated view components
|