actionview 7.2.4 → 8.0.5.2

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +127 -113
  3. data/lib/action_view/dependency_tracker/erb_tracker.rb +36 -27
  4. data/lib/action_view/dependency_tracker/ruby_tracker.rb +2 -19
  5. data/lib/action_view/dependency_tracker/wildcard_resolver.rb +32 -0
  6. data/lib/action_view/dependency_tracker.rb +1 -0
  7. data/lib/action_view/gem_version.rb +4 -4
  8. data/lib/action_view/helpers/atom_feed_helper.rb +0 -2
  9. data/lib/action_view/helpers/cache_helper.rb +8 -0
  10. data/lib/action_view/helpers/date_helper.rb +3 -3
  11. data/lib/action_view/helpers/form_helper.rb +76 -75
  12. data/lib/action_view/helpers/form_options_helper.rb +25 -22
  13. data/lib/action_view/helpers/form_tag_helper.rb +20 -17
  14. data/lib/action_view/helpers/rendering_helper.rb +160 -50
  15. data/lib/action_view/helpers/sanitize_helper.rb +12 -1
  16. data/lib/action_view/helpers/tag_helper.rb +39 -43
  17. data/lib/action_view/helpers/tags/base.rb +11 -9
  18. data/lib/action_view/helpers/tags/check_box.rb +2 -2
  19. data/lib/action_view/helpers/tags/collection_check_boxes.rb +4 -3
  20. data/lib/action_view/helpers/tags/file_field.rb +4 -1
  21. data/lib/action_view/helpers/tags/label.rb +3 -10
  22. data/lib/action_view/helpers/tags/radio_button.rb +1 -1
  23. data/lib/action_view/helpers/tags/select_renderer.rb +1 -1
  24. data/lib/action_view/helpers/tags/text_area.rb +1 -1
  25. data/lib/action_view/helpers/tags/text_field.rb +1 -1
  26. data/lib/action_view/helpers/text_helper.rb +23 -7
  27. data/lib/action_view/helpers/url_helper.rb +2 -4
  28. data/lib/action_view/layouts.rb +1 -1
  29. data/lib/action_view/record_identifier.rb +1 -1
  30. data/lib/action_view/render_parser/prism_render_parser.rb +13 -1
  31. data/lib/action_view/render_parser/ripper_render_parser.rb +10 -1
  32. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +5 -1
  33. data/lib/action_view/renderer/streaming_template_renderer.rb +8 -2
  34. data/lib/action_view/rendering.rb +2 -3
  35. data/lib/action_view/template/handlers/erb/erubi.rb +1 -1
  36. data/lib/action_view/template/raw_file.rb +4 -0
  37. data/lib/action_view/template/resolver.rb +0 -1
  38. data/lib/action_view/template.rb +7 -2
  39. metadata +18 -25
@@ -500,8 +500,6 @@ module ActionView
500
500
  content_tag("a", name || email_address, html_options, &block)
501
501
  end
502
502
 
503
- RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
504
-
505
503
  # True if the current request URI was generated by the given +options+.
506
504
  #
507
505
  # ==== Examples
@@ -558,14 +556,14 @@ module ActionView
558
556
 
559
557
  options ||= options_as_kwargs
560
558
  check_parameters ||= options.is_a?(Hash) && options.delete(:check_parameters)
561
- url_string = RFC2396_PARSER.unescape(url_for(options)).force_encoding(Encoding::BINARY)
559
+ url_string = URI::RFC2396_PARSER.unescape(url_for(options)).force_encoding(Encoding::BINARY)
562
560
 
563
561
  # We ignore any extra parameters in the request_uri if the
564
562
  # submitted URL doesn't have any either. This lets the function
565
563
  # work with things like ?order=asc
566
564
  # the behavior can be disabled with check_parameters: true
567
565
  request_uri = url_string.index("?") || check_parameters ? request.fullpath : request.path
568
- request_uri = RFC2396_PARSER.unescape(request_uri).force_encoding(Encoding::BINARY)
566
+ request_uri = URI::RFC2396_PARSER.unescape(request_uri).force_encoding(Encoding::BINARY)
569
567
 
