actionview 4.2.10 → 5.1.0

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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +141 -272
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +2 -3
  5. data/lib/action_view/base.rb +33 -21
  6. data/lib/action_view/buffers.rb +1 -1
  7. data/lib/action_view/context.rb +1 -1
  8. data/lib/action_view/dependency_tracker.rb +52 -20
  9. data/lib/action_view/digestor.rb +86 -83
  10. data/lib/action_view/flows.rb +9 -11
  11. data/lib/action_view/gem_version.rb +3 -3
  12. data/lib/action_view/helpers/active_model_helper.rb +8 -8
  13. data/lib/action_view/helpers/asset_tag_helper.rb +74 -38
  14. data/lib/action_view/helpers/asset_url_helper.rb +160 -59
  15. data/lib/action_view/helpers/atom_feed_helper.rb +16 -16
  16. data/lib/action_view/helpers/cache_helper.rb +90 -35
  17. data/lib/action_view/helpers/capture_helper.rb +7 -6
  18. data/lib/action_view/helpers/controller_helper.rb +3 -2
  19. data/lib/action_view/helpers/csrf_helper.rb +3 -3
  20. data/lib/action_view/helpers/date_helper.rb +156 -108
  21. data/lib/action_view/helpers/debug_helper.rb +3 -4
  22. data/lib/action_view/helpers/form_helper.rb +475 -94
  23. data/lib/action_view/helpers/form_options_helper.rb +87 -47
  24. data/lib/action_view/helpers/form_tag_helper.rb +88 -57
  25. data/lib/action_view/helpers/javascript_helper.rb +10 -10
  26. data/lib/action_view/helpers/number_helper.rb +76 -59
  27. data/lib/action_view/helpers/output_safety_helper.rb +34 -4
  28. data/lib/action_view/helpers/record_tag_helper.rb +12 -99
  29. data/lib/action_view/helpers/rendering_helper.rb +3 -3
  30. data/lib/action_view/helpers/sanitize_helper.rb +17 -14
  31. data/lib/action_view/helpers/tag_helper.rb +198 -73
  32. data/lib/action_view/helpers/tags/base.rb +132 -97
  33. data/lib/action_view/helpers/tags/check_box.rb +17 -17
  34. data/lib/action_view/helpers/tags/collection_check_boxes.rb +9 -33
  35. data/lib/action_view/helpers/tags/collection_helpers.rb +68 -36
  36. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -11
  37. data/lib/action_view/helpers/tags/collection_select.rb +2 -2
  38. data/lib/action_view/helpers/tags/date_select.rb +36 -36
  39. data/lib/action_view/helpers/tags/datetime_field.rb +1 -1
  40. data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
  41. data/lib/action_view/helpers/tags/label.rb +5 -1
  42. data/lib/action_view/helpers/tags/password_field.rb +1 -1
  43. data/lib/action_view/helpers/tags/placeholderable.rb +1 -1
  44. data/lib/action_view/helpers/tags/radio_button.rb +4 -4
  45. data/lib/action_view/helpers/tags/search_field.rb +12 -9
  46. data/lib/action_view/helpers/tags/select.rb +9 -9
  47. data/lib/action_view/helpers/tags/text_area.rb +1 -1
  48. data/lib/action_view/helpers/tags/text_field.rb +5 -6
  49. data/lib/action_view/helpers/tags/translator.rb +15 -13
  50. data/lib/action_view/helpers/text_helper.rb +47 -30
  51. data/lib/action_view/helpers/translation_helper.rb +60 -30
  52. data/lib/action_view/helpers/url_helper.rb +132 -104
  53. data/lib/action_view/helpers.rb +1 -1
  54. data/lib/action_view/layouts.rb +59 -54
  55. data/lib/action_view/log_subscriber.rb +56 -7
  56. data/lib/action_view/lookup_context.rb +76 -61
  57. data/lib/action_view/model_naming.rb +1 -1
  58. data/lib/action_view/path_set.rb +28 -19
  59. data/lib/action_view/railtie.rb +30 -6
  60. data/lib/action_view/record_identifier.rb +51 -25
  61. data/lib/action_view/renderer/abstract_renderer.rb +19 -15
  62. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +55 -0
  63. data/lib/action_view/renderer/partial_renderer.rb +208 -206
  64. data/lib/action_view/renderer/renderer.rb +2 -6
  65. data/lib/action_view/renderer/streaming_template_renderer.rb +46 -48
  66. data/lib/action_view/renderer/template_renderer.rb +65 -66
  67. data/lib/action_view/rendering.rb +16 -9
  68. data/lib/action_view/routing_url_for.rb +25 -17
  69. data/lib/action_view/tasks/cache_digests.rake +23 -0
  70. data/lib/action_view/template/error.rb +14 -13
  71. data/lib/action_view/template/handlers/builder.rb +7 -7
  72. data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +9 -0
  73. data/lib/action_view/template/handlers/erb/erubi.rb +81 -0
  74. data/lib/action_view/template/handlers/erb/erubis.rb +81 -0
  75. data/lib/action_view/template/handlers/erb.rb +9 -76
  76. data/lib/action_view/template/handlers/html.rb +9 -0
  77. data/lib/action_view/template/handlers/raw.rb +1 -3
  78. data/lib/action_view/template/handlers.rb +8 -6
  79. data/lib/action_view/template/html.rb +2 -4
  80. data/lib/action_view/template/resolver.rb +133 -109
  81. data/lib/action_view/template/text.rb +5 -8
  82. data/lib/action_view/template/types.rb +15 -17
  83. data/lib/action_view/template.rb +51 -28
  84. data/lib/action_view/test_case.rb +32 -27
  85. data/lib/action_view/testing/resolvers.rb +29 -31
  86. data/lib/action_view/version.rb +1 -1
  87. data/lib/action_view/view_paths.rb +26 -32
  88. data/lib/action_view.rb +5 -5
  89. data/lib/assets/compiled/rails-ujs.js +685 -0
  90. metadata +23 -23
  91. data/lib/action_view/tasks/dependencies.rake +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b92b97d6e7b1c8740c9d8c7cb02f3a9ada24fb0
