actionview 5.2.8.1 → 6.0.0.beta2

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.

Potentially problematic release.


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

Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +121 -152
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/action_view/base.rb +107 -10
  6. data/lib/action_view/buffers.rb +15 -0
  7. data/lib/action_view/context.rb +5 -9
  8. data/lib/action_view/digestor.rb +8 -11
  9. data/lib/action_view/file_template.rb +33 -0
  10. data/lib/action_view/gem_version.rb +4 -4
  11. data/lib/action_view/helpers/asset_tag_helper.rb +7 -30
  12. data/lib/action_view/helpers/asset_url_helper.rb +4 -3
  13. data/lib/action_view/helpers/cache_helper.rb +18 -10
  14. data/lib/action_view/helpers/capture_helper.rb +4 -0
  15. data/lib/action_view/helpers/csp_helper.rb +4 -2
  16. data/lib/action_view/helpers/csrf_helper.rb +1 -1
  17. data/lib/action_view/helpers/date_helper.rb +69 -25
  18. data/lib/action_view/helpers/form_helper.rb +240 -8
  19. data/lib/action_view/helpers/form_options_helper.rb +23 -15
  20. data/lib/action_view/helpers/form_tag_helper.rb +9 -9
  21. data/lib/action_view/helpers/javascript_helper.rb +10 -11
  22. data/lib/action_view/helpers/number_helper.rb +5 -0
  23. data/lib/action_view/helpers/rendering_helper.rb +6 -4
  24. data/lib/action_view/helpers/sanitize_helper.rb +3 -3
  25. data/lib/action_view/helpers/tag_helper.rb +13 -43
  26. data/lib/action_view/helpers/tags/base.rb +9 -5
  27. data/lib/action_view/helpers/tags/color_field.rb +1 -1
  28. data/lib/action_view/helpers/tags/translator.rb +1 -6
  29. data/lib/action_view/helpers/text_helper.rb +3 -3
  30. data/lib/action_view/helpers/translation_helper.rb +12 -19
  31. data/lib/action_view/helpers/url_helper.rb +14 -14
  32. data/lib/action_view/helpers.rb +0 -2
  33. data/lib/action_view/layouts.rb +5 -5
  34. data/lib/action_view/log_subscriber.rb +6 -6
  35. data/lib/action_view/lookup_context.rb +63 -28
  36. data/lib/action_view/railtie.rb +23 -0
  37. data/lib/action_view/record_identifier.rb +2 -2
  38. data/lib/action_view/renderer/abstract_renderer.rb +56 -3
  39. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +49 -10
  40. data/lib/action_view/renderer/partial_renderer.rb +66 -52
  41. data/lib/action_view/renderer/renderer.rb +16 -4
  42. data/lib/action_view/renderer/streaming_template_renderer.rb +4 -4
  43. data/lib/action_view/renderer/template_renderer.rb +18 -18
  44. data/lib/action_view/rendering.rb +49 -30
  45. data/lib/action_view/routing_url_for.rb +12 -11
  46. data/lib/action_view/template/handlers/builder.rb +2 -2
  47. data/lib/action_view/template/handlers/erb/erubi.rb +7 -3
  48. data/lib/action_view/template/handlers/erb.rb +17 -7
  49. data/lib/action_view/template/handlers/html.rb +1 -1
  50. data/lib/action_view/template/handlers/raw.rb +2 -2
  51. data/lib/action_view/template/handlers.rb +27 -1
  52. data/lib/action_view/template/html.rb +14 -5
  53. data/lib/action_view/template/inline.rb +22 -0
  54. data/lib/action_view/template/resolver.rb +70 -23
  55. data/lib/action_view/template/text.rb +5 -3
  56. data/lib/action_view/template.rb +75 -36
  57. data/lib/action_view/test_case.rb +1 -1
  58. data/lib/action_view/testing/resolvers.rb +7 -5
  59. data/lib/action_view/view_paths.rb +25 -1
  60. data/lib/action_view.rb +2 -2
  61. data/lib/assets/compiled/rails-ujs.js +39 -22
  62. metadata +19 -18
  63. data/lib/action_view/helpers/record_tag_helper.rb +0 -23
