actionview 7.0.0 → 7.0.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4404695c53394a381070413d888aa3a233c9f2b20f0f9d95b5d09c7d677bf14b
4
- data.tar.gz: e2d825223979a9ce8c17024d6f74389f03c7161872bbba807c2cd760769b0922
3
+ metadata.gz: c04098fc3c5b74e32d1fe42d3987f2fb00f0d08f0dd3e079d998b94994619518
4
+ data.tar.gz: 1b1b21229ce063aa51fbab125cb41a60496f94cc0803239f12979462b8d5c0d1
5
5
  SHA512:
6
- metadata.gz: 3c2ce1c485c81aa6a4b268e6b1eabb19123b5aebf9b76855c0be654c19c7d5d4ff66b676759352a8978910540ddfb20fd66e9fd95a3cc1887af0cd435d028914
7
- data.tar.gz: 4ea433d6ba6b950f1f94b3d0e5c1cfd2493d5fb3f56fcd8d904bc0cf06603118443ccc121880eb8bbd7e0920347c6bda74809858a6cd297038e39ec115fed70b
6
+ metadata.gz: 4caa5c5b44f74fcdd2b5558b0f21001f8904e03155cabbe4dd124cbd2bb68c102f2a8ec965161c313af14d6e1324692731dd50045eb4ec6fa3ff48192df3b787
7
+ data.tar.gz: 9c1648e18873549089f6eae6b8454e25d36171da54703f30c65790185ff4951d00dbe63218f8e7b9ba6f3fc724742fb0d1b14630c2a610d732f3b25becde8a74
data/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## Rails 7.0.2.2 (February 11, 2022) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 7.0.2.1 (February 11, 2022) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 7.0.2 (February 08, 2022) ##
12
+
13
+ * Ensure `preload_link_tag` preloads JavaScript modules correctly.
14
+
15
+ *Máximo Mussini*
16
+
17
+ * Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
18
+ a `response` method.
19
+
20
+ *dark-panda*
21
+
22
+
23
+ ## Rails 7.0.1 (January 06, 2022) ##
24
+
25
+ * Fix `button_to` to work with a hash parameter as URL.
26
+
27
+ *MingyuanQin*
28
+
29
+ * Fix `link_to` with a model passed as an argument twice.
30
+
31
+ *Alex Ghiculescu*
32
+
33
+
1
34
  ## Rails 7.0.0 (December 15, 2021) ##
2
35
 
3
36
  * Support `include_hidden:` option in calls to
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2021 David Heinemeier Hansson
1
+ Copyright (c) 2004-2022 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -9,8 +9,8 @@ module ActionView
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 0
13
- PRE = nil
12
+ TINY = 2
13
+ PRE = "2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -325,16 +325,17 @@ module ActionView
325
325
  crossorigin = "anonymous" if crossorigin == true || (crossorigin.blank? && as_type == "font")
326
326
  integrity = options[:integrity]
327
327
  nopush = options.delete(:nopush) || false
328
+ rel = mime_type == "module" ? "modulepreload" : "preload"
328
329
 
329
330
  link_tag = tag.link(**{
330
- rel: "preload",
331
+ rel: rel,
331
332
  href: href,
332
333
  as: as_type,
333
334
  type: mime_type,
334
335
  crossorigin: crossorigin
335
336
  }.merge!(options.symbolize_keys))
336
337
 
337
- preload_link = "<#{href}>; rel=preload; as=#{as_type}"
338
+ preload_link = "<#{href}>; rel=#{rel}; as=#{as_type}"
338
339
  preload_link += "; type=#{mime_type}" if mime_type
339
340
  preload_link += "; crossorigin=#{crossorigin}" if crossorigin
340
341
  preload_link += "; integrity=#{integrity}" if integrity
@@ -542,7 +543,7 @@ module ActionView
542
543
  MAX_HEADER_SIZE = 8_000 # Some HTTP client and proxies have a 8kiB header limit
543
544
  def send_preload_links_header(preload_links, max_header_size: MAX_HEADER_SIZE)
544
545
  return if preload_links.empty?