4
- data.tar.gz: 6536652a2f2d229e1c5f5398a99fd6ade780d92a
3
+ metadata.gz: 1e9b05cb9e60dbd3b1aa2689adf77008a3364b79
4
+ data.tar.gz: dd8f6bdfb4670846a21195cabf8d2a366f818615
5
5
  SHA512:
6
- metadata.gz: e39db4cb286ac5f439006ace85867c8379db236f8c376d76400bc09b60f17032f34c31a4a069015561dd6393abccbf63f8a4243282b6229392efd189217f67e6
7
- data.tar.gz: 619fa8ddf4f3cbf22d9b9eedb11bb62999359396d954cfa63e467b1955625d16e1126067af98ec1a0f03b3ea4d25765a36ad8e36ccdd9114aa1df2b5170b9c9e
6
+ metadata.gz: a01cdde81fcf96e681dc8f90acfc0d213be8db2079bdb776df4c6cfce1167408cca5736259e6066da6c724ca355e63af80d0e765a0bdef9149d7492f0e7ac6c3
7
+ data.tar.gz: b1ca351dbcf16fce71eab9296fe1b696ec670e718c631150bec36f163bd95708d63f9a847ee2ad211b76ae33375cfdfdb53cea74efa2a82a94a09eb8b45a3518
data/CHANGELOG.md CHANGED
@@ -1,347 +1,216 @@
1
- ## Rails 4.2.10 (September 27, 2017) ##
1
+ ## Rails 5.1.0 (April 27, 2017) ##
2
2
 
3
- * No changes.
3
+ * Remove the option `encode_special_chars` misnomer from `strip_tags`
4
4
 
5
+ As of rails-html-sanitizer v1.0.3, the sanitizer will ignore the
6
+ `encode_special_chars` option.
5
7
 
6
- ## Rails 4.2.9 (June 26, 2017) ##
8
+ Fixes #28060.
7
9
 
8
- * No changes.
10
+ *Andrew Hood*
9
11
 
12
+ * Change the ERB handler from Erubis to Erubi.
10
13
 
11
- ## Rails 4.2.8 (February 21, 2017) ##
14
+ Erubi is an Erubis fork that's svelte, simple, and currently maintained.
15
+ Plus it supports `--enable-frozen-string-literal` in Ruby 2.3+.
12
16
 
13
- * No changes.
17
+ Compatibility: Drops support for `<%===` tags for debug output.
18
+ These were an unused, undocumented side effect of the Erubis
19
+ implementation.
14
20
 
