actionview 6.0.0.beta1 → 6.1.4

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.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +273 -119
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +5 -3
  5. data/lib/action_view/base.rb +81 -15
  6. data/lib/action_view/cache_expiry.rb +52 -0
  7. data/lib/action_view/context.rb +0 -5
  8. data/lib/action_view/dependency_tracker.rb +10 -4
  9. data/lib/action_view/digestor.rb +11 -19
  10. data/lib/action_view/flows.rb +0 -1
  11. data/lib/action_view/gem_version.rb +3 -3
  12. data/lib/action_view/helpers/active_model_helper.rb +0 -1
  13. data/lib/action_view/helpers/asset_tag_helper.rb +62 -22
  14. data/lib/action_view/helpers/asset_url_helper.rb +6 -4
  15. data/lib/action_view/helpers/atom_feed_helper.rb +2 -1
  16. data/lib/action_view/helpers/cache_helper.rb +16 -23
  17. data/lib/action_view/helpers/csp_helper.rb +4 -2
  18. data/lib/action_view/helpers/date_helper.rb +5 -6
  19. data/lib/action_view/helpers/form_helper.rb +70 -34
  20. data/lib/action_view/helpers/form_options_helper.rb +10 -18
  21. data/lib/action_view/helpers/form_tag_helper.rb +12 -9
  22. data/lib/action_view/helpers/javascript_helper.rb +7 -5
  23. data/lib/action_view/helpers/number_helper.rb +9 -8
  24. data/lib/action_view/helpers/output_safety_helper.rb +1 -1
  25. data/lib/action_view/helpers/rendering_helper.rb +17 -7
  26. data/lib/action_view/helpers/sanitize_helper.rb +10 -16
  27. data/lib/action_view/helpers/tag_helper.rb +94 -19
  28. data/lib/action_view/helpers/tags/base.rb +10 -7
  29. data/lib/action_view/helpers/tags/check_box.rb +0 -1
  30. data/lib/action_view/helpers/tags/collection_check_boxes.rb +0 -1
  31. data/lib/action_view/helpers/tags/collection_helpers.rb +0 -1
  32. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +0 -1
  33. data/lib/action_view/helpers/tags/color_field.rb +0 -1
  34. data/lib/action_view/helpers/tags/date_field.rb +1 -2
  35. data/lib/action_view/helpers/tags/date_select.rb +2 -3
  36. data/lib/action_view/helpers/tags/datetime_field.rb +0 -1
  37. data/lib/action_view/helpers/tags/datetime_local_field.rb +1 -2
  38. data/lib/action_view/helpers/tags/label.rb +4 -1
  39. data/lib/action_view/helpers/tags/month_field.rb +1 -2
  40. data/lib/action_view/helpers/tags/radio_button.rb +0 -1
  41. data/lib/action_view/helpers/tags/select.rb +1 -2
  42. data/lib/action_view/helpers/tags/text_field.rb +0 -1
  43. data/lib/action_view/helpers/tags/time_field.rb +1 -2
  44. data/lib/action_view/helpers/tags/week_field.rb +1 -2
  45. data/lib/action_view/helpers/text_helper.rb +2 -3
  46. data/lib/action_view/helpers/translation_helper.rb +98 -51
  47. data/lib/action_view/helpers/url_helper.rb +124 -16
  48. data/lib/action_view/layouts.rb +8 -10
  49. data/lib/action_view/log_subscriber.rb +26 -11
  50. data/lib/action_view/lookup_context.rb +59 -31
  51. data/lib/action_view/path_set.rb +3 -12
  52. data/lib/action_view/railtie.rb +39 -41
  53. data/lib/action_view/record_identifier.rb +0 -1
  54. data/lib/action_view/renderer/abstract_renderer.rb +142 -11
  55. data/lib/action_view/renderer/collection_renderer.rb +196 -0
  56. data/lib/action_view/renderer/object_renderer.rb +34 -0
  57. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +35 -29
  58. data/lib/action_view/renderer/partial_renderer.rb +21 -273
  59. data/lib/action_view/renderer/renderer.rb +59 -4
  60. data/lib/action_view/renderer/streaming_template_renderer.rb +9 -7
  61. data/lib/action_view/renderer/template_renderer.rb +35 -27
  62. data/lib/action_view/rendering.rb +49 -29
  63. data/lib/action_view/routing_url_for.rb +1 -1
  64. data/lib/action_view/template/error.rb +30 -15
  65. data/lib/action_view/template/handlers/builder.rb +2 -2
  66. data/lib/action_view/template/handlers/erb/erubi.rb +15 -9
  67. data/lib/action_view/template/handlers/erb.rb +14 -19
  68. data/lib/action_view/template/handlers/html.rb +1 -1
  69. data/lib/action_view/template/handlers/raw.rb +2 -2
  70. data/lib/action_view/template/handlers.rb +1 -1
  71. data/lib/action_view/template/html.rb +5 -6
  72. data/lib/action_view/template/inline.rb +22 -0
  73. data/lib/action_view/template/raw_file.rb +25 -0
  74. data/lib/action_view/template/renderable.rb +24 -0
  75. data/lib/action_view/template/resolver.rb +141 -140
  76. data/lib/action_view/template/sources/file.rb +17 -0
  77. data/lib/action_view/template/sources.rb +13 -0
  78. data/lib/action_view/template/text.rb +2 -3
  79. data/lib/action_view/template.rb +49 -75
  80. data/lib/action_view/test_case.rb +20 -28
  81. data/lib/action_view/testing/resolvers.rb +18 -27
  82. data/lib/action_view/unbound_template.rb +31 -0
  83. data/lib/action_view/view_paths.rb +59 -38
  84. data/lib/action_view.rb +7 -2
  85. data/lib/assets/compiled/rails-ujs.js +25 -16
  86. metadata +30 -18
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  Unobtrusive JavaScript
3
- https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts
3
+ https://github.com/rails/rails/blob/main/actionview/app/assets/javascripts
4
4
  Released under the MIT license