@@ -2,13 +2,23 @@
2
2
 
3
3
  require "active_support/core_ext/object/try"
4
4
  require "active_support/core_ext/kernel/singleton_class"
5
+ require "active_support/deprecation"
5
6
  require "thread"
7
+ require "delegate"
6
8
 
7
9
  module ActionView
8
10
  # = Action View Template
9
11
  class Template
10
12
  extend ActiveSupport::Autoload
11
13
 
14
+ def self.finalize_compiled_template_methods
15
+ ActiveSupport::Deprecation.warn "ActionView::Template.finalize_compiled_template_methods is deprecated and has no effect"
16
+ end
17
+
18
+ def self.finalize_compiled_template_methods=(_)
19
+ ActiveSupport::Deprecation.warn "ActionView::Template.finalize_compiled_template_methods= is deprecated and has no effect"
20
+ end
21
+
12
22
  # === Encodings in ActionView::Template
13
23
  #
14
24
  # ActionView::Template is one of a few sources of potential
@@ -105,28 +115,23 @@ module ActionView
105
115
  autoload :Error
106
116
  autoload :Handlers
107
117
  autoload :HTML
118
+ autoload :Inline
108
119
  autoload :Text
109
120
  autoload :Types
110
121
  end
111
122
 
112
123
  extend Template::Handlers
113
124
 
114
- attr_accessor :locals, :formats, :variants, :virtual_path
125
+ attr_accessor :locals, :variants, :virtual_path
115
126
 
116
127
  attr_reader :source, :identifier, :handler, :original_encoding, :updated_at
128
+ attr_reader :variable, :format
117
129
 
118
- # This finalizer is needed (and exactly with a proc inside another proc)
119
- # otherwise templates leak in development.
120
- Finalizer = proc do |method_name, mod| # :nodoc:
121
- proc do
122
- mod.module_eval do
123
- remove_possible_method method_name
124
- end
130
+ def initialize(source, identifier, handler, format: nil, **details)
131
+ unless format
132
+ ActiveSupport::Deprecation.warn "ActionView::Template#initialize requires a format parameter"
133
+ format = :html
125
134
  end
126
- end
127
-
128
- def initialize(source, identifier, handler, details)
129
- format = details[:format] || (handler.default_format if handler.respond_to?(:default_format))
130
135
 
131
136
  @source = source
132
137
  @identifier = identifier
@@ -135,12 +140,25 @@ module ActionView
135
140
  @original_encoding = nil
136
141
  @locals = details[:locals] || []
137
142
  @virtual_path = details[:virtual_path]
143
+
144
+ @variable = if @virtual_path
145
+ base = @virtual_path[-1] == "/" ? "" : File.basename(@virtual_path)
146
+ base =~ /\A_?(.*?)(?:\.\w+)*\z/
147
+ $1.to_sym
148
+ end
149
+
138
150
  @updated_at = details[:updated_at] || Time.now
139
- @formats = Array(format).map { |f| f.respond_to?(:ref) ? f.ref : f }
151
+ @format = format
140
152
  @variants = [details[:variant]]
141
153
  @compile_mutex = Mutex.new
142
154
  end
143
155
 
156
+ def formats=(_)
157
+ end
158
+ deprecate :formats=
159
+
160
+ deprecate def formats; Array(format); end
161
+
144
162
  # Returns whether the underlying handler supports streaming. If so,
145
163
  # a streaming buffer *may* be passed when it starts rendering.
146
164
  def supports_streaming?
@@ -153,17 +171,17 @@ module ActionView
153
171
  # This method is instrumented as "!render_template.action_view". Notice that
154
172
  # we use a bang in this instrumentation because you don't want to
155
173
  # consume this in production. This is only slow if it's being listened to.
156
- def render(view, locals, buffer = nil, &block)
174
+ def render(view, locals, buffer = ActionView::OutputBuffer.new, &block)
157
175
  instrument_render_template do
158
176
  compile!(view)
159
- view.send(method_name, locals, buffer, &block)
177
+ view.run(method_name, self, locals, buffer, &block)
160
178
  end
161
179
  rescue => e
162
180
  handle_render_error(view, e)