21
+ Deprecation: The Erubis handler will be removed in Rails 5.2, for the
22
+ handful of folks using it directly.
15
23
 
16
- ## Rails 4.2.7 (July 12, 2016) ##
24
+ *Jeremy Evans*
17
25
 
18
- * No changes.
26
+ * Allow render locals to be assigned to instance variables in a view.
19
27
 
28
+ Fixes #27480.
20
29
 
21
- ## Rails 4.2.6 (March 07, 2016) ##
30
+ *Andrew White*
22
31
 
23
- * Fix stripping the digest from the automatically generated img tag alt
24
- attribute when assets are handled by Sprockets >=3.0.
32
+ * Add `check_parameters` option to `current_page?` which makes it more strict.
25
33
 
26
- *Bart de Water*
34
+ *Maksym Pugach*
27
35
 
28
- * Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
36
+ * Return correct object name in form helper method after `fields_for`.
29
37
 
30
- Fixes #19890
38
+ Fixes #26931.
31
39
 
32
- *Yoong Kang Lim*
40
+ *Yuji Yaginuma*
33
41
 
34
- * Respect value of `:object` if `:object` is false when rendering.
42
+ * Use `ActionView::Resolver.caching?` (`config.action_view.cache_template_loading`)
43
+ to enable template recompilation.
35
44
 
36
- Fixes #22260.
45
+ Before it was enabled by `consider_all_requests_local`, which caused
46
+ recompilation in tests.
37
47
 
38
- *Yuichiro Kaneko*
48
+ *Max Melentiev*
39
49
 
40
- * Generate `week_field` input values using a 1-based index and not a 0-based index
41
- as per the W3 spec: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week
50
+ * Add `form_with` to unify `form_tag` and `form_for` usage.
42
51
 
43
- *Christoph Geschwind*
52
+ Used like `form_tag` (where just the open tag is output):
44
53
 
54
+ ```erb
55
+ <%= form_with scope: :post, url: super_special_posts_path %>
56
+ ```
45
57
 
46
- ## Rails 4.2.5.2 (February 26, 2016) ##
58
+ Used like `form_for`:
47
59
 
48
- * Do not allow render with unpermitted parameter.
60
+ ```erb
61
+ <%= form_with model: @post do |form| %>
62
+ <%= form.text_field :title %>
63
+ <% end %>
64
+ ```
49
65
 
50
- Fixes CVE-2016-2098.
66
+ *Kasper Timm Hansen*, *Marek Kirejczyk*
51
67
 
52
- *Arthur Neves*
68
+ * Add `fields` form helper method.
53
69
 
70
+ ```erb
71
+ <%= fields :comment, model: @comment do |fields| %>
72
+ <%= fields.text_field :title %>
73
+ <% end %>
74
+ ```
54
75
 
55
- ## Rails 4.2.5.1 (January 25, 2015) ##
76
+ Can also be used within form helpers such as `form_with`.
56
77
 
57
- * Adds boolean argument outside_app_allowed to `ActionView::Resolver#find_templates`
58
- method.
78
+ *Kasper Timm Hansen*
59
79
 
60
- *Aaron Patterson*
61
-
62
-
63
- ## Rails 4.2.5 (November 12, 2015) ##
64
-
65
- * Fix `mail_to` when called with `nil` as argument.
80
+ * Removed deprecated `#original_exception` in `ActionView::Template::Error`.
66
81
 
67
82
  *Rafael Mendonça França*
68
83
 
