actionview 7.0.1 → 7.0.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: a0499866fc1d0b55328f83d86a26025ca2be3d35e194161818e9dc95e853ff51
4
- data.tar.gz: 31312e3b52e679c085b2c0b87f2096824d2bcd049057e9ad86ad5d906f41ebd1
3
+ metadata.gz: cd5148e1fea744398c1a679f8406c30c091da0f4327dc675689dbc5c0b50959b
4
+ data.tar.gz: a529a23b4b3a25e31f764685dc4acfb571695841dfc1a1705c09a203b04d6e2c
5
5
  SHA512:
6
- metadata.gz: 17d1b29ecd9d8739db10542273eb562318a5063aead96ab19e37954b9f57733ab94125873c91e4ae6f57ef960b27b2cb3b40eff4316e6f27a9ce78ae318b7b3b
7
- data.tar.gz: d8de46c0a31feb9d151de912d7129747f7baa3d30586840c3b898b8c91493baa00f6bd003e75e686dcba70a382ccacdc64a5626dbdee19d0e4a29c7159300e6f
6
+ metadata.gz: 8355d76c2169a26a90adedb6e6926cbfb228091019a9a3429b5b8a4b7dda7e4e3c39a3a6099d0c50689c434018313550d7b363cc7309ce6ce0553a07f6e4df3c
7
+ data.tar.gz: 6b7aa27ae995e9f89b237c21657f9490c80d2224e33d74f524f0741808ec46e0383760b64c817add387b1e0fe7c047b5698aa254e7f33c2986127e3595e47398
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Rails 7.0.2 (February 08, 2022) ##
2
+
3
+ * Ensure `preload_link_tag` preloads JavaScript modules correctly.
4
+
5
+ *Máximo Mussini*
6
+
7
+ * Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
8
+ a `response` method.
9
+
10
+ *dark-panda*
11
+
12
+
1
13
  ## Rails 7.0.1 (January 06, 2022) ##
2
14
 
3
15
  * Fix `button_to` to work with a hash parameter as URL.
@@ -9,7 +9,7 @@ module ActionView
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -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"))
@@ -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
  #
@@ -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,16 +262,6 @@ 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">
@@ -314,22 +304,19 @@ module ActionView
314
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" autocomplete="off"/>
323
- # # </form>"
307
+ # ==== Deprecated: Rails UJS attributes
324
308
  #
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" autocomplete="off"/>
331
- # # </form>"
332
- # #
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:
311
+ #
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 ||= {}
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.1
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-02-08 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.1
19
+ version: 7.0.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.1
26
+ version: 7.0.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.1
95
+ version: 7.0.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.1
102
+ version: 7.0.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.1
109
+ version: 7.0.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.1
116
+ version: 7.0.2
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -246,10 +246,10 @@ 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.1/actionview/CHANGELOG.md
250
- documentation_uri: https://api.rubyonrails.org/v7.0.1/
249
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.2/actionview/CHANGELOG.md
250
+ documentation_uri: https://api.rubyonrails.org/v7.0.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.1/actionview
252
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.2/actionview
253
253
  rubygems_mfa_required: 'true'
254
254
  post_install_message:
255
255
  rdoc_options: []