545
- return if respond_to?(:response) && response.sending?
546
+ return if respond_to?(:response) && response&.sending?
546
547
 
547
548
  if respond_to?(:request) && request
548
549
  request.send_early_hints("Link" => preload_links.join("\n"))
@@ -1149,7 +1149,7 @@ module ActionView
1149
1149
 
1150
1150
  # Builds hidden input tag for date part and value.
1151
1151
  # build_hidden(:year, 2008)
1152
- # => "<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="2008" />"
1152
+ # => "<input type="hidden" id="date_year" name="date[year]" value="2008" autocomplete="off" />"
1153
1153
  def build_hidden(type, value)
1154
1154
  select_options = {
1155
1155
  type: "hidden",
@@ -1237,7 +1237,7 @@ module ActionView
1237
1237
  def file_field(object_name, method, options = {})
1238
1238
  options = { include_hidden: multiple_file_field_include_hidden }.merge!(options)
1239
1239
 
1240
- Tags::FileField.new(object_name, method, self, convert_direct_upload_option_to_url(method, options)).render
1240
+ Tags::FileField.new(object_name, method, self, convert_direct_upload_option_to_url(options.dup)).render
1241
1241
  end
1242
1242
 
1243
1243
  # Returns a textarea opening and closing tag set tailored for accessing a specified attribute (identified by +method+)
@@ -62,7 +62,7 @@ module ActionView
62
62
  #
63
63
  # <%= form_tag('/posts', remote: true) %>
64
64
  # # => <form action="/posts" method="post" data-remote="true">
65
-
65
+ #
66
66
  # form_tag(false, method: :get)
67
67
  # # => <form method="get">
68
68
  #
@@ -294,14 +294,14 @@ module ActionView
294
294
  #
295
295
  # ==== Examples
296
296
  # hidden_field_tag 'tags_list'
297
- # # => <input id="tags_list" name="tags_list" type="hidden" />
297
+ # # => <input type="hidden" name="tags_list" id="tags_list" autocomplete="off" />
298
298
  #
299
299
  # hidden_field_tag 'token', 'VUBJKB23UIVI1UU1VOBVI@'
300
- # # => <input id="token" name="token" type="hidden" value="VUBJKB23UIVI1UU1VOBVI@" />
300
+ # # => <input type="hidden" name="token" id="token" value="VUBJKB23UIVI1UU1VOBVI@" autocomplete="off" />
301
301
  #
302
302
  # hidden_field_tag 'collected_input', '', onchange: "alert('Input collected!')"
303
- # # => <input id="collected_input" name="collected_input" onchange="alert('Input collected!')"
304
- # # type="hidden" value="" />
303
+ # # => <input type="hidden" name="collected_input" id="collected_input"
304
+ # value="" onchange="alert(&#39;Input collected!&#39;)" autocomplete="off" />
305
305
  def hidden_field_tag(name, value = nil, options = {})
306
306
  text_field_tag(name, value, options.merge(type: :hidden, autocomplete: "off"))
307
307
  end
@@ -342,7 +342,7 @@ module ActionView
342
342
  # file_field_tag 'file', accept: 'text/html', class: 'upload', value: 'index.html'
343
343
  # # => <input accept="text/html" class="upload" id="file" name="file" type="file" value="index.html" />
344
344
  def file_field_tag(name, options = {})
345
- text_field_tag(name, nil, convert_direct_upload_option_to_url(name, options.merge(type: :file)))
345
+ text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file)))
346
346
  end
347
347
 
348
348
  # Creates a password field, a masked text field that will hide the users input behind a mask character.
@@ -984,23 +984,9 @@ module ActionView
984
984
  tag_options.delete("data-disable-with")
985
985
  end
986
986
 
987
- def convert_direct_upload_option_to_url(name, options)
987
+ def convert_direct_upload_option_to_url(options)
988
988
  if options.delete(:direct_upload) && respond_to?(:rails_direct_uploads_url)
989
989
  options["data-direct-upload-url"] = rails_direct_uploads_url