69
- * `url_for` does not modify its arguments when generating polymorphic URLs.
70
-
71
- *Bernerd Schaefer*
72
-
73
-
74
- ## Rails 4.2.4 (August 24, 2015) ##
75
-
76
- * No Changes *
77
-
78
-
79
- ## Rails 4.2.3 (June 25, 2015) ##
80
-
81
- * `translate` should handle `raise` flag correctly in case of both main and default
82
- translation is missing.
83
-
84
- Fixes #19967
85
-
86
- *Bernard Potocki*
87
-
88
- * `translate` allows `default: [[]]` again for a default value of `[]`.
89
-
90
- Fixes #19640.
91
-
92
- *Adam Prescott*
93
-
94
- * `translate` should accept nils as members of the `:default`
95
- parameter without raising a translation missing error. Fixes a
96
- regression introduced 362557e.
97
-
98
- Fixes #19419
99
-
100
- *Justin Coyne*
101
-
102
- * `number_to_percentage` does not crash with `Float::NAN` or `Float::INFINITY`
103
- as input when `precision: 0` is used.
104
-
105
- Fixes #19227.
106
-
107
- *Yves Senn*
108
-
109
-
110
- ## Rails 4.2.2 (June 16, 2015) ##
111
-
112
- * No Changes *
113
-
114
-
115
- ## Rails 4.2.1 (March 19, 2015) ##
116
-
117
- * Default translations that have a lower precedence than an html safe default,
118
- but are not themselves safe, should not be marked as html_safe.
119
-
120
- *Justin Coyne*
121
-
122
- * Added an explicit error message, in `ActionView::PartialRenderer`
123
- for partial `rendering`, when the value of option `as` has invalid characters.
124
-
125
- *Angelo Capilleri*
126
-
127
-
128
- ## Rails 4.2.0 (December 20, 2014) ##
129
-
130
- * Local variable in a partial is now available even if a falsy value is
131
- passed to `:object` when rendering a partial.
132
-
133
- Fixes #17373.
134
-
135
- *Agis Anastasopoulos*
136
-
137
- * Add support for `:enforce_utf8` option in `form_for`.
138
-
139
- This is the same option that was added in 06388b0 to `form_tag` and allows
140
- users to skip the insertion of the UTF8 enforcer tag in a form.
141
-
142
- * claudiob *
143
-
144
- * Fix a bug that <%= foo(){ %> and <%= foo()do %> in view templates were not regarded
145
- as Ruby block calls.
146
-
147
- * Akira Matsuda *
148
-
149
- * Update `select_tag` to work correctly with `:include_blank` option passing a string.
150
-
151
- Fixes #16483.
152
-
153
- *Frank Groeneveld*
154
-
155
- * Changed the meaning of `render "foo/bar"`.
156
-
157
- Previously, calling `render "foo/bar"` in a controller action is equivalent
158
- to `render file: "foo/bar"`. In Rails 4.2, this has been changed to mean
159
- `render template: "foo/bar"` instead. If you need to render a file, please
160
- change your code to use the explicit form (`render file: "foo/bar"`) instead.
161
-
162
- *Jeremy Jackson*
163
-
164
- * Add support for ARIA attributes in tags.
165
-
166
- Example:
167
-
168
- <%= f.text_field :name, aria: { required: "true", hidden: "false" } %>
169
-
170
- now generates:
171
-
172
- <input aria-hidden="false" aria-required="true" id="user_name" name="user[name]" type="text">
173
-
174
- *Paola Garcia Casadiego*
175
-
176
- * Provide a `builder` object when using the `label` form helper in block form.
177
-
178
- The new `builder` object responds to `translation`, allowing I18n fallback support
179
- when you want to customize how a particular label is presented.
180
-
181
- *Alex Robbin*
182
-
183
- * Add I18n support for input/textarea placeholder text.
184
-
185
- Placeholder I18n follows the same convention as `label` I18n.
186
-
187
- *Alex Robbin*
188
-
189
- * Fix that render layout: 'messages/layout' should also be added to the dependency tracker tree.
190
-
191
- *DHH*
192
-
193
- * Add `PartialIteration` object used when rendering collections.
194
-
195
- The iteration object is available as the local variable
196
- `#{template_name}_iteration` when rendering partials with collections.
197
-
198
- It gives access to the `size` of the collection being iterated over,
199
- the current `index` and two convenience methods `first?` and `last?`.
200
-
201
- *Joel Junström*, *Lucas Uyezu*
202
-
203
- * Return an absolute instead of relative path from an asset url in the case
204
- of the `asset_host` proc returning nil.
205
-
206
- *Jolyon Pawlyn*
207
-
208
- * Fix `html_escape_once` to properly handle hex escape sequences (e.g. &#x1a2b;).
209
-
210
- *John F. Douthat*
211
-
212
- * Added String support for min and max properties for date field helpers.
213
-
214
- *Todd Bealmear*
215
-
216
- * The `highlight` helper now accepts a block to be used instead of the `highlighter`
217
- option.
218
-
219
- *Lucas Mazza*
220
-
221
- * The `except` and `highlight` helpers now accept regular expressions.
222
-
223
- *Jan Szumiec*
224
-
225
- * Flatten the array parameter in `safe_join`, so it behaves consistently with
226
- `Array#join`.
227
-
228
- *Paul Grayson*
229
-
230
- * Honor `html_safe` on array elements in tag values, as we do for plain string
231
- values.
232
-
233
- *Paul Grayson*
234
-
235
- * Add `ActionView::Template::Handler.unregister_template_handler`.
236
-
237
- It performs the opposite of `ActionView::Template::Handler.register_template_handler`.
238
-
239
- *Zuhao Wan*
240
-
241
- * Bring `cache_digest` rake tasks up-to-date with the latest API changes.
242
-
243
- *Jiri Pospisil*
244
-
245
- * Allow custom `:host` option to be passed to `asset_url` helper that
246
- overwrites `config.action_controller.asset_host` for particular asset.
84
+ * Render now accepts any keys for locals, including reserved keywords.
247
85
 
248
- *Hubert Łępicki*
86
+ Only locals with valid variable names get set directly. Others
87
+ will still be available in `local_assigns`.
249
88
 
250
- * Deprecate `AbstractController::Base.parent_prefixes`.
251
- Override `AbstractController::Base.local_prefixes` when you want to change
252
- where to find views.
89
+ Example of render with reserved keywords:
253
90
 
254
- *Nick Sutterer*
91
+ ```erb
92
+ <%= render "example", class: "text-center", message: "Hello world!" %>
255
93
 
256
- * Take label values into account when doing I18n lookups for model attributes.
94
+ <!-- _example.html.erb: -->
95
+ <%= tag.div class: local_assigns[:class] do %>
96
+ <p><%= message %></p>
97
+ <% end %>
98
+ ```
257
99
 
258
- The following:
100
+ *Peter Schilling*, *Matthew Draper*
259
101
 
260
- # form.html.erb
261
- <%= form_for @post do |f| %>
262
- <%= f.label :type, value: "long" %>
263
- <% end %>
102
+ * Add `:skip_pipeline` option to several asset tag helpers
264
103
 
265
- # en.yml
266
- en:
267
- activerecord:
268
- attributes:
269
- post/long: "Long-form Post"
104
+ `javascript_include_tag`, `stylesheet_link_tag`, `favicon_link_tag`,
105
+ `image_tag` and `audio_tag` now accept a `:skip_pipeline` option which can
106
+ be set to true to bypass the asset pipeline and serve the assets from the
107
+ public folder.
270
108
 
271
- Used to simply return "long", but now it will return "Long-form
272
- Post".
109
+ *Richard Schneeman*
273
110
 
274
- *Joshua Cody*
111
+ * Add `:poster_skip_pipeline` option to the `video_tag` helper
275
112
 
276
- * Change `asset_path` to use File.join to create proper paths:
113
+ `video_tag` now accepts a `:poster_skip_pipeline` option which can be used
114
+ in combination with the `:poster` option to bypass the asset pipeline and
115
+ serve the poster image for the video from the public folder.
277
116
 
278
- Before:
117
+ *Richard Schneeman*
279
118
 
280
- https://some.host.com//assets/some.js
119
+ * Show cache hits and misses when rendering partials.
281
120
 
282
- After:
121
+ Partials using the `cache` helper will show whether a render hit or missed
122
+ the cache:
283
123
 
284
- https://some.host.com/assets/some.js
124
+ ```
125
+ Rendered messages/_message.html.erb in 1.2 ms [cache hit]
126
+ Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
127
+ ```
285
128
 
286
- *Peter Schröder*
129
+ This removes the need for the old fragment cache logging:
287
130
 
288
- * Change `favicon_link_tag` default mimetype from `image/vnd.microsoft.icon` to
289
- `image/x-icon`.
131
+ ```
132
+ Read fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/d0bdf2974e1ef6d31685c3b392ad0b74 (0.6ms)
133
+ Rendered messages/_message.html.erb in 1.2 ms [cache hit]
134
+ Write fragment views/v1/2914079/v1/2914079/recordings/70182313-20160225015037000000/3b4e249ac9d168c617e32e84b99218b5 (1.1ms)
135
+ Rendered recordings/threads/_thread.html.erb in 1.5 ms [cache miss]
136
+ ```
290
137
 
291
- Before:
138
+ Though that full output can be reenabled with
139
+ `config.action_controller.enable_fragment_cache_logging = true`.
292
140
 
293
- # => favicon_link_tag 'myicon.ico'
294
- <link href="/assets/myicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
141
+ *Stan Lo*
295
142
 
296
- After:
143
+ * Changed partial rendering with a collection to allow collections which
144
+ implement `to_a`.
297
145
 
298
- # => favicon_link_tag 'myicon.ico'
299
- <link href="/assets/myicon.ico" rel="shortcut icon" type="image/x-icon" />
146
+ Extracting the collection option had an optimization to avoid unnecessary
147
+ queries of ActiveRecord Relations by calling `#to_ary` on the given
148
+ collection. Instances of `Enumerator` or `Enumerable` are valid
149
+ collections, but they do not implement `#to_ary`. By changing this to
150
+ `#to_a`, they will now be extracted and rendered as expected.
300
151
 
301
- *Geoffroy Lorieux*
152
+ *Steven Harman*
302
153
 
303
- * Remove wrapping div with inline styles for hidden form fields.
154
+ * New syntax for tag helpers. Avoid positional parameters and support HTML5 by default.
155
+ Example usage of tag helpers before:
304
156
 
305
- We are dropping HTML 4.01 and XHTML strict compliance since input tags directly
306
- inside a form are valid HTML5, and the absence of inline styles help in validating
307
- for Content Security Policy.
157
+ ```ruby
158
+ tag(:br, nil, true)
159
+ content_tag(:div, content_tag(:p, "Hello world!"), class: "strong")
308
160
 
309
- *Joost Baaij*
161
+ <%= content_tag :div, class: "strong" do -%>
162
+ Hello world!
163
+ <% end -%>
164
+ ```
310
165
 
311
- * `collection_check_boxes` respects `:index` option for the hidden field name.
166
+ Example usage of tag helpers after:
312
167
 
313
- Fixes #14147.
168
+ ```ruby
169
+ tag.br
170
+ tag.div tag.p("Hello world!"), class: "strong"
314
171
 
315
- *Vasiliy Ermolovich*
172
+ <%= tag.div class: "strong" do %>
173
+ Hello world!
174
+ <% end %>
175
+ ```
316
176
 
317
- * `date_select` helper with option `with_css_classes: true` does not overwrite other classes.
177
+ *Marek Kirejczyk*, *Kasper Timm Hansen*
318
178
 
319
- *Izumi Wong-Horiuchi*
179
+ * Change `datetime_field` and `datetime_field_tag` to generate `datetime-local` fields.
320
180
 
321
- * `number_to_percentage` does not crash with `Float::NAN` or `Float::INFINITY`
322
- as input.
181
+ As a new specification of the HTML 5 the text field type `datetime` will no longer exist
182
+ and it is recommended to use `datetime-local`.
183
+ Ref: https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)
323
184
 
324
- Fixes #14405.
185
+ *Herminio Torres*
325
186
 
326
- *Yves Senn*
187
+ * Raw template handler (which is also the default template handler in Rails 5) now outputs
188
+ HTML-safe strings.
327
189
 
328
- * Add `include_hidden` option to `collection_check_boxes` helper.
190
+ In Rails 5 the default template handler was changed to the raw template handler. Because
191
+ the ERB template handler escaped strings by default this broke some applications that
192
+ expected plain JS or HTML files to be rendered unescaped. This fixes the issue caused
193
+ by changing the default handler by changing the Raw template handler to output HTML-safe
194
+ strings.
329
195
 
330
- *Vasiliy Ermolovich*
196
+ *Eileen M. Uchitelle*
331
197
 
332
- * Fixed a problem where the default options for the `button_tag` helper are not
333
- applied correctly.
198
+ * `select_tag`'s `include_blank` option for generation for blank option tag, now adds an empty space label,
199
+ when the value as well as content for option tag are empty, so that we conform with html specification.
200
+ Ref: https://www.w3.org/TR/html5/forms.html#the-option-element.
334
201
 
335
- Fixes #14254.
202
+ Generation of option before:
336
203
 
337
- *Sergey Prikhodko*
204
+ ```html
205
+ <option value=""></option>
206
+ ```
338
207
 
339
- * Take variants into account when calculating template digests in ActionView::Digestor.
208
+ Generation of option after:
340
209
 
341
- The arguments to ActionView::Digestor#digest are now being passed as a hash
342
- to support variants and allow more flexibility in the future. The support for
343
- regular (required) arguments is deprecated and will be removed in Rails 5.0 or later.
210
+ ```html
211
+ <option value="" label=" "></option>
212
+ ```
344
213
 
345
- *Piotr Chmolowski, Łukasz Strzałkowski*
214
+ *Vipul A M*
346
215
 
347
- Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionview/CHANGELOG.md) for previous changes.
216
+ Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/actionview/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2014 David Heinemeier Hansson
1
+ Copyright (c) 2004-2017 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
data/README.rdoc CHANGED
@@ -9,11 +9,11 @@ used to inline short Ruby snippets inside HTML), and XML Builder.
9
9
 