163
181
  end
164
182
 
165
183
  def type
166
- @type ||= Types[@formats.first] if @formats.first
184
+ @type ||= Types[format]
167
185
  end
168
186
 
169
187
  # Receives a view object and return a template similar to self by using @virtual_path.
@@ -185,8 +203,12 @@ module ActionView
185
203
  end
186
204
  end
187
205
 
206
+ def short_identifier
207
+ @short_identifier ||= defined?(Rails.root) ? identifier.sub("#{Rails.root}/", "") : identifier
208
+ end
209
+
188
210
  def inspect
189
- @inspect ||= defined?(Rails.root) ? identifier.sub("#{Rails.root}/", "".freeze) : identifier
211
+ "#<#{self.class.name} #{short_identifier} locals=#{@locals.inspect}>"
190
212
  end
191
213
 
192
214
  # This method is responsible for properly setting the encoding of the
@@ -200,7 +222,9 @@ module ActionView
200
222
  # before passing the source on to the template engine, leaving a
201
223
  # blank line in its stead.
202
224
  def encode!
203
- return unless source.encoding == Encoding::BINARY
225
+ source = self.source
226
+
227
+ return source unless source.encoding == Encoding::BINARY
204
228
 
205
229
  # Look for # encoding: *. If we find one, we'll encode the
206
230
  # String in that encoding, otherwise, we'll use the
@@ -233,6 +257,19 @@ module ActionView
233
257
  end
234
258
  end
235
259
 
260
+
261
+ # Exceptions are marshalled when using the parallel test runner with DRb, so we need
262
+ # to ensure that references to the template object can be marshalled as well. This means forgoing
263
+ # the marshalling of the compiler mutex and instantiating that again on unmarshalling.
264
+ def marshal_dump # :nodoc:
265
+ [ @source, @identifier, @handler, @compiled, @original_encoding, @locals, @virtual_path, @updated_at, @format, @variants ]
266
+ end
267
+
268
+ def marshal_load(array) # :nodoc:
269
+ @source, @identifier, @handler, @compiled, @original_encoding, @locals, @virtual_path, @updated_at, @format, @variants = *array
270
+ @compile_mutex = Mutex.new
271
+ end
272
+
236
273
  private
237
274
 
238
275
  # Compile a template. This method ensures a template is compiled
@@ -249,11 +286,7 @@ module ActionView
249
286
  # re-compilation
250
287
  return if @compiled
251
288
 
252
- if view.is_a?(ActionView::CompiledTemplates)
253
- mod = ActionView::CompiledTemplates
254
- else
255
- mod = view.singleton_class
256
- end
289
+ mod = view.compiled_method_container
257
290
 
258
291
  instrument("!compile_template") do
259
292
  compile(mod)
@@ -266,6 +299,15 @@ module ActionView
266
299
  end
267
300
  end
268
301
 
302
+ class LegacyTemplate < DelegateClass(Template) # :nodoc:
303
+ attr_reader :source
304
+
305
+ def initialize(template, source)
306
+ super(template)
307
+ @source = source
308
+ end
309
+ end
310
+
269
311
  # Among other things, this method is responsible for properly setting
270
312
  # the encoding of the compiled template.
271
313
  #
@@ -279,16 +321,14 @@ module ActionView
279
321
  # In general, this means that templates will be UTF-8 inside of Rails,
280
322
  # regardless of the original source encoding.
281
323
  def compile(mod)
282
- encode!
283
- code = @handler.call(self)
324
+ source = encode!
325
+ code = @handler.call(self, source)
284
326
 
285
327
  # Make sure that the resulting String to be eval'd is in the
286
328
  # encoding of the code
287
- source = <<-end_src.dup
329
+ source = +<<-end_src
288
330
  def #{method_name}(local_assigns, output_buffer)
289
- _old_virtual_path, @virtual_path = @virtual_path, #{@virtual_path.inspect};_old_output_buffer = @output_buffer;#{locals_code};#{code}
290
- ensure
291
- @virtual_path, @output_buffer = _old_virtual_path, _old_output_buffer
331
+ @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}
292
332
  end
293
333
  end_src
294
334
 