990
-
991
- if options[:object] && options[:object].class.respond_to?(:reflect_on_attachment)
992
- attachment_reflection = options[:object].class.reflect_on_attachment(name)
993
-
994
- class_with_attachment = "#{options[:object].class.name.underscore}##{name}"
995
- options["data-direct-upload-attachment-name"] = class_with_attachment
996
-
997
- service_name = attachment_reflection.options[:service_name] || ActiveStorage::Blob.service.name
998
- options["data-direct-upload-token"] = ActiveStorage::DirectUploadToken.generate_direct_upload_token(
999
- class_with_attachment,
1000
- service_name,
1001
- session
1002
- )
1003
- end
1004
990
  end
1005
991
  options
1006
992
  end
@@ -197,7 +197,7 @@ module ActionView
197
197
  #
198
198
  # * <tt>confirm: 'question?'</tt> - This will allow the unobtrusive JavaScript
199
199
  # driver to prompt with the question specified (in this case, the
200
- # resulting text would be <tt>question?</tt>. If the user accepts, the
200
+ # resulting text would be <tt>question?</tt>). If the user accepts, the
201
201
  # link is processed normally, otherwise no action is taken.
202
202
  # * <tt>:disable_with</tt> - Value of this parameter will be used as the
203
203
  # name for a disabled version of the link. This feature is provided by
@@ -262,34 +262,24 @@ module ActionView
262
262
  # be placed
263
263
  # * <tt>:params</tt> - \Hash of parameters to be rendered as hidden fields within the form.
264
264
  #
265
- # ==== Data attributes
266
- #
267
- # * <tt>:confirm</tt> - This will use the unobtrusive JavaScript driver to
268
- # prompt with the question specified. If the user accepts, the link is
269
- # processed normally, otherwise no action is taken.
270
- # * <tt>:disable_with</tt> - Value of this parameter will be
271
- # used as the value for a disabled version of the submit
272
- # button when the form is submitted. This feature is provided
273
- # by the unobtrusive JavaScript driver.
274
- #
275
265
  # ==== Examples
276
266
  # <%= button_to "New", action: "new" %>
277
267
  # # => "<form method="post" action="/controller/new" class="button_to">
278
268
  # # <button type="submit">New</button>
279
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
269
+ # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
280
270
  # # </form>"
281
271
  #
282
272
  # <%= button_to "New", new_article_path %>
283
273
  # # => "<form method="post" action="/articles/new" class="button_to">
284
274
  # # <button type="submit">New</button>
285
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
275
+ # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
286
276
  # # </form>"
287
277
  #
288
278
  # <%= button_to "New", new_article_path, params: { time: Time.now } %>
289
279
  # # => "<form method="post" action="/articles/new" class="button_to">
290
280
  # # <button type="submit">New</button>
291
281
  # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
292
- # # <input type="hidden" name="time" value="2021-04-08 14:06:09 -0500">
282
+ # # <input type="hidden" name="time" value="2021-04-08 14:06:09 -0500" autocomplete="off">
293
283
  # # </form>"
294
284
  #
295
285
  # <%= button_to [:make_happy, @user] do %>
@@ -299,37 +289,34 @@ module ActionView
299
289
  # # <button type="submit">
300
290
  # # Make happy <strong><%= @user.name %></strong>
301
291
  # # </button>
302
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
292
+ # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
303
293
  # # </form>"
304
294
  #
305
295
  # <%= button_to "New", { action: "new" }, form_class: "new-thing" %>
306
296
  # # => "<form method="post" action="/controller/new" class="new-thing">
307
297
  # # <button type="submit">New</button>
308
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
298
+ # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
309
299
  # # </form>"
310
300
  #
311
301
  # <%= button_to "Create", { action: "create" }, remote: true, form: { "data-type" => "json" } %>
312
302
  # # => "<form method="post" action="/images/create" class="button_to" data-remote="true" data-type="json">
313
303
  # # <button type="submit">Create</button>
314
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
304
+ # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6" autocomplete="off"/>
315
305
  # # </form>"
316
306
  #