10
10
  The latest version of Action View can be installed with RubyGems:
11
11
 
12
- % [sudo] gem install actionview
12
+ $ gem install actionview
13
13
 
14
14
  Source code can be downloaded as part of the Rails project on GitHub
15
15
 
16
- * https://github.com/rails/rails/tree/4-2-stable/actionview
16
+ * https://github.com/rails/rails/tree/master/actionview
17
17
 
18
18
 
19
19
  == License
@@ -36,4 +36,3 @@ Bug reports can be filed for the Ruby on Rails project here:
36
36
  Feature requests should be discussed on the rails-core mailing list here:
37
37
 
38
38
  * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
39
-
@@ -1,23 +1,23 @@
1
- require 'active_support/core_ext/module/attr_internal'
2
- require 'active_support/core_ext/module/attribute_accessors'
3
- require 'active_support/ordered_options'
4
- require 'action_view/log_subscriber'
5
- require 'action_view/helpers'
6
- require 'action_view/context'
7
- require 'action_view/template'
8
- require 'action_view/lookup_context'
1
+ require "active_support/core_ext/module/attr_internal"
2
+ require "active_support/core_ext/module/attribute_accessors"
3
+ require "active_support/ordered_options"
4
+ require "action_view/log_subscriber"
5
+ require "action_view/helpers"
6
+ require "action_view/context"
7
+ require "action_view/template"
8
+ require "action_view/lookup_context"
9
9
 
