actionview 6.1.7.2 → 7.0.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +268 -254
- data/MIT-LICENSE +1 -0
- data/README.rdoc +2 -2
- data/lib/action_view/base.rb +4 -7
- data/lib/action_view/buffers.rb +2 -2
- data/lib/action_view/cache_expiry.rb +46 -32
- data/lib/action_view/dependency_tracker/erb_tracker.rb +154 -0
- data/lib/action_view/dependency_tracker/ripper_tracker.rb +59 -0
- data/lib/action_view/dependency_tracker.rb +6 -147
- data/lib/action_view/digestor.rb +7 -4
- data/lib/action_view/flows.rb +4 -4
- data/lib/action_view/gem_version.rb +5 -5
- data/lib/action_view/helpers/active_model_helper.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +95 -39
- data/lib/action_view/helpers/asset_url_helper.rb +16 -16
- data/lib/action_view/helpers/atom_feed_helper.rb +3 -4
- data/lib/action_view/helpers/cache_helper.rb +52 -3
- data/lib/action_view/helpers/capture_helper.rb +4 -4
- data/lib/action_view/helpers/controller_helper.rb +2 -2
- data/lib/action_view/helpers/csp_helper.rb +1 -1
- data/lib/action_view/helpers/csrf_helper.rb +2 -2
- data/lib/action_view/helpers/date_helper.rb +111 -43
- data/lib/action_view/helpers/debug_helper.rb +3 -1
- data/lib/action_view/helpers/form_helper.rb +211 -85
- data/lib/action_view/helpers/form_options_helper.rb +70 -33
- data/lib/action_view/helpers/form_tag_helper.rb +150 -53
- data/lib/action_view/helpers/javascript_helper.rb +3 -5
- data/lib/action_view/helpers/number_helper.rb +17 -16
- data/lib/action_view/helpers/output_safety_helper.rb +4 -4
- data/lib/action_view/helpers/rendering_helper.rb +5 -6
- data/lib/action_view/helpers/sanitize_helper.rb +3 -3
- data/lib/action_view/helpers/tag_helper.rb +37 -8
- data/lib/action_view/helpers/tags/base.rb +5 -25
- data/lib/action_view/helpers/tags/check_box.rb +1 -1
- data/lib/action_view/helpers/tags/collection_select.rb +1 -1
- data/lib/action_view/helpers/tags/file_field.rb +16 -0
- data/lib/action_view/helpers/tags/select.rb +1 -1
- data/lib/action_view/helpers/tags/time_field.rb +10 -1
- data/lib/action_view/helpers/tags/weekday_select.rb +28 -0
- data/lib/action_view/helpers/tags.rb +3 -2
- data/lib/action_view/helpers/text_helper.rb +25 -14
- data/lib/action_view/helpers/translation_helper.rb +12 -43
- data/lib/action_view/helpers/url_helper.rb +194 -123
- data/lib/action_view/helpers.rb +25 -25
- data/lib/action_view/layouts.rb +7 -4
- data/lib/action_view/lookup_context.rb +33 -52
- data/lib/action_view/model_naming.rb +2 -2
- data/lib/action_view/path_set.rb +16 -22
- data/lib/action_view/railtie.rb +19 -7
- data/lib/action_view/record_identifier.rb +1 -1
- data/lib/action_view/render_parser.rb +188 -0
- data/lib/action_view/renderer/abstract_renderer.rb +2 -2
- data/lib/action_view/renderer/partial_renderer.rb +1 -35
- data/lib/action_view/renderer/renderer.rb +4 -4
- data/lib/action_view/renderer/streaming_template_renderer.rb +3 -3
- data/lib/action_view/renderer/template_renderer.rb +6 -2
- data/lib/action_view/rendering.rb +3 -3
- data/lib/action_view/ripper_ast_parser.rb +198 -0
- data/lib/action_view/routing_url_for.rb +8 -5
- data/lib/action_view/template/error.rb +108 -13
- data/lib/action_view/template/handlers/erb.rb +6 -0
- data/lib/action_view/template/handlers.rb +3 -3
- data/lib/action_view/template/html.rb +3 -3
- data/lib/action_view/template/inline.rb +3 -3
- data/lib/action_view/template/raw_file.rb +3 -3
- data/lib/action_view/template/resolver.rb +89 -314
- data/lib/action_view/template/text.rb +3 -3
- data/lib/action_view/template/types.rb +14 -12
- data/lib/action_view/template.rb +18 -2
- data/lib/action_view/template_details.rb +66 -0
- data/lib/action_view/template_path.rb +64 -0
- data/lib/action_view/test_case.rb +7 -3
- data/lib/action_view/testing/resolvers.rb +11 -12
- data/lib/action_view/unbound_template.rb +33 -7
- data/lib/action_view/version.rb +1 -1
- data/lib/action_view/view_paths.rb +4 -4
- data/lib/action_view.rb +2 -3
- data/lib/assets/compiled/rails-ujs.js +36 -5
- metadata +23 -16
data/CHANGELOG.md
CHANGED
@@ -1,439 +1,453 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.6 (June 29, 2023) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 7.0.5.1 (June 26, 2023) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails
|
12
|
-
|
13
|
-
* No changes.
|
14
|
-
|
15
|
-
|
16
|
-
## Rails 6.1.6.1 (July 12, 2022) ##
|
17
|
-
|
18
|
-
* No changes.
|
11
|
+
## Rails 7.0.5 (May 24, 2023) ##
|
19
12
|
|
13
|
+
* `FormBuilder#id` finds id set by `form_for` and `form_with`.
|
20
14
|
|
21
|
-
|
15
|
+
*Matt Polito*
|
22
16
|
|
23
|
-
*
|
17
|
+
* Allow all available locales for template lookups.
|
24
18
|
|
19
|
+
*Ben Dilley*
|
25
20
|
|
26
|
-
|
21
|
+
* Choices of `select` can optionally contain html attributes as the last element
|
22
|
+
of the child arrays when using grouped/nested collections
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
`:escape_attributes` to `:escape`, to simplify by applying the option to the
|
33
|
-
whole tag.
|
34
|
-
|
35
|
-
*Álvaro Martín Fraguas*
|
36
|
-
|
37
|
-
## Rails 6.1.5 (March 09, 2022) ##
|
38
|
-
|
39
|
-
* `preload_link_tag` properly inserts `as` attributes for files with `image` MIME
|
40
|
-
types, such as JPG or SVG.
|
41
|
-
|
42
|
-
*Nate Berkopec*
|
43
|
-
|
44
|
-
* Add `autocomplete="off"` to all generated hidden fields.
|
45
|
-
|
46
|
-
Fixes #42610.
|
47
|
-
|
48
|
-
*Ryan Baumann*
|
49
|
-
|
50
|
-
* Fix `current_page?` when URL has trailing slash.
|
24
|
+
```erb
|
25
|
+
<%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
|
26
|
+
# => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
|
27
|
+
```
|
51
28
|
|
52
|
-
|
53
|
-
and is an absolute URL or also has query params.
|
29
|
+
*Chris Gunther*
|
54
30
|
|
55
|
-
Fixes #33956.
|
56
31
|
|
57
|
-
|
32
|
+
## Rails 7.0.4.3 (March 13, 2023) ##
|
58
33
|
|
34
|
+
* Ignore certain data-* attributes in rails-ujs when element is contenteditable
|
59
35
|
|
60
|
-
|
36
|
+
[CVE-2023-23913]
|
61
37
|
|
62
|
-
* No changes.
|
63
38
|
|
64
|
-
|
65
|
-
## Rails 6.1.4.6 (February 11, 2022) ##
|
39
|
+
## Rails 7.0.4.2 (January 24, 2023) ##
|
66
40
|
|
67
41
|
* No changes.
|
68
42
|
|
69
43
|
|
70
|
-
## Rails
|
44
|
+
## Rails 7.0.4.1 (January 17, 2023) ##
|
71
45
|
|
72
46
|
* No changes.
|
73
47
|
|
74
48
|
|
75
|
-
## Rails
|
76
|
-
|
77
|
-
* No changes.
|
49
|
+
## Rails 7.0.4 (September 09, 2022) ##
|
78
50
|
|
51
|
+
* Guard against `ActionView::Helpers::FormTagHelper#field_name` calls with nil
|
52
|
+
`object_name` arguments. For example:
|
79
53
|
|
80
|
-
|
54
|
+
```erb
|
55
|
+
<%= fields do |f| %>
|
56
|
+
<%= f.field_name :body %>
|
57
|
+
<% end %>
|
58
|
+
```
|
81
59
|
|
82
|
-
*
|
60
|
+
*Sean Doyle*
|
83
61
|
|
62
|
+
* Strings returned from `strip_tags` are correctly tagged `html_safe?`
|
84
63
|
|
85
|
-
|
64
|
+
Because these strings contain no HTML elements and the basic entities are escaped, they are safe
|
65
|
+
to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping
|
66
|
+
entities when being concatenated to a SafeBuffer during rendering.
|
86
67
|
|
87
|
-
|
68
|
+
Fixes [rails/rails-html-sanitizer#124](https://github.com/rails/rails-html-sanitizer/issues/124)
|
88
69
|
|
70
|
+
*Mike Dalessio*
|
89
71
|
|
90
|
-
## Rails
|
72
|
+
## Rails 7.0.3.1 (July 12, 2022) ##
|
91
73
|
|
92
74
|
* No changes.
|
93
75
|
|
94
76
|
|
95
|
-
## Rails
|
96
|
-
|
97
|
-
* The `translate` helper now passes `default` values that aren't
|
98
|
-
translation keys through `I18n.translate` for interpolation.
|
77
|
+
## Rails 7.0.3 (May 09, 2022) ##
|
99
78
|
|
100
|
-
|
79
|
+
* Ensure models passed to `form_for` attempt to call `to_model`.
|
101
80
|
|
102
|
-
*
|
81
|
+
*Sean Doyle*
|
103
82
|
|
104
|
-
|
83
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
105
84
|
|
106
|
-
*
|
85
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
107
86
|
|
108
|
-
|
87
|
+
Escape dangerous characters in names of tags and names of attributes in the
|
88
|
+
tag helpers, following the XML specification. Rename the option
|
89
|
+
`:escape_attributes` to `:escape`, to simplify by applying the option to the
|
90
|
+
whole tag.
|
109
91
|
|
92
|
+
*Álvaro Martín Fraguas*
|
110
93
|
|
111
|
-
## Rails
|
94
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
112
95
|
|
113
96
|
* No changes.
|
114
97
|
|
115
98
|
|
116
|
-
## Rails
|
99
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
117
100
|
|
118
101
|
* No changes.
|
119
102
|
|
120
103
|
|
121
|
-
## Rails
|
104
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
122
105
|
|
123
106
|
* No changes.
|
124
107
|
|
125
108
|
|
126
|
-
## Rails
|
127
|
-
|
128
|
-
* No changes.
|
109
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
129
110
|
|
111
|
+
* Ensure `preload_link_tag` preloads JavaScript modules correctly.
|
130
112
|
|
131
|
-
|
113
|
+
*Máximo Mussini*
|
132
114
|
|
133
|
-
*
|
115
|
+
* Fix `stylesheet_link_tag` and similar helpers are being used to work in objects with
|
116
|
+
a `response` method.
|
134
117
|
|
118
|
+
*dark-panda*
|
135
119
|
|
136
|
-
## Rails 6.1.1 (January 07, 2021) ##
|
137
120
|
|
138
|
-
|
121
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
139
122
|
|
140
|
-
|
123
|
+
* Fix `button_to` to work with a hash parameter as URL.
|
141
124
|
|
142
|
-
*
|
125
|
+
*MingyuanQin*
|
143
126
|
|
144
|
-
|
127
|
+
* Fix `link_to` with a model passed as an argument twice.
|
145
128
|
|
146
|
-
*
|
129
|
+
*Alex Ghiculescu*
|
147
130
|
|
148
|
-
*Étienne Barrié*
|
149
|
-
|
150
|
-
* Add `config.action_view.preload_links_header` to allow disabling of
|
151
|
-
the `Link` header being added by default when using `stylesheet_link_tag`
|
152
|
-
and `javascript_include_tag`.
|
153
131
|
|
154
|
-
|
132
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
155
133
|
|
156
|
-
*
|
157
|
-
|
134
|
+
* Support `include_hidden:` option in calls to
|
135
|
+
`ActionView::Helper::FormBuilder#file_field` with `multiple: true` to
|
136
|
+
support submitting an empty collection of files.
|
158
137
|
|
159
|
-
|
138
|
+
```ruby
|
139
|
+
form.file_field :attachments, multiple: true
|
140
|
+
# => <input type="hidden" autocomplete="off" name="post[attachments][]" value="">
|
141
|
+
<input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
|
160
142
|
|
143
|
+
form.file_field :attachments, multiple: true, include_hidden: false
|
144
|
+
# => <input type="file" multiple="multiple" id="post_attachments" name="post[attachments][]">
|
145
|
+
```
|
161
146
|
|
162
|
-
|
147
|
+
*Sean Doyle*
|
163
148
|
|
164
|
-
*
|
165
|
-
call safe_list_sanitizer's class method
|
149
|
+
* Fix `number_with_precision(raise: true)` always raising even on valid numbers.
|
166
150
|
|
167
|
-
|
151
|
+
*Pedro Moreira*
|
168
152
|
|
169
|
-
*Taufiq Muhammadi*
|
170
153
|
|
171
|
-
|
154
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
172
155
|
|
173
|
-
|
174
|
-
users because they were forced to handle remote requests.
|
156
|
+
* No changes.
|
175
157
|
|
176
|
-
All new 6.1 applications will generate non-remote forms by default.
|
177
|
-
When upgrading a 6.0 application you can enable remote forms by default by
|
178
|
-
setting `config.action_view.form_with_generates_remote_forms` to `true`.
|
179
158
|
|
180
|
-
|
159
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
181
160
|
|
182
|
-
*
|
183
|
-
when a block is given.
|
161
|
+
* No changes.
|
184
162
|
|
185
|
-
|
163
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
186
164
|
|
187
|
-
*
|
188
|
-
|
165
|
+
* Support `fields model: [@nested, @model]` the same way as `form_with model:
|
166
|
+
[@nested, @model]`.
|
189
167
|
|
190
168
|
*Sean Doyle*
|
191
169
|
|
192
|
-
*
|
193
|
-
|
194
|
-
|
195
|
-
token_list("foo", "foo bar")
|
196
|
-
# => "foo bar"
|
197
|
-
|
198
|
-
*Sean Doyle*
|
170
|
+
* Infer HTTP verb `[method]` from a model or Array with model as the first
|
171
|
+
argument to `button_to` when combined with a block:
|
199
172
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
>
|
173
|
+
```ruby
|
174
|
+
button_to(Workshop.find(1)){ "Update" }
|
175
|
+
#=> <form method="post" action="/workshops/1" class="button_to">
|
176
|
+
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
177
|
+
#=> <button type="submit">Update</button>
|
178
|
+
#=> </form>
|
179
|
+
|
180
|
+
button_to([ Workshop.find(1), Session.find(1) ]) { "Update" }
|
181
|
+
#=> <form method="post" action="/workshops/1/sessions/1" class="button_to">
|
182
|
+
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
183
|
+
#=> <button type="submit">Update</button>
|
184
|
+
#=> </form>
|
185
|
+
```
|
214
186
|
|
215
187
|
*Sean Doyle*
|
216
188
|
|
217
|
-
*
|
218
|
-
|
219
|
-
*Rafael Mendonça França*
|
189
|
+
* Support passing a Symbol as the first argument to `FormBuilder#button`:
|
220
190
|
|
221
|
-
|
222
|
-
|
223
|
-
|
191
|
+
```ruby
|
192
|
+
form.button(:draft, value: true)
|
193
|
+
# => <button name="post[draft]" value="true" type="submit">Create post</button>
|
194
|
+
|
195
|
+
form.button(:draft, value: true) do
|
196
|
+
content_tag(:strong, "Save as draft")
|
197
|
+
end
|
198
|
+
# => <button name="post[draft]" value="true" type="submit">
|
199
|
+
# <strong>Save as draft</strong>
|
200
|
+
# </button>
|
201
|
+
```
|
224
202
|
|
225
|
-
*
|
203
|
+
*Sean Doyle*
|
226
204
|
|
227
|
-
|
205
|
+
* Introduce the `field_name` view helper, along with the
|
206
|
+
`FormBuilder#field_name` counterpart:
|
228
207
|
|
229
|
-
|
208
|
+
```ruby
|
209
|
+
form_for @post do |f|
|
210
|
+
f.field_tag :tag, name: f.field_name(:tag, multiple: true)
|
211
|
+
# => <input type="text" name="post[tag][]">
|
212
|
+
end
|
213
|
+
```
|
230
214
|
|
231
|
-
*
|
215
|
+
*Sean Doyle*
|
232
216
|
|
233
|
-
*
|
217
|
+
* Execute the `ActionView::Base.field_error_proc` within the context of the
|
218
|
+
`ActionView::Base` instance:
|
234
219
|
|
235
|
-
|
220
|
+
```ruby
|
221
|
+
config.action_view.field_error_proc = proc { |html| content_tag(:div, html, class: "field_with_errors") }
|
222
|
+
```
|
236
223
|
|
237
|
-
*
|
224
|
+
*Sean Doyle*
|
238
225
|
|
239
|
-
|
226
|
+
* Add support for `button_to ..., authenticity_token: false`
|
240
227
|
|
241
|
-
|
228
|
+
```ruby
|
229
|
+
button_to "Create", Post.new, authenticity_token: false
|
230
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button></form>
|
242
231
|
|
243
|
-
|
232
|
+
button_to "Create", Post.new, authenticity_token: true
|
233
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="abc123..." autocomplete="off" /></form>
|
244
234
|
|
245
|
-
|
235
|
+
button_to "Create", Post.new, authenticity_token: "secret"
|
236
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>
|
237
|
+
```
|
246
238
|
|
247
|
-
*
|
239
|
+
*Sean Doyle*
|
248
240
|
|
249
|
-
*
|
241
|
+
* Support rendering `<form>` elements _without_ `[action]` attributes by:
|
250
242
|
|
251
|
-
*
|
243
|
+
* `form_with url: false` or `form_with ..., html: { action: false }`
|
244
|
+
* `form_for ..., url: false` or `form_for ..., html: { action: false }`
|
245
|
+
* `form_tag false` or `form_tag ..., action: false`
|
246
|
+
* `button_to "...", false` or `button_to(false) { ... }`
|
252
247
|
|
253
|
-
*
|
254
|
-
in `ActionView::Base#initialize`.
|
248
|
+
*Sean Doyle*
|
255
249
|
|
256
|
-
|
250
|
+
* Add `:day_format` option to `date_select`
|
257
251
|
|
258
|
-
|
252
|
+
date_select("article", "written_on", day_format: ->(day) { day.ordinalize })
|
253
|
+
# generates day options like <option value="1">1st</option>\n<option value="2">2nd</option>...
|
259
254
|
|
260
|
-
*
|
255
|
+
*Shunichi Ikegami*
|
261
256
|
|
262
|
-
*
|
257
|
+
* Allow `link_to` helper to infer link name from `Model#to_s` when it
|
258
|
+
is used with a single argument:
|
263
259
|
|
264
|
-
|
260
|
+
link_to @profile
|
261
|
+
#=> <a href="/profiles/1">Eileen</a>
|
265
262
|
|
266
|
-
|
263
|
+
This assumes the model class implements a `to_s` method like this:
|
267
264
|
|
268
|
-
|
265
|
+
class Profile < ApplicationRecord
|
266
|
+
# ...
|
267
|
+
def to_s
|
268
|
+
name
|
269
|
+
end
|
270
|
+
end
|
269
271
|
|
270
|
-
|
272
|
+
Previously you had to supply a second argument even if the `Profile`
|
273
|
+
model implemented a `#to_s` method that called the `name` method.
|
271
274
|
|
272
|
-
|
275
|
+
link_to @profile, @profile.name
|
276
|
+
#=> <a href="/profiles/1">Eileen</a>
|
273
277
|
|
274
|
-
*
|
278
|
+
*Olivier Lacan*
|
275
279
|
|
276
|
-
|
280
|
+
* Support svg unpaired tags for `tag` helper.
|
277
281
|
|
278
|
-
|
282
|
+
tag.svg { tag.use('href' => "#cool-icon") }
|
283
|
+
# => <svg><use href="#cool-icon"></svg>
|
279
284
|
|
280
|
-
*
|
285
|
+
*Oleksii Vasyliev*
|
281
286
|
|
282
|
-
* Remove deprecated `ActionView::Template#updated_at`.
|
283
287
|
|
284
|
-
|
288
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
285
289
|
|
286
|
-
*
|
290
|
+
* No changes.
|
287
291
|
|
288
|
-
*Rafael Mendonça França*
|
289
292
|
|
290
|
-
|
293
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
291
294
|
|
292
|
-
|
295
|
+
* Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
|
296
|
+
exceptions as flow control.
|
293
297
|
|
294
|
-
*
|
298
|
+
*Mike Dalessio*
|
295
299
|
|
296
|
-
|
300
|
+
* `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
|
297
301
|
|
298
|
-
*
|
302
|
+
*Nate Berkopec*
|
299
303
|
|
300
|
-
|
304
|
+
* Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
|
301
305
|
|
302
|
-
*
|
306
|
+
*Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
|
303
307
|
|
304
|
-
|
308
|
+
* Add `caching?` helper that returns whether the current code path is being cached and `uncacheable!` to denote helper methods that can't participate in fragment caching.
|
305
309
|
|
306
|
-
*
|
310
|
+
*Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
|
307
311
|
|
308
|
-
|
312
|
+
* Add `include_seconds` option for `time_field`.
|
309
313
|
|
310
|
-
|
314
|
+
<%= form.time_field :foo, include_seconds: false %>
|
315
|
+
# => <input value="16:22" type="time" />
|
311
316
|
|
312
|
-
|
317
|
+
Default includes seconds:
|
313
318
|
|
314
|
-
|
319
|
+
<%= form.time_field :foo %>
|
320
|
+
# => <input value="16:22:01.440" type="time" />
|
315
321
|
|
316
|
-
|
322
|
+
This allows you to take advantage of [different rendering options](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#time_value_format) in some browsers.
|
317
323
|
|
318
|
-
*
|
324
|
+
*Alex Ghiculescu*
|
319
325
|
|
320
|
-
|
326
|
+
* Improve error messages when template file does not exist at absolute filepath.
|
321
327
|
|
322
|
-
*
|
328
|
+
*Ted Whang*
|
323
329
|
|
324
|
-
|
330
|
+
* Add `:country_code` option to `sms_to` for consistency with `phone_to`.
|
325
331
|
|
326
|
-
*
|
327
|
-
the translated text and the fully resolved translation key:
|
332
|
+
*Jonathan Hefner*
|
328
333
|
|
329
|
-
|
330
|
-
<span title="<%= resolved_key %>"><%= translation %></span>
|
331
|
-
<% end %>
|
334
|
+
* OpenSSL constants are now used for Digest computations.
|
332
335
|
|
333
|
-
*
|
336
|
+
*Dirkjan Bussink*
|
334
337
|
|
335
|
-
*
|
336
|
-
|
337
|
-
virtual_path keyword arguments found in CacheHelper as they no longer possess
|
338
|
-
any function following 1581cab.
|
338
|
+
* The `translate` helper now passes `default` values that aren't
|
339
|
+
translation keys through `I18n.translate` for interpolation.
|
339
340
|
|
340
|
-
|
341
|
+
*Jonathan Hefner*
|
341
342
|
|
342
|
-
|
343
|
+
* Adds option `extname` to `stylesheet_link_tag` to skip default
|
344
|
+
`.css` extension appended to the stylesheet path.
|
343
345
|
|
344
|
-
|
345
|
-
`config.i18n.raise_on_missing_translations`.
|
346
|
+
Before:
|
346
347
|
|
347
|
-
|
348
|
-
|
348
|
+
```ruby
|
349
|
+
stylesheet_link_tag "style.less"
|
350
|
+
# <link href="/stylesheets/style.less.scss" rel="stylesheet">
|
351
|
+
```
|
349
352
|
|
350
|
-
|
353
|
+
After:
|
351
354
|
|
352
|
-
|
353
|
-
|
355
|
+
```ruby
|
356
|
+
stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less"
|
357
|
+
# <link href="/stylesheets/style.less" rel="stylesheet/less">
|
358
|
+
```
|
354
359
|
|
355
|
-
*
|
360
|
+
*Abhay Nikam*
|
356
361
|
|
357
|
-
* `
|
362
|
+
* Deprecate `render` locals to be assigned to instance variables.
|
358
363
|
|
359
|
-
*
|
364
|
+
*Petrik de Heus*
|
360
365
|
|
361
|
-
* `
|
362
|
-
passed `default: nil` without a translation matching `I18n#translate`.
|
366
|
+
* Remove legacy default `media=screen` from `stylesheet_link_tag`.
|
363
367
|
|
364
|
-
*
|
368
|
+
*André Luis Leal Cardoso Junior*
|
365
369
|
|
366
|
-
* `
|
367
|
-
|
370
|
+
* Change `ActionView::Helpers::FormBuilder#button` to transform `formmethod`
|
371
|
+
attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
|
368
372
|
|
369
|
-
|
373
|
+
<%= form_with model: post, method: :put do %>
|
374
|
+
<%= form.button "Update" %>
|
375
|
+
<%= form.button "Delete", formmethod: :delete %>
|
376
|
+
<% end %>
|
377
|
+
<%# => <form action="posts/1">
|
378
|
+
=> <input type="hidden" name="_method" value="put">
|
379
|
+
=> <button type="submit">Update</button>
|
380
|
+
=> <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
|
381
|
+
=> </form>
|
382
|
+
%>
|
370
383
|
|
371
|
-
*
|
384
|
+
*Sean Doyle*
|
372
385
|
|
373
|
-
|
386
|
+
* Change `ActionView::Helpers::UrlHelper#button_to` to *always* render a
|
387
|
+
`<button>` element, regardless of whether or not the content is passed as
|
388
|
+
the first argument or as a block.
|
374
389
|
|
375
|
-
|
390
|
+
<%= button_to "Delete", post_path(@post), method: :delete %>
|
391
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
376
392
|
|
377
|
-
|
393
|
+
<%= button_to post_path(@post), method: :delete do %>
|
394
|
+
Delete
|
395
|
+
<% end %>
|
396
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
378
397
|
|
379
|
-
*
|
398
|
+
*Sean Doyle*, *Dusan Orlovic*
|
380
399
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
# Before
|
386
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
387
|
-
# =>
|
388
|
-
# <select name="post[category]" id="post_category">
|
389
|
-
# <option value="">none</option>
|
390
|
-
# <option value="1">programming</option>
|
391
|
-
# <option value="2">economics</option>
|
392
|
-
# </select>
|
393
|
-
|
394
|
-
# After
|
395
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
396
|
-
# =>
|
397
|
-
# <select name="post[category]" id="post_category">
|
398
|
-
# <option selected="selected" value="">none</option>
|
399
|
-
# <option value="1">programming</option>
|
400
|
-
# <option value="2">economics</option>
|
401
|
-
# </select>
|
402
|
-
```
|
400
|
+
* Add `config.action_view.preload_links_header` to allow disabling of
|
401
|
+
the `Link` header being added by default when using `stylesheet_link_tag`
|
402
|
+
and `javascript_include_tag`.
|
403
403
|
|
404
|
-
*
|
404
|
+
*Andrew White*
|
405
405
|
|
406
|
-
*
|
407
|
-
|
406
|
+
* The `translate` helper now resolves `default` values when a `nil` key is
|
407
|
+
specified, instead of always returning `nil`.
|
408
408
|
|
409
|
-
|
409
|
+
*Jonathan Hefner*
|
410
410
|
|
411
|
-
|
411
|
+
* Add `config.action_view.image_loading` to configure the default value of
|
412
|
+
the `image_tag` `:loading` option.
|
412
413
|
|
413
|
-
|
414
|
+
By setting `config.action_view.image_loading = "lazy"`, an application can opt in to
|
415
|
+
lazy loading images sitewide, without changing view code.
|
414
416
|
|
415
|
-
*
|
417
|
+
*Jonathan Hefner*
|
416
418
|
|
417
|
-
*
|
419
|
+
* `ActionView::Helpers::FormBuilder#id` returns the value
|
420
|
+
of the `<form>` element's `id` attribute. With a `method` argument, returns
|
421
|
+
the `id` attribute for a form field with that name.
|
418
422
|
|
419
|
-
|
423
|
+
<%= form_for @post do |f| %>
|
424
|
+
<%# ... %>
|
420
425
|
|
421
|
-
|
422
|
-
|
426
|
+
<% content_for :sticky_footer do %>
|
427
|
+
<%= form.button(form: f.id) %>
|
428
|
+
<% end %>
|
429
|
+
<% end %>
|
423
430
|
|
424
|
-
*
|
431
|
+
*Sean Doyle*
|
425
432
|
|
426
|
-
*
|
433
|
+
* `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
|
434
|
+
the FormBuilder for the given attribute name.
|
427
435
|
|
428
|
-
|
436
|
+
<%= form_for @post do |f| %>
|
437
|
+
<%= f.label :title %>
|
438
|
+
<%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
|
439
|
+
<%= tag.span("is blank", id: f.field_id(:title, :error) %>
|
440
|
+
<% end %>
|
429
441
|
|
430
|
-
*
|
442
|
+
*Sean Doyle*
|
431
443
|
|
432
|
-
|
444
|
+
* Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
|
445
|
+
interpolated into ERB.
|
433
446
|
|
434
|
-
|
447
|
+
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
|
448
|
+
# => <input type="text" aria-label="Search">
|
435
449
|
|
436
|
-
*
|
450
|
+
*Sean Doyle*
|
437
451
|
|
438
452
|
|
439
|
-
Please check [6-
|
453
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
|