570
568
  if %r{^\w+://}.match?(url_string)
571
569
  request_uri = +"#{request.protocol}#{request.host_with_port}#{request_uri}"
@@ -347,7 +347,7 @@ module ActionView
347
347
  end
348
348
  end
349
349
 
350
- def _normalize_options(options) # :nodoc:
350
+ def _process_render_template_options(options) # :nodoc:
351
351
  super
352
352
 
353
353
  if _include_layout?(options)
@@ -11,7 +11,7 @@ module ActionView
11
11
  #
12
12
  # Consider for example the following code that form of post:
13
13
  #
14
- # <%= form_for(post) do |f| %>
14
+ # <%= form_with(model: post) do |f| %>
15
15
  # <%= f.text_field :body %>
16
16
  # <% end %>
17
17
  #
@@ -97,9 +97,21 @@ module ActionView
97
97
  def render_call_template(node)
98
98
  object_template = false
99
99
  template =
100
- if node.is_a?(Prism::StringNode)
100
+ case node.type
101
+ when :string_node
101
102
  path = node.unescaped
102
103
  path.include?("/") ? path : "#{directory}/#{path}"
104
+ when :interpolated_string_node
105
+ node.parts.map do |node|
106
+ case node.type
107
+ when :string_node
108
+ node.unescaped
109
+ when :embedded_statements_node
110
+ "*"
111
+ else
112
+ return
113
+ end
114
+ end.join("")
103
115
  else
104
116
  dependency =
105
117
  case node.type
@@ -66,7 +66,16 @@ module ActionView
66
66
 
67
67
  def to_string
68
68
  raise unless string?
69
- self[0][0][0]
69
+
70
+ # s(:string_literal, s(:string_content, map))
71
+ self[0].map do |node|
72
+ case node.type
73
+ when :@tstring_content
74
+ node[0]
75
+ when :string_embexpr
76
+ "*"
77
+ end
78
+ end.join("")
70
79
  end
71
80
 
72
81
  def hash?
@@ -111,7 +111,11 @@ module ActionView
111
111
  end
112
112
 
113
113
  unless entries_to_write.empty?
114
- collection_cache.write_multi(entries_to_write)
114
+ if @options[:cached].is_a?(Hash) && @options[:cached].key?(:expires_in)
115
+ collection_cache.write_multi(entries_to_write, expires_in: @options[:cached][:expires_in])
116
+ else
117
+ collection_cache.write_multi(entries_to_write)
118
+ end
115
119
  end
116
120
 
117
121
  keyed_partials
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "fiber"
4
3
 
5
4
  module ActionView
6
5
  # == TODO
@@ -26,6 +25,13 @@ module ActionView
26
25
  self
27
26
  end
28
27
 
28
+ # Returns the complete body as a string.
29
+ def body
30
+ buffer = String.new
31
+ each { |part| buffer << part }
32
+ buffer
33
+ end
34
+
29
35
  private
30
36
  # This is the same logging logic as in ShowExceptions middleware.
31
37
  def log_error(exception)
@@ -43,7 +49,7 @@ module ActionView
43
49
  # object that responds to each. This object is initialized with a block
44
50
  # that knows how to render the template.
45
51
  def render_template(view, template, layout_name = nil, locals = {}) # :nodoc:
46
- return [super.body] unless layout_name && template.supports_streaming?
52
+ return [super.body] unless template.supports_streaming?
47
53
 
48
54
  locals ||= {}
49
55
  layout = find_layout(layout_name, locals.keys, [formats.first])
@@ -118,6 +118,7 @@ module ActionView
118
118
 
119
119
  def render_to_body(options = {})
120
120
  _process_options(options)
121
+ _process_render_template_options(options)
121
122
  _render_template(options)
122
123
  end
123
124
 
@@ -173,8 +174,7 @@ module ActionView
173
174
  end
174
175
 
175
176
  # Normalize options.
176
- def _normalize_options(options)
177
- options = super(options)
177
+ def _process_render_template_options(options)
178
178
  if options[:partial] == true
179
179
  options[:partial] = action_name
180
180
  end
@@ -184,7 +184,6 @@ module ActionView
184
184
  end
185
185
 
186
186
  options[:template] ||= (options[:action] || action_name).to_s
187
- options
188
187
  end
189
188
  end
190
189
  end
@@ -18,7 +18,7 @@ module ActionView
18
18
  properties[:preamble] ||= ""
19
19
  properties[:postamble] ||= "#{properties[:bufvar]}"
20
20
 
21
- # Tell Eruby that whether template will be compiled with `frozen_string_literal: true`
21
+ # Tell Erubi whether the template will be compiled with `frozen_string_literal: true`
22
22
  properties[:freeze_template_literals] = !Template.frozen_string_literal
23
23
 
24
24
  properties[:escapefunc] = ""
@@ -20,6 +20,10 @@ module ActionView # :nodoc:
20
20
  def render(*args)
21
21
  ::File.read(@filename)
22
22
  end
23
+
24
+ def supports_streaming?
25
+ false
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -4,7 +4,6 @@ require "pathname"
4
4
  require "active_support/core_ext/class"
5
5
  require "active_support/core_ext/module/attribute_accessors"
6
6
  require "action_view/template"
7
- require "thread"
8
7
  require "concurrent/map"
9
8
 
10
9
  module ActionView
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "thread"
4
3
  require "delegate"
5
4
 
6
5
  module ActionView
@@ -357,7 +356,7 @@ module ActionView
357
356
 
358
357
  # This method is responsible for marking a template as having strict locals
359
358
  # which means the template can only accept the locals defined in a magic
360
- # comment. For example, if your template acceps the locals +title+ and
359
+ # comment. For example, if your template accepts the locals +title+ and
361
360
  # +comment_count+, add the following to your template file:
362
361
  #
363
362
  # <%# locals: (title: "Default title", comment_count: 0) %>
@@ -371,6 +370,12 @@ module ActionView
371
370
 
372
371
  return if @strict_locals.nil? # Magic comment not found
373
372
 
373
+ # Tag with the assumed encoding before encode! runs, same as
374
+ # encode! does for the source itself (see above).
375
+ if @strict_locals.encoding == Encoding::BINARY
376
+ @strict_locals.force_encoding(Encoding.default_external)
377
+ end
378
+
374
379
  @strict_locals = "**nil" if @strict_locals.blank?
375
380
  end
376
381
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.4
4
+ version: 8.0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,28 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 7.2.4
18
+ version: 8.0.5.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 7.2.4
26
- - !ruby/object:Gem::Dependency
27
- name: cgi
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
25
+ version: 8.0.5.2
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: builder
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +58,9 @@ dependencies:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
60
  version: '1.6'
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.7.2
75
64
  type: :runtime
76
65
  prerelease: false
77
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -79,6 +68,9 @@ dependencies:
79
68
  - - "~>"
80
69
  - !ruby/object:Gem::Version
81
70
  version: '1.6'
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.7.2
82
74
  - !ruby/object:Gem::Dependency
83
75
  name: rails-dom-testing
84
76
  requirement: !ruby/object:Gem::Requirement
@@ -99,28 +91,28 @@ dependencies:
99
91
  requirements:
100
92
  - - '='
101
93
  - !ruby/object:Gem::Version
102
- version: 7.2.4
94
+ version: 8.0.5.2
103
95
  type: :development
104
96
  prerelease: false
105
97
  version_requirements: !ruby/object:Gem::Requirement
106
98
  requirements:
107
99
  - - '='
108
100
  - !ruby/object:Gem::Version
109
- version: 7.2.4
101
+ version: 8.0.5.2
110
102
  - !ruby/object:Gem::Dependency
111
103
  name: activemodel
112
104
  requirement: !ruby/object:Gem::Requirement
113
105
  requirements:
114
106
  - - '='
115
107
  - !ruby/object:Gem::Version
116
- version: 7.2.4
108
+ version: 8.0.5.2
117
109
  type: :development
118
110
  prerelease: false
119
111
  version_requirements: !ruby/object:Gem::Requirement
120
112
  requirements:
121
113
  - - '='
122
114
  - !ruby/object:Gem::Version
123
- version: 7.2.4
115
+ version: 8.0.5.2
124
116
  description: Simple, battle-tested conventions and helpers for building web pages.
125
117
  email: david@loudthinking.com
126
118
  executables: []
@@ -140,6 +132,7 @@ files:
140
132
  - lib/action_view/dependency_tracker.rb
141
133
  - lib/action_view/dependency_tracker/erb_tracker.rb
142
134
  - lib/action_view/dependency_tracker/ruby_tracker.rb
135
+ - lib/action_view/dependency_tracker/wildcard_resolver.rb
143
136
  - lib/action_view/deprecator.rb
144
137
  - lib/action_view/digestor.rb
145
138
  - lib/action_view/flows.rb
@@ -259,10 +252,10 @@ licenses:
259
252
  - MIT
260
253
  metadata:
261
254
  bug_tracker_uri: https://github.com/rails/rails/issues
262
- changelog_uri: https://github.com/rails/rails/blob/v7.2.4/actionview/CHANGELOG.md
263
- documentation_uri: https://api.rubyonrails.org/v7.2.4/
255
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.5.2/actionview/CHANGELOG.md
256
+ documentation_uri: https://api.rubyonrails.org/v8.0.5.2/
264
257
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
265
- source_code_uri: https://github.com/rails/rails/tree/v7.2.4/actionview
258
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.5.2/actionview
266
259
  rubygems_mfa_required: 'true'
267
260
  rdoc_options: []
268
261
  require_paths:
@@ -271,7 +264,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
264
  requirements:
272
265
  - - ">="
273
266
  - !ruby/object:Gem::Version
274
- version: 3.1.0
267
+ version: 3.2.0
275
268
  required_rubygems_version: !ruby/object:Gem::Requirement
276
269
  requirements:
277
270
  - - ">="