10
10
  module ActionView #:nodoc:
11
11
  # = Action View Base
12
12
  #
13
13
  # Action View templates can be written in several ways.
14
- # If the template file has a <tt>.erb</tt> extension, then it uses the erubis[https://rubygems.org/gems/erubis]
14
+ # If the template file has a <tt>.erb</tt> extension, then it uses the erubi[https://rubygems.org/gems/erubi]
15
15
  # template system which can embed Ruby into an HTML document.
16
16
  # If the template file has a <tt>.builder</tt> extension, then Jim Weirich's Builder::XmlMarkup library is used.
17
17
  #
18
18
  # == ERB
19
19
  #
20
- # You trigger ERB by using embeddings such as <% %>, <% -%>, and <%= %>. The <%= %> tag set is used when you want output. Consider the
20
+ # You trigger ERB by using embeddings such as <tt><% %></tt>, <tt><% -%></tt>, and <tt><%= %></tt>. The <tt><%= %></tt> tag set is used when you want output. Consider the
21
21
  # following loop for names:
22
22
  #
23
23
  # <b>Names of all the people</b>
@@ -25,7 +25,7 @@ module ActionView #:nodoc:
25
25
  # Name: <%= person.name %><br/>
26
26
  # <% end %>
27
27
  #
28
- # The loop is setup in regular embedding tags <% %> and the name is written using the output embedding tag <%= %>. Note that this
28
+ # The loop is setup in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
29
29
  # is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