317
- # <%= button_to "Delete Image", { action: "delete", id: @image.id },
318
- # method: :delete, data: { confirm: "Are you sure?" } %>
319
- # # => "<form method="post" action="/images/delete/1" class="button_to">
320
- # # <input type="hidden" name="_method" value="delete" />
321
- # # <button data-confirm='Are you sure?' type="submit">Delete Image</button>
322
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
323
- # # </form>"
307
+ # ==== Deprecated: Rails UJS attributes
308
+ #
309
+ # Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7,
310
+ # this library is no longer on by default. This library integrated with the following options:
324
311
  #
325
- # <%= button_to('Destroy', 'http://www.example.com',
326
- # method: :delete, remote: true, data: { confirm: 'Are you sure?', disable_with: 'loading...' }) %>
327
- # # => "<form class='button_to' method='post' action='http://www.example.com' data-remote='true'>
328
- # # <input name='_method' value='delete' type='hidden' />
329
- # # <button type='submit' data-disable-with='loading...' data-confirm='Are you sure?'>Destroy</button>
330
- # # <input name="authenticity_token" type="hidden" value="10f2163b45388899ad4d5ae948988266befcb6c3d1b2451cf657a0c293d605a6"/>
331
- # # </form>"
332
- # #
312
+ # * <tt>confirm: 'question?'</tt> - This will allow the unobtrusive JavaScript
313
+ # driver to prompt with the question specified (in this case, the
314
+ # resulting text would be <tt>question?</tt>). If the user accepts, the
315
+ # button is processed normally, otherwise no action is taken.
316
+ # * <tt>:disable_with</tt> - Value of this parameter will be
317
+ # used as the value for a disabled version of the submit
318
+ # button when the form is submitted. This feature is provided
319
+ # by the unobtrusive JavaScript driver.
333
320
  def button_to(name = nil, options = nil, html_options = nil, &block)
334
321
  html_options, options = options, name if block_given?
335
322
  html_options ||= {}
@@ -366,7 +353,9 @@ module ActionView
366
353
  html_options = convert_options_to_data_attributes(options, html_options)
367
354
  html_options["type"] = "submit"
368
355
 
369
- button = if block_given? || button_to_generates_button_tag
356
+ button = if block_given?
357
+ content_tag("button", html_options, &block)
358
+ elsif button_to_generates_button_tag
370
359
  content_tag("button", name || url, html_options, &block)
371
360
  else
372
361
  html_options["value"] = name || url
@@ -743,7 +732,7 @@ module ActionView
743
732
  end
744
733
 
745
734
  def url_target(name, options)
746
- if name.respond_to?(:model_name) && options.empty?
735
+ if name.respond_to?(:model_name) && options.is_a?(Hash) && options.empty?
747
736
  url_for(name)
748
737
  else
749
738
  url_for(options)
data/lib/action_view.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2021 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2022 David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-15 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: 7.0.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.0
26
+ version: 7.0.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 7.0.0
95
+ version: 7.0.2.2
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 7.0.0
102
+ version: 7.0.2.2
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 7.0.0
109
+ version: 7.0.2.2
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 7.0.0
116
+ version: 7.0.2.2
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -246,12 +246,12 @@ licenses:
246
246
  - MIT
247
247
  metadata:
248
248
  bug_tracker_uri: https://github.com/rails/rails/issues
249
- changelog_uri: https://github.com/rails/rails/blob/v7.0.0/actionview/CHANGELOG.md
250
- documentation_uri: https://api.rubyonrails.org/v7.0.0/
249
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.2.2/actionview/CHANGELOG.md
250
+ documentation_uri: https://api.rubyonrails.org/v7.0.2.2/
251
251
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
252
- source_code_uri: https://github.com/rails/rails/tree/v7.0.0/actionview
252
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.2.2/actionview
253
253
  rubygems_mfa_required: 'true'
254
- post_install_message:
254
+ post_install_message:
255
255
  rdoc_options: []
256
256
  require_paths:
257
257
  - lib
@@ -267,8 +267,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  version: '0'
268
268
  requirements:
269
269
  - none
270
- rubygems_version: 3.2.32
271
- signing_key:
270
+ rubygems_version: 3.2.22
271
+ signing_key:
272
272
  specification_version: 4
273
273
  summary: Rendering framework putting the V in MVC (part of Rails).
274
274
  test_files: []