5
- */
5
+ */;
6
6
 
7
7
  (function() {
8
8
  var context = this;
@@ -16,8 +16,8 @@ Released under the MIT license
16
16
  exclude: 'form button'
17
17
  },
18
18
  inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
19
- formSubmitSelector: 'form',
20
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
19
+ formSubmitSelector: 'form:not([data-turbo=true])',
20
+ formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
21
21
  formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
22
22
  formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
23
23
  fileInputSelector: 'input[name][type=file]:not([disabled])',
@@ -32,12 +32,17 @@ Released under the MIT license
32
32
 
33
33
  (function() {
34
34
  (function() {
35
- var cspNonce;
35
+ var nonce;
36
36
 
37
- cspNonce = Rails.cspNonce = function() {
38
- var meta;
39
- meta = document.querySelector('meta[name=csp-nonce]');
40
- return meta && meta.content;
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();
41
46
  };
42
47
 
43
48
  }).call(this);
@@ -242,8 +247,8 @@ Released under the MIT license
242
247
  }
243
248
  if (!options.crossDomain) {
244
249
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
250
+ CSRFProtection(xhr);
245
251
  }
246
- CSRFProtection(xhr);
247
252
  xhr.withCredentials = !!options.withCredentials;
248
253
  xhr.onreadystatechange = function() {
249
254
  if (xhr.readyState === XMLHttpRequest.DONE) {
@@ -265,7 +270,7 @@ Released under the MIT license
265
270
  script.setAttribute('nonce', cspNonce());
266
271
  script.text = response;
267
272
  document.head.appendChild(script).parentNode.removeChild(script);
268
- } else if (type.match(/\bxml\b/)) {
273
+ } else if (type.match(/\b(xml|html|svg)\b/)) {
269
274
  parser = new DOMParser();
270
275
  type = type.replace(/;.+/, '');
271
276
  try {
@@ -315,6 +320,9 @@ Released under the MIT license
315
320
  if (!input.name || input.disabled) {
316
321
  return;
317
322
  }
323
+ if (matches(input, 'fieldset[disabled] *')) {
324
+ return;
325
+ }
318
326
  if (matches(input, 'select')) {
319
327
  return toArray(input.options).forEach(function(option) {
320
328
  if (option.selected) {
@@ -640,23 +648,23 @@ Released under the MIT license
640
648
  };
641
649
 
642
650
  Rails.preventInsignificantClick = function(e) {
643
- var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey;
651
+ var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
644
652
  link = this;
645
653
  method = (link.getAttribute('data-method') || 'GET').toUpperCase();
646
654
  data = link.getAttribute('data-params');
647
655
  metaClick = e.metaKey || e.ctrlKey;
648
656
  insignificantMetaClick = metaClick && method === 'GET' && !data;
649
- primaryMouseKey = e.button === 0;
650
- if (!primaryMouseKey || insignificantMetaClick) {
657
+ nonPrimaryMouseClick = (e.button != null) && e.button !== 0;
658
+ if (nonPrimaryMouseClick || insignificantMetaClick) {
651
659
  return e.stopImmediatePropagation();
652
660
  }
653
661
  };
654
662
 
655
663
  }).call(this);
656
664
  (function() {
657
- var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, preventInsignificantClick, refreshCSRFTokens;
665
+ var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
658
666
 
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;
667
+ 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;
660
668
 
661
669
  if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
662
670
  if (jQuery.rails) {
@@ -719,6 +727,7 @@ Released under the MIT license
719
727
  delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
720
728
  delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
721
729
  document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
730
+ document.addEventListener('DOMContentLoaded', loadCSPNonce);
722
731
  return window._rails_loaded = true;
723
732
  };
724
733
 
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: 6.0.0.beta1
4
+ version: 6.1.4
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: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2021-06-24 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: 6.0.0.beta1
19
+ version: 6.1.4
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: 6.0.0.beta1
26
+ version: 6.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +58,20 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '1.1'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.0.3
64
+ version: 1.2.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: '1.0'
71
+ version: '1.1'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.0.3
74
+ version: 1.2.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rails-dom-testing
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.0.beta1
95
+ version: 6.1.4
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: 6.0.0.beta1
102
+ version: 6.1.4
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: 6.0.0.beta1
109
+ version: 6.1.4
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: 6.0.0.beta1
116
+ version: 6.1.4
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -126,6 +126,7 @@ files:
126
126
  - lib/action_view.rb
127
127
  - lib/action_view/base.rb
128
128
  - lib/action_view/buffers.rb
129
+ - lib/action_view/cache_expiry.rb
129
130
  - lib/action_view/context.rb
130
131
  - lib/action_view/dependency_tracker.rb
131
132
  - lib/action_view/digestor.rb
@@ -200,6 +201,8 @@ files:
200
201
  - lib/action_view/railtie.rb
201
202
  - lib/action_view/record_identifier.rb
202
203
  - lib/action_view/renderer/abstract_renderer.rb
204
+ - lib/action_view/renderer/collection_renderer.rb
205
+ - lib/action_view/renderer/object_renderer.rb
203
206
  - lib/action_view/renderer/partial_renderer.rb
204
207
  - lib/action_view/renderer/partial_renderer/collection_caching.rb
205
208
  - lib/action_view/renderer/renderer.rb
@@ -217,20 +220,29 @@ files:
217
220
  - lib/action_view/template/handlers/html.rb
218
221
  - lib/action_view/template/handlers/raw.rb
219
222
  - lib/action_view/template/html.rb
223
+ - lib/action_view/template/inline.rb
224
+ - lib/action_view/template/raw_file.rb
225
+ - lib/action_view/template/renderable.rb
220
226
  - lib/action_view/template/resolver.rb
227
+ - lib/action_view/template/sources.rb
228
+ - lib/action_view/template/sources/file.rb
221
229
  - lib/action_view/template/text.rb
222
230
  - lib/action_view/template/types.rb
223
231
  - lib/action_view/test_case.rb
224
232
  - lib/action_view/testing/resolvers.rb
233
+ - lib/action_view/unbound_template.rb
225
234
  - lib/action_view/version.rb
226
235
  - lib/action_view/view_paths.rb
227
236
  - lib/assets/compiled/rails-ujs.js
228
- homepage: http://rubyonrails.org
237
+ homepage: https://rubyonrails.org
229
238
  licenses:
230
239
  - MIT
231
240
  metadata:
232
- source_code_uri: https://github.com/rails/rails/tree/v6.0.0.beta1/actionview
233
- changelog_uri: https://github.com/rails/rails/blob/v6.0.0.beta1/actionview/CHANGELOG.md
241
+ bug_tracker_uri: https://github.com/rails/rails/issues
242
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.4/actionview/CHANGELOG.md
243
+ documentation_uri: https://api.rubyonrails.org/v6.1.4/
244
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
245
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.4/actionview
234
246
  post_install_message:
235
247
  rdoc_options: []
236
248
  require_paths:
@@ -242,12 +254,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
254
  version: 2.5.0
243
255
  required_rubygems_version: !ruby/object:Gem::Requirement
244
256
  requirements:
245
- - - ">"
257
+ - - ">="
246
258
  - !ruby/object:Gem::Version
247
- version: 1.3.1
259
+ version: '0'
248
260
  requirements:
249
261
  - none
250
- rubygems_version: 3.0.1
262
+ rubygems_version: 3.1.2
251
263
  signing_key:
252
264
  specification_version: 4
253
265
  summary: Rendering framework putting the V in MVC (part of Rails).