30
30
  #
31
31
  # <%# WRONG %>
@@ -33,9 +33,9 @@ module ActionView #:nodoc:
33
33
  #
34
34
  # If you absolutely must write from within a function use +concat+.
35
35
  #
36
- # When on a line that only contains whitespaces except for the tag, <% %> suppress leading and trailing whitespace,
37
- # including the trailing newline. <% %> and <%- -%> are the same.
38
- # Note however that <%= %> and <%= -%> are different: only the latter removes trailing whitespaces.
36
+ # When on a line that only contains whitespaces except for the tag, <tt><% %></tt> suppresses leading and trailing whitespace,
37
+ # including the trailing newline. <tt><% %></tt> and <tt><%- -%></tt> are the same.
38
+ # Note however that <tt><%= %></tt> and <tt><%= -%></tt> are different: only the latter removes trailing whitespaces.
39
39
  #
40
40
  # === Using sub templates
41
41
  #
@@ -70,6 +70,14 @@ module ActionView #:nodoc:
70
70
  # Headline: <%= headline %>
71
71
  # First name: <%= person.first_name %>
72
72
  #
73
+ # The local variables passed to sub templates can be accessed as a hash using the <tt>local_assigns</tt> hash. This lets you access the
74
+ # variables as:
75
+ #
76
+ # Headline: <%= local_assigns[:headline] %>
77
+ #
78
+ # This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use
79
+ # <tt>defined? headline</tt> to first check if the variable has been assigned before using it.
80
+ #
73
81
  # === Template caching