@@ -303,11 +343,10 @@ module ActionView
303
343
  # handler is valid in the default_internal. This is for handlers
304
344
  # that handle encoding but screw up
305
345
  unless source.valid_encoding?
306
- raise WrongEncodingError.new(@source, Encoding.default_internal)
346
+ raise WrongEncodingError.new(source, Encoding.default_internal)
307
347
  end
308
348
 
309
349
  mod.module_eval(source, identifier, 0)
310
- ObjectSpace.define_finalizer(self, Finalizer[method_name, mod])
311
350
  end
312
351
 
313
352
  def handle_render_error(view, e)
@@ -331,19 +370,19 @@ module ActionView
331
370
  locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
332
371
 
333
372
  # Assign for the same variable is to suppress unused variable warning
334
- locals.each_with_object("".dup) { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" }
373
+ locals.each_with_object(+"") { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" }
335
374
  end
336
375
 
337
376
  def method_name
338
377
  @method_name ||= begin
339
- m = "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".dup
340
- m.tr!("-".freeze, "_".freeze)
378
+ m = +"_#{identifier_method_name}__#{@identifier.hash}_#{__id__}"
379
+ m.tr!("-", "_")
341
380
  m
342
381
  end
343
382
  end
344
383
 
345
384
  def identifier_method_name
346
- inspect.tr("^a-z_".freeze, "_".freeze)
385
+ short_identifier.tr("^a-z_", "_")
347
386
  end
348
387
 
349
388
  def instrument(action, &block) # :doc:
@@ -351,7 +390,7 @@ module ActionView
351
390
  end
352
391
 
353
392
  def instrument_render_template(&block)
354
- ActiveSupport::Notifications.instrument("!render_template.action_view".freeze, instrument_payload, &block)
393
+ ActiveSupport::Notifications.instrument("!render_template.action_view", instrument_payload, &block)
355
394
  end
356
395
 
357
396
  def instrument_payload
@@ -107,7 +107,7 @@ module ActionView
107
107
  # empty string ensures buffer has UTF-8 encoding as
108
108
  # new without arguments returns ASCII-8BIT encoded buffer like String#new
109
109
  @output_buffer = ActiveSupport::SafeBuffer.new ""
110
- @rendered = "".dup
110
+ @rendered = +""
111
111
 
112
112
  make_test_case_available_to_view!
113
113
  say_no_to_protect_against_forgery!
@@ -8,13 +8,15 @@ module ActionView #:nodoc:
8
8
  # useful for testing extensions that have no way of knowing what the file
9
9
  # system will look like at runtime.
10
10
  class FixtureResolver < PathResolver
11
- attr_reader :hash
12
-
13
11
  def initialize(hash = {}, pattern = nil)
14
12
  super(pattern)
15
13
  @hash = hash
16
14
  end
17
15
 
16
+ def data
17
+ @hash
18
+ end
19
+
18
20
  def to_s
19
21
  @hash.keys.join(", ")
20
22
  end
@@ -22,7 +24,7 @@ module ActionView #:nodoc:
22
24
  private
23
25
 
24
26
  def query(path, exts, _, _)
25
- query = "".dup
27
+ query = +""
26
28
  EXTENSIONS.each_key do |ext|
27
29
  query << "(" << exts[ext].map { |e| e && Regexp.escape(".#{e}") }.join("|") << "|)"
28
30
  end
@@ -32,7 +34,7 @@ module ActionView #:nodoc:
32
34
  @hash.each do |_path, array|
33
35
  source, updated_at = array
34
36
  next unless query.match?(_path)
35
- handler, format, variant = extract_handler_and_format_and_variant(_path)
37
+ handler, format, variant = extract_handler_and_format_and_variant(_path, :html)
36
38
  templates << Template.new(source, _path, handler,
37
39
  virtual_path: path.virtual,
38
40
  format: format,
@@ -47,7 +49,7 @@ module ActionView #:nodoc:
47
49
 
48
50
  class NullResolver < PathResolver
49
51
  def query(path, exts, _, _)
50
- handler, format, variant = extract_handler_and_format_and_variant(path)
52
+ handler, format, variant = extract_handler_and_format_and_variant(path, :html)
51
53
  [ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant)]
52
54
  end
53
55
  end
@@ -5,13 +5,21 @@ module ActionView
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- class_attribute :_view_paths, default: ActionView::PathSet.new.freeze
8
+ ViewPaths.set_view_paths(self, ActionView::PathSet.new.freeze)
9
9
  end
10
10
 
11
11
  delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=,
12
12
  :locale, :locale=, to: :lookup_context
13
13
 
14
14
  module ClassMethods
15
+ def _view_paths
16
+ ViewPaths.get_view_paths(self)
17
+ end
18
+
19
+ def _view_paths=(paths)
20
+ ViewPaths.set_view_paths(self, paths)
21
+ end
22
+
15
23
  def _prefixes # :nodoc:
16
24
  @_prefixes ||= begin
17
25
  return local_prefixes if superclass.abstract?
@@ -29,6 +37,22 @@ module ActionView
29
37
  end
30
38
  end
31
39
 
40
+ # :stopdoc:
41
+ @all_view_paths = {}
42
+
43
+ def self.get_view_paths(klass)
44
+ @all_view_paths[klass] || get_view_paths(klass.superclass)
45
+ end
46
+
47
+ def self.set_view_paths(klass, paths)
48
+ @all_view_paths[klass] = paths
49
+ end
50
+
51
+ def self.all_view_paths
52
+ @all_view_paths.values.uniq
53
+ end
54
+ # :startdoc:
55
+
32
56
  # The prefixes used in render "foo" shortcuts.
33
57
  def _prefixes # :nodoc:
34
58
  self.class._prefixes
data/lib/action_view.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2018 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2019 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
@@ -35,7 +35,6 @@ module ActionView
35
35
  eager_autoload do
36
36
  autoload :Base
37
37
  autoload :Context
38
- autoload :CompiledTemplates, "action_view/context"
39
38
  autoload :Digestor
40
39
  autoload :Helpers
41
40
  autoload :LookupContext
@@ -45,6 +44,7 @@ module ActionView
45
44
  autoload :Rendering
46
45
  autoload :RoutingUrlFor
47
46
  autoload :Template
47
+ autoload :FileTemplate
48
48
  autoload :ViewPaths
49
49
 
50
50
  autoload_under "renderer" do
@@ -2,7 +2,7 @@
2
2
  Unobtrusive JavaScript
3
3
  https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
4
4
  Released under the MIT license
5
- */;
5
+ */
6
6
 
7
7
  (function() {
8
8
  var context = this;
@@ -32,17 +32,12 @@ Released under the MIT license
32
32
 
33
33
  (function() {
34
34
  (function() {
35
- var nonce;
35
+ var cspNonce;
36
36
 
37
- nonce = null;
38
-
39
- Rails.loadCSPNonce = function() {
40
- var ref;
41
- return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
42
- };
43
-
44
- Rails.cspNonce = function() {
45
- return nonce != null ? nonce : Rails.loadCSPNonce();
37
+ cspNonce = Rails.cspNonce = function() {
38
+ var meta;
39
+ meta = document.querySelector('meta[name=csp-nonce]');
40
+ return meta && meta.content;
46
41
  };
47
42
 
48
43
  }).call(this);
@@ -247,8 +242,8 @@ Released under the MIT license
247
242
  }
248
243
  if (!options.crossDomain) {
249
244
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
250
- CSRFProtection(xhr);
251
245
  }
246
+ CSRFProtection(xhr);
252
247
  xhr.withCredentials = !!options.withCredentials;
253
248
  xhr.onreadystatechange = function() {
254
249
  if (xhr.readyState === XMLHttpRequest.DONE) {
@@ -270,7 +265,7 @@ Released under the MIT license
270
265
  script.setAttribute('nonce', cspNonce());
271
266
  script.text = response;
272
267
  document.head.appendChild(script).parentNode.removeChild(script);
273
- } else if (type.match(/\b(xml|html|svg)\b/)) {
268
+ } else if (type.match(/\bxml\b/)) {
274
269
  parser = new DOMParser();
275
270
  type = type.replace(/;.+/, '');
276
271
  try {
@@ -370,6 +365,10 @@ Released under the MIT license
370
365
  }
371
366
  };
372
367
 
368
+ Rails.confirm = function(message, element) {
369
+ return confirm(message);
370
+ };
371
+
373
372
  allowAction = function(element) {
374
373
  var answer, callback, message;
375
374
  message = element.getAttribute('data-confirm');
@@ -379,7 +378,7 @@ Released under the MIT license
379
378
  answer = false;
380
379
  if (fire(element, 'confirm')) {
381
380
  try {
382
- answer = confirm(message);
381
+ answer = Rails.confirm(message, element);
383
382
  } catch (error) {}
384
383
  callback = fire(element, 'confirm:complete', [answer]);
385
384
  }
@@ -388,7 +387,7 @@ Released under the MIT license
388
387
 
389
388
  }).call(this);
390
389
  (function() {
391
- var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;
390
+ var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;
392
391
 
393
392
  matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
394
393
 
@@ -402,7 +401,14 @@ Released under the MIT license
402
401
 
403
402
  Rails.enableElement = function(e) {
404
403
  var element;
405
- element = e instanceof Event ? e.target : e;
404
+ if (e instanceof Event) {
405
+ if (isXhrRedirect(e)) {
406
+ return;
407
+ }
408
+ element = e.target;
409
+ } else {
410
+ element = e;
411
+ }
406
412
  if (matches(element, Rails.linkDisableSelector)) {
407
413
  return enableLinkElement(element);
408
414
  } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
@@ -426,6 +432,9 @@ Released under the MIT license
426
432
 
427
433
  disableLinkElement = function(element) {
428
434
  var replacement;
435
+ if (getData(element, 'ujs:disabled')) {
436
+ return;
437
+ }
429
438
  replacement = element.getAttribute('data-disable-with');
430
439
  if (replacement != null) {
431
440
  setData(element, 'ujs:enable-with', element.innerHTML);
@@ -452,6 +461,9 @@ Released under the MIT license
452
461
 
453
462
  disableFormElement = function(element) {
454
463
  var replacement;
464
+ if (getData(element, 'ujs:disabled')) {
465
+ return;
466
+ }
455
467
  replacement = element.getAttribute('data-disable-with');
456
468
  if (replacement != null) {
457
469
  if (matches(element, 'button')) {
@@ -485,6 +497,12 @@ Released under the MIT license
485
497
  return setData(element, 'ujs:disabled', null);
486
498
  };
487
499
 
500
+ isXhrRedirect = function(event) {
501
+ var ref, xhr;
502
+ xhr = (ref = event.detail) != null ? ref[0] : void 0;
503
+ return (xhr != null ? xhr.getResponseHeader("X-Xhr-Redirect") : void 0) != null;
504
+ };
505
+
488
506
  }).call(this);
489
507
  (function() {
490
508
  var stopEverything;
@@ -622,23 +640,23 @@ Released under the MIT license
622
640
  };
623
641
 
624
642
  Rails.preventInsignificantClick = function(e) {
625
- var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
643
+ var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey;
626
644
  link = this;
627
645
  method = (link.getAttribute('data-method') || 'GET').toUpperCase();
628
646
  data = link.getAttribute('data-params');
629
647
  metaClick = e.metaKey || e.ctrlKey;
630
648
  insignificantMetaClick = metaClick && method === 'GET' && !data;
631
- nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
632
- if (nonPrimaryMouseClick || insignificantMetaClick) {
649
+ primaryMouseKey = e.button === 0;
650
+ if (!primaryMouseKey || insignificantMetaClick) {
633
651
  return e.stopImmediatePropagation();
634
652
  }
635
653
  };
636
654
 
637
655
  }).call(this);
638
656
  (function() {
639
- var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
657
+ var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, preventInsignificantClick, refreshCSRFTokens;
640
658
 
641
- fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
659
+ fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
642
660
 
643
661
  if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
644
662
  if (jQuery.rails) {
@@ -701,7 +719,6 @@ Released under the MIT license
701
719
  delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
702
720
  delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
703
721
  document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
704
- document.addEventListener('DOMContentLoaded', loadCSPNonce);
705
722
  return window._rails_loaded = true;
706
723
  };
707
724
 
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: 5.2.8.1
4
+ version: 6.0.0.beta2
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: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2019-02-25 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: 5.2.8.1
19
+ version: 6.0.0.beta2
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: 5.2.8.1
26
+ version: 6.0.0.beta2
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: 5.2.8.1
95
+ version: 6.0.0.beta2
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: 5.2.8.1
102
+ version: 6.0.0.beta2
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: 5.2.8.1
109
+ version: 6.0.0.beta2
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: 5.2.8.1
116
+ version: 6.0.0.beta2
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -129,6 +129,7 @@ files:
129
129
  - lib/action_view/context.rb
130
130
  - lib/action_view/dependency_tracker.rb
131
131
  - lib/action_view/digestor.rb
132
+ - lib/action_view/file_template.rb
132
133
  - lib/action_view/flows.rb
133
134
  - lib/action_view/gem_version.rb
134
135
  - lib/action_view/helpers.rb
@@ -149,7 +150,6 @@ files:
149
150
  - lib/action_view/helpers/javascript_helper.rb
150
151
  - lib/action_view/helpers/number_helper.rb
151
152
  - lib/action_view/helpers/output_safety_helper.rb
152
- - lib/action_view/helpers/record_tag_helper.rb
153
153
  - lib/action_view/helpers/rendering_helper.rb
154
154
  - lib/action_view/helpers/sanitize_helper.rb
155
155
  - lib/action_view/helpers/tag_helper.rb
@@ -218,6 +218,7 @@ files:
218
218
  - lib/action_view/template/handlers/html.rb
219
219
  - lib/action_view/template/handlers/raw.rb
220
220
  - lib/action_view/template/html.rb
221
+ - lib/action_view/template/inline.rb
221
222
  - lib/action_view/template/resolver.rb
222
223
  - lib/action_view/template/text.rb
223
224
  - lib/action_view/template/types.rb
@@ -230,9 +231,9 @@ homepage: http://rubyonrails.org
230
231
  licenses:
231
232
  - MIT
232
233
  metadata:
233
- source_code_uri: https://github.com/rails/rails/tree/v5.2.8.1/actionview
234
- changelog_uri: https://github.com/rails/rails/blob/v5.2.8.1/actionview/CHANGELOG.md
235
- post_install_message:
234
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta2/actionview
235
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta2/actionview/CHANGELOG.md
236
+ post_install_message:
236
237
  rdoc_options: []
237
238
  require_paths:
238
239
  - lib
@@ -240,16 +241,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
241
  requirements:
241
242
  - - ">="
242
243
  - !ruby/object:Gem::Version
243
- version: 2.2.2
244
+ version: 2.5.0
244
245
  required_rubygems_version: !ruby/object:Gem::Requirement
245
246
  requirements:
246
- - - ">="
247
+ - - ">"
247
248
  - !ruby/object:Gem::Version
248
- version: '0'
249
+ version: 1.3.1
249
250
  requirements:
250
251
  - none
251
- rubygems_version: 3.3.3
252
- signing_key:
252
+ rubygems_version: 3.0.1
253
+ signing_key:
253
254
  specification_version: 4
254
255
  summary: Rendering framework putting the V in MVC (part of Rails).
255
256
  test_files: []
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers #:nodoc:
5
- module RecordTagHelper
6
- def div_for(*) # :nodoc:
7
- raise NoMethodError, "The `div_for` method has been removed from " \
8
- "Rails. To continue using it, add the `record_tag_helper` gem to " \
9
- "your Gemfile:\n" \
10
- " gem 'record_tag_helper', '~> 1.0'\n" \
11
- "Consult the Rails upgrade guide for details."
12
- end
13
-
14
- def content_tag_for(*) # :nodoc:
15
- raise NoMethodError, "The `content_tag_for` method has been removed from " \
16
- "Rails. To continue using it, add the `record_tag_helper` gem to " \
17
- "your Gemfile:\n" \
18
- " gem 'record_tag_helper', '~> 1.0'\n" \
19
- "Consult the Rails upgrade guide for details."
20
- end
21
- end
22
- end
23
- end