74
82
  #
75
83
  # By default, Rails will compile each template to a method in order to render it. When you alter a template,
@@ -102,7 +110,7 @@ module ActionView #:nodoc:
102
110
  # <p>A product of Danish Design during the Winter of '79...</p>
103
111
  # </div>
104
112
  #
105
- # A full-length RSS example actually used on Basecamp:
113
+ # Here is a full-length RSS example actually used on Basecamp:
106
114
  #
107
115
  # xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
108
116
  # xml.channel do
@@ -126,14 +134,14 @@ module ActionView #:nodoc:
126
134
  # end
127
135
  # end
128
136
  #
129
- # For more information on Builder please consult the [source
130
- # code](https://github.com/jimweirich/builder).
137
+ # For more information on Builder please consult the {source
138
+ # code}[https://github.com/jimweirich/builder].
131
139
  class Base
132
140
  include Helpers, ::ERB::Util, Context
133
141
 
134
142
  # Specify the proc used to decorate input tags that refer to attributes with errors.
135
143
  cattr_accessor :field_error_proc
136
- @@field_error_proc = Proc.new{ |html_tag, instance| "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe }
144
+ @@field_error_proc = Proc.new { |html_tag, instance| "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe }
137
145
 
138
146
  # How to complete the streaming when an exception occurs.
139
147
  # This is our best guess: first try to close the attribute, then the tag.
@@ -153,11 +161,15 @@ module ActionView #:nodoc:
153
161
  cattr_accessor :raise_on_missing_translations
154
162
  @@raise_on_missing_translations = false
155
163
 
164
+ # Specify whether submit_tag should automatically disable on click
165
+ cattr_accessor :automatically_disable_submit_tag
166
+ @@automatically_disable_submit_tag = true
167
+
156
168
  class_attribute :_routes
157
169
  class_attribute :logger
158
170
 
159
171
  class << self
160
- delegate :erb_trim_mode=, :to => 'ActionView::Template::Handlers::ERB'
172
+ delegate :erb_trim_mode=, to: "ActionView::Template::Handlers::ERB"
161
173
 
162
174
  def cache_template_loading
163
175
  ActionView::Resolver.caching?
@@ -175,8 +187,8 @@ module ActionView #:nodoc:
175
187
  attr_accessor :view_renderer
176
188
  attr_internal :config, :assigns
177
189
 
178
- delegate :lookup_context, :to => :view_renderer
179
- delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, :to => :lookup_context
190
+ delegate :lookup_context, to: :view_renderer
191
+ delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, to: :lookup_context
180
192
 
181
193
  def assign(new_assigns) # :nodoc:
182
194
  @_assigns = new_assigns.each { |key, value| instance_variable_set("@#{key}", value) }
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/string/output_safety'
1
+ require "active_support/core_ext/string/output_safety"
2
2
 
3
3
  module ActionView
4
4
  class OutputBuffer < ActiveSupport::SafeBuffer #:nodoc:
@@ -28,7 +28,7 @@ module ActionView
28
28
  # returns the correct buffer on +yield+. This is usually
29
29
  # overwritten by helpers to add more behavior.
30
30
  # :api: plugin
31
- def _layout_for(name=nil)
31
+ def _layout_for(name = nil)
32
32
  name ||= :layout
33
33
  view_flow.get(name).html_safe
34
34
  end