actionview 6.1.4.1 → 7.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionview might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +189 -248
- data/MIT-LICENSE +1 -1
- 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 +4 -4
- data/lib/action_view/helpers/active_model_helper.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +84 -29
- data/lib/action_view/helpers/asset_url_helper.rb +9 -9
- 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 +2 -2
- 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 +1 -1
- data/lib/action_view/helpers/date_helper.rb +62 -7
- data/lib/action_view/helpers/debug_helper.rb +3 -1
- data/lib/action_view/helpers/form_helper.rb +190 -75
- data/lib/action_view/helpers/form_options_helper.rb +68 -33
- data/lib/action_view/helpers/form_tag_helper.rb +126 -36
- data/lib/action_view/helpers/javascript_helper.rb +3 -5
- data/lib/action_view/helpers/number_helper.rb +3 -4
- data/lib/action_view/helpers/output_safety_helper.rb +2 -2
- data/lib/action_view/helpers/rendering_helper.rb +1 -1
- data/lib/action_view/helpers/sanitize_helper.rb +2 -2
- data/lib/action_view/helpers/tag_helper.rb +34 -6
- data/lib/action_view/helpers/tags/base.rb +4 -24
- data/lib/action_view/helpers/tags/check_box.rb +2 -2
- data/lib/action_view/helpers/tags/collection_select.rb +1 -1
- data/lib/action_view/helpers/tags/hidden_field.rb +4 -0
- 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 +24 -13
- data/lib/action_view/helpers/translation_helper.rb +10 -41
- data/lib/action_view/helpers/url_helper.rb +166 -91
- data/lib/action_view/helpers.rb +25 -25
- 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/render_parser.rb +188 -0
- data/lib/action_view/renderer/abstract_renderer.rb +2 -2
- data/lib/action_view/renderer/partial_renderer.rb +0 -34
- 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 +2 -2
- data/lib/action_view/ripper_ast_parser.rb +198 -0
- data/lib/action_view/routing_url_for.rb +1 -1
- 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 +84 -311
- 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 +6 -2
- data/lib/action_view/testing/resolvers.rb +11 -12
- data/lib/action_view/unbound_template.rb +33 -7
- data/lib/action_view.rb +3 -4
- metadata +22 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43ef7e336d2b713888ba6c8ec4fa99d7742d806a87c49aa2d64f2c4303bc36dd
|
4
|
+
data.tar.gz: 81b1bd84cd06b3aa95d71cfab5522119e8640f7d7dfaf2cacb1a8dcda21d85fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbd89103bd38491e54f37319d58e3678a2416bd388a0560aad6557b1b5bce4e561101260e851ff431a40980ef525ef7d9a29f95dc4af36f7c5ae5c44b93f36f3
|
7
|
+
data.tar.gz: fae5114b62a936872a121c6d505aa95950949e01b6a29254fd1e289fc3a58a3a18e50f3aa2b386a25b513e9efb9c8fc2ab5166d0c240036ed019055517089bff
|
data/CHANGELOG.md
CHANGED
@@ -1,350 +1,291 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
## Rails 6.1.4 (June 24, 2021) ##
|
7
|
-
|
8
|
-
* The `translate` helper now passes `default` values that aren't
|
9
|
-
translation keys through `I18n.translate` for interpolation.
|
10
|
-
|
11
|
-
*Jonathan Hefner*
|
12
|
-
|
13
|
-
* Don't attach UJS form submission handlers to Turbo forms.
|
14
|
-
|
15
|
-
*David Heinemeier Hansson*
|
16
|
-
|
17
|
-
* Allow both `current_page?(url_hash)` and `current_page?(**url_hash)` on Ruby 2.7.
|
18
|
-
|
19
|
-
*Ryuta Kamizono*
|
20
|
-
|
21
|
-
|
22
|
-
## Rails 6.1.3.2 (May 05, 2021) ##
|
23
|
-
|
24
|
-
* No changes.
|
25
|
-
|
26
|
-
|
27
|
-
## Rails 6.1.3.1 (March 26, 2021) ##
|
28
|
-
|
29
|
-
* No changes.
|
30
|
-
|
31
|
-
|
32
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
33
|
-
|
34
|
-
* No changes.
|
35
|
-
|
36
|
-
|
37
|
-
## Rails 6.1.2.1 (February 10, 2021) ##
|
38
|
-
|
39
|
-
* No changes.
|
3
|
+
* Support `fields model: [@nested, @model]` the same way as `form_with model:
|
4
|
+
[@nested, @model]`.
|
40
5
|
|
6
|
+
*Sean Doyle*
|
41
7
|
|
42
|
-
|
43
|
-
|
44
|
-
* No changes.
|
45
|
-
|
46
|
-
|
47
|
-
## Rails 6.1.1 (January 07, 2021) ##
|
48
|
-
|
49
|
-
* Fix lazy translation in partial with block.
|
50
|
-
|
51
|
-
*Marek Kasztelnik*
|
52
|
-
|
53
|
-
* Avoid extra `SELECT COUNT` queries when rendering Active Record collections.
|
54
|
-
|
55
|
-
*aar0nr*
|
56
|
-
|
57
|
-
* Link preloading keep integrity hashes in the header.
|
58
|
-
|
59
|
-
*Étienne Barrié*
|
60
|
-
|
61
|
-
* Add `config.action_view.preload_links_header` to allow disabling of
|
62
|
-
the `Link` header being added by default when using `stylesheet_link_tag`
|
63
|
-
and `javascript_include_tag`.
|
64
|
-
|
65
|
-
*Andrew White*
|
66
|
-
|
67
|
-
* The `translate` helper now resolves `default` values when a `nil` key is
|
68
|
-
specified, instead of always returning `nil`.
|
69
|
-
|
70
|
-
*Jonathan Hefner*
|
71
|
-
|
72
|
-
|
73
|
-
## Rails 6.1.0 (December 09, 2020) ##
|
74
|
-
|
75
|
-
* SanitizeHelper.sanitized_allowed_attributes and SanitizeHelper.sanitized_allowed_tags
|
76
|
-
call safe_list_sanitizer's class method
|
8
|
+
* Infer HTTP verb `[method]` from a model or Array with model as the first
|
9
|
+
argument to `button_to` when combined with a block:
|
77
10
|
|
78
|
-
|
11
|
+
```ruby
|
12
|
+
button_to(Workshop.find(1)){ "Update" }
|
13
|
+
#=> <form method="post" action="/workshops/1" class="button_to">
|
14
|
+
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
15
|
+
#=> <button type="submit">Update</button>
|
16
|
+
#=> </form>
|
17
|
+
|
18
|
+
button_to([ Workshop.find(1), Session.find(1) ]) { "Update" }
|
19
|
+
#=> <form method="post" action="/workshops/1/sessions/1" class="button_to">
|
20
|
+
#=> <input type="hidden" name="_method" value="patch" autocomplete="off" />
|
21
|
+
#=> <button type="submit">Update</button>
|
22
|
+
#=> </form>
|
23
|
+
```
|
79
24
|
|
80
|
-
*
|
25
|
+
*Sean Doyle*
|
81
26
|
|
82
|
-
*
|
27
|
+
* Support passing a Symbol as the first argument to `FormBuilder#button`:
|
83
28
|
|
84
|
-
|
85
|
-
|
29
|
+
```ruby
|
30
|
+
form.button(:draft, value: true)
|
31
|
+
# => <button name="post[draft]" value="true" type="submit">Create post</button>
|
32
|
+
|
33
|
+
form.button(:draft, value: true) do
|
34
|
+
content_tag(:strong, "Save as draft")
|
35
|
+
end
|
36
|
+
# => <button name="post[draft]" value="true" type="submit">
|
37
|
+
# <strong>Save as draft</strong>
|
38
|
+
# </button>
|
39
|
+
```
|
86
40
|
|
87
|
-
|
88
|
-
When upgrading a 6.0 application you can enable remote forms by default by
|
89
|
-
setting `config.action_view.form_with_generates_remote_forms` to `true`.
|
41
|
+
*Sean Doyle*
|
90
42
|
|
91
|
-
|
43
|
+
* Introduce the `field_name` view helper, along with the
|
44
|
+
`FormBuilder#field_name` counterpart:
|
92
45
|
|
93
|
-
|
94
|
-
|
46
|
+
```ruby
|
47
|
+
form_for @post do |f|
|
48
|
+
f.field_tag :tag, name: f.field_name(:tag, multiple: true)
|
49
|
+
# => <input type="text" name="post[tag][]">
|
50
|
+
end
|
51
|
+
```
|
95
52
|
|
96
53
|
*Sean Doyle*
|
97
54
|
|
98
|
-
*
|
99
|
-
|
55
|
+
* Execute the `ActionView::Base.field_error_proc` within the context of the
|
56
|
+
`ActionView::Base` instance:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
config.action_view.field_error_proc = proc { |html| content_tag(:div, html, class: "field_with_errors") }
|
60
|
+
```
|
100
61
|
|
101
62
|
*Sean Doyle*
|
102
63
|
|
103
|
-
*
|
104
|
-
and make the original available as an alias.
|
64
|
+
* Add support for `button_to ..., authenticity_token: false`
|
105
65
|
|
106
|
-
|
107
|
-
|
66
|
+
```ruby
|
67
|
+
button_to "Create", Post.new, authenticity_token: false
|
68
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button></form>
|
108
69
|
|
109
|
-
|
70
|
+
button_to "Create", Post.new, authenticity_token: true
|
71
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="abc123..." autocomplete="off" /></form>
|
110
72
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
tag.input type: 'checkbox', name: 'published', aria: {
|
116
|
-
invalid: @post.errors[:published].any?,
|
117
|
-
labelledby: ['published_context', 'published_label'],
|
118
|
-
describedby: { published_errors: @post.errors[:published].any? }
|
119
|
-
}
|
120
|
-
#=> <input
|
121
|
-
type="checkbox" name="published" aria-invalid="true"
|
122
|
-
aria-labelledby="published_context published_label"
|
123
|
-
aria-describedby="published_errors"
|
124
|
-
>
|
73
|
+
button_to "Create", Post.new, authenticity_token: "secret"
|
74
|
+
# => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>
|
75
|
+
```
|
125
76
|
|
126
77
|
*Sean Doyle*
|
127
78
|
|
128
|
-
*
|
129
|
-
|
130
|
-
*Rafael Mendonça França*
|
79
|
+
* Support rendering `<form>` elements _without_ `[action]` attributes by:
|
131
80
|
|
132
|
-
*
|
81
|
+
* `form_with url: false` or `form_with ..., html: { action: false }`
|
82
|
+
* `form_for ..., url: false` or `form_for ..., html: { action: false }`
|
83
|
+
* `form_tag false` or `form_tag ..., action: false`
|
84
|
+
* `button_to "...", false` or `button_to(false) { ... }`
|
133
85
|
|
134
|
-
*
|
86
|
+
*Sean Doyle*
|
135
87
|
|
136
|
-
*
|
88
|
+
* Add `:day_format` option to `date_select`
|
137
89
|
|
138
|
-
|
90
|
+
date_select("article", "written_on", day_format: ->(day) { day.ordinalize })
|
91
|
+
# generates day options like <option value="1">1st</option>\n<option value="2">2nd</option>...
|
139
92
|
|
140
|
-
*
|
93
|
+
*Shunichi Ikegami*
|
141
94
|
|
142
|
-
|
95
|
+
* Allow `link_to` helper to infer link name from `Model#to_s` when it
|
96
|
+
is used with a single argument:
|
143
97
|
|
144
|
-
|
98
|
+
link_to @profile
|
99
|
+
#=> <a href="/profiles/1">Eileen</a>
|
145
100
|
|
146
|
-
|
101
|
+
This assumes the model class implements a `to_s` method like this:
|
147
102
|
|
148
|
-
|
103
|
+
class Profile < ApplicationRecord
|
104
|
+
# ...
|
105
|
+
def to_s
|
106
|
+
name
|
107
|
+
end
|
108
|
+
end
|
149
109
|
|
150
|
-
|
110
|
+
Previously you had to supply a second argument even if the `Profile`
|
111
|
+
model implemented a `#to_s` method that called the `name` method.
|
151
112
|
|
152
|
-
|
113
|
+
link_to @profile, @profile.name
|
114
|
+
#=> <a href="/profiles/1">Eileen</a>
|
153
115
|
|
154
|
-
*
|
116
|
+
*Olivier Lacan*
|
155
117
|
|
156
|
-
*
|
118
|
+
* Support svg unpaired tags for `tag` helper.
|
157
119
|
|
158
|
-
|
120
|
+
tag.svg { tag.use('href' => "#cool-icon") }
|
121
|
+
# => <svg><use href="#cool-icon"></svg>
|
159
122
|
|
160
|
-
*
|
123
|
+
*Oleksii Vasyliev*
|
161
124
|
|
162
|
-
*Rafael Mendonça França*
|
163
125
|
|
164
|
-
|
165
|
-
in `ActionView::Base#initialize`.
|
126
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
166
127
|
|
167
|
-
|
128
|
+
* No changes.
|
168
129
|
|
169
|
-
* Remove deprecated `format` argument `ActionView::Base#initialize`.
|
170
130
|
|
171
|
-
|
131
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
172
132
|
|
173
|
-
*
|
133
|
+
* Improves the performance of ActionView::Helpers::NumberHelper formatters by avoiding the use of
|
134
|
+
exceptions as flow control.
|
174
135
|
|
175
|
-
*
|
136
|
+
*Mike Dalessio*
|
176
137
|
|
177
|
-
*
|
138
|
+
* `preload_link_tag` properly inserts `as` attributes for files with `image` MIME types, such as JPG or SVG.
|
178
139
|
|
179
|
-
*
|
140
|
+
*Nate Berkopec*
|
180
141
|
|
181
|
-
*
|
142
|
+
* Add `weekday_options_for_select` and `weekday_select` helper methods. Also adds `weekday_select` to `FormBuilder`.
|
182
143
|
|
183
|
-
*
|
144
|
+
*Drew Bragg*, *Dana Kashubeck*, *Kasper Timm Hansen*
|
184
145
|
|
185
|
-
*
|
146
|
+
* 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.
|
186
147
|
|
187
|
-
*
|
148
|
+
*Ben Toews*, *John Hawthorn*, *Kasper Timm Hansen*, *Joel Hawksley*
|
188
149
|
|
189
|
-
*
|
150
|
+
* Add `include_seconds` option for `time_field`.
|
190
151
|
|
191
|
-
|
152
|
+
<%= form.time_field :foo, include_seconds: false %>
|
153
|
+
# => <input value="16:22" type="time" />
|
192
154
|
|
193
|
-
|
155
|
+
Default includes seconds:
|
194
156
|
|
195
|
-
|
157
|
+
<%= form.time_field :foo %>
|
158
|
+
# => <input value="16:22:01.440" type="time" />
|
196
159
|
|
197
|
-
|
160
|
+
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.
|
198
161
|
|
199
|
-
*
|
162
|
+
*Alex Ghiculescu*
|
200
163
|
|
201
|
-
*
|
164
|
+
* Improve error messages when template file does not exist at absolute filepath.
|
202
165
|
|
203
|
-
*
|
166
|
+
*Ted Whang*
|
204
167
|
|
205
|
-
*
|
168
|
+
* Add `:country_code` option to `sms_to` for consistency with `phone_to`.
|
206
169
|
|
207
|
-
*
|
170
|
+
*Jonathan Hefner*
|
208
171
|
|
209
|
-
*
|
172
|
+
* OpenSSL constants are now used for Digest computations.
|
210
173
|
|
211
|
-
*
|
174
|
+
*Dirkjan Bussink*
|
212
175
|
|
213
|
-
*
|
176
|
+
* The `translate` helper now passes `default` values that aren't
|
177
|
+
translation keys through `I18n.translate` for interpolation.
|
214
178
|
|
215
|
-
*
|
179
|
+
*Jonathan Hefner*
|
216
180
|
|
217
|
-
*
|
181
|
+
* Adds option `extname` to `stylesheet_link_tag` to skip default
|
182
|
+
`.css` extension appended to the stylesheet path.
|
218
183
|
|
219
|
-
|
184
|
+
Before:
|
220
185
|
|
221
|
-
|
186
|
+
```ruby
|
187
|
+
stylesheet_link_tag "style.less"
|
188
|
+
# <link href="/stylesheets/style.less.scss" rel="stylesheet">
|
189
|
+
```
|
222
190
|
|
223
|
-
|
191
|
+
After:
|
224
192
|
|
225
|
-
|
193
|
+
```ruby
|
194
|
+
stylesheet_link_tag "style.less", extname: false, skip_pipeline: true, rel: "stylesheet/less"
|
195
|
+
# <link href="/stylesheets/style.less" rel="stylesheet/less">
|
196
|
+
```
|
226
197
|
|
227
|
-
*
|
198
|
+
*Abhay Nikam*
|
228
199
|
|
229
|
-
*
|
200
|
+
* Deprecate `render` locals to be assigned to instance variables.
|
230
201
|
|
231
|
-
*
|
202
|
+
*Petrik de Heus*
|
232
203
|
|
233
|
-
* Remove
|
204
|
+
* Remove legacy default `media=screen` from `stylesheet_link_tag`.
|
234
205
|
|
235
|
-
*
|
206
|
+
*André Luis Leal Cardoso Junior*
|
236
207
|
|
237
|
-
* `ActionView::Helpers::
|
238
|
-
|
208
|
+
* Change `ActionView::Helpers::FormBuilder#button` to transform `formmethod`
|
209
|
+
attributes into `_method="$VERB"` Form Data to enable varied same-form actions:
|
239
210
|
|
240
|
-
<%=
|
241
|
-
|
211
|
+
<%= form_with model: post, method: :put do %>
|
212
|
+
<%= form.button "Update" %>
|
213
|
+
<%= form.button "Delete", formmethod: :delete %>
|
242
214
|
<% end %>
|
215
|
+
<%# => <form action="posts/1">
|
216
|
+
=> <input type="hidden" name="_method" value="put">
|
217
|
+
=> <button type="submit">Update</button>
|
218
|
+
=> <button type="submit" formmethod="post" name="_method" value="delete">Delete</button>
|
219
|
+
=> </form>
|
220
|
+
%>
|
243
221
|
|
244
222
|
*Sean Doyle*
|
245
223
|
|
246
|
-
*
|
247
|
-
|
248
|
-
|
249
|
-
any function following 1581cab.
|
250
|
-
|
251
|
-
Fixes #38984.
|
252
|
-
|
253
|
-
*Aaron Lipman*
|
254
|
-
|
255
|
-
* Deprecate `config.action_view.raise_on_missing_translations` in favor of
|
256
|
-
`config.i18n.raise_on_missing_translations`.
|
257
|
-
|
258
|
-
New generalized configuration option now determines whether an error should be raised
|
259
|
-
for missing translations in controllers and views.
|
224
|
+
* Change `ActionView::Helpers::UrlHelper#button_to` to *always* render a
|
225
|
+
`<button>` element, regardless of whether or not the content is passed as
|
226
|
+
the first argument or as a block.
|
260
227
|
|
261
|
-
|
228
|
+
<%= button_to "Delete", post_path(@post), method: :delete %>
|
229
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
262
230
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
* `ActionView::Base.annotate_rendered_view_with_filenames` annotates HTML output with template file names.
|
269
|
-
|
270
|
-
*Joel Hawksley*, *Aaron Patterson*
|
271
|
-
|
272
|
-
* `ActionView::Helpers::TranslationHelper#translate` returns nil when
|
273
|
-
passed `default: nil` without a translation matching `I18n#translate`.
|
274
|
-
|
275
|
-
*Stefan Wrobel*
|
276
|
-
|
277
|
-
* `OptimizedFileSystemResolver` prefers template details in order of locale,
|
278
|
-
formats, variants, handlers.
|
279
|
-
|
280
|
-
*Iago Pimenta*
|
281
|
-
|
282
|
-
* Added `class_names` helper to create a CSS class value with conditional classes.
|
283
|
-
|
284
|
-
*Joel Hawksley*, *Aaron Patterson*
|
285
|
-
|
286
|
-
* Add support for conditional values to TagBuilder.
|
287
|
-
|
288
|
-
*Joel Hawksley*
|
231
|
+
<%= button_to post_path(@post), method: :delete do %>
|
232
|
+
Delete
|
233
|
+
<% end %>
|
234
|
+
# => <form action="/posts/1"><input type="hidden" name="_method" value="delete"><button type="submit">Delete</button></form>
|
289
235
|
|
290
|
-
*
|
236
|
+
*Sean Doyle*, *Dusan Orlovic*
|
291
237
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
# Before
|
297
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
298
|
-
# =>
|
299
|
-
# <select name="post[category]" id="post_category">
|
300
|
-
# <option value="">none</option>
|
301
|
-
# <option value="1">programming</option>
|
302
|
-
# <option value="2">economics</option>
|
303
|
-
# </select>
|
304
|
-
|
305
|
-
# After
|
306
|
-
select("post", "category", none: nil, programming: 1, economics: 2)
|
307
|
-
# =>
|
308
|
-
# <select name="post[category]" id="post_category">
|
309
|
-
# <option selected="selected" value="">none</option>
|
310
|
-
# <option value="1">programming</option>
|
311
|
-
# <option value="2">economics</option>
|
312
|
-
# </select>
|
313
|
-
```
|
238
|
+
* Add `config.action_view.preload_links_header` to allow disabling of
|
239
|
+
the `Link` header being added by default when using `stylesheet_link_tag`
|
240
|
+
and `javascript_include_tag`.
|
314
241
|
|
315
|
-
*
|
242
|
+
*Andrew White*
|
316
243
|
|
317
|
-
*
|
318
|
-
|
244
|
+
* The `translate` helper now resolves `default` values when a `nil` key is
|
245
|
+
specified, instead of always returning `nil`.
|
319
246
|
|
320
|
-
|
247
|
+
*Jonathan Hefner*
|
321
248
|
|
322
|
-
|
249
|
+
* Add `config.action_view.image_loading` to configure the default value of
|
250
|
+
the `image_tag` `:loading` option.
|
323
251
|
|
324
|
-
|
252
|
+
By setting `config.action_view.image_loading = "lazy"`, an application can opt in to
|
253
|
+
lazy loading images sitewide, without changing view code.
|
325
254
|
|
326
|
-
*
|
255
|
+
*Jonathan Hefner*
|
327
256
|
|
328
|
-
*
|
257
|
+
* `ActionView::Helpers::FormBuilder#id` returns the value
|
258
|
+
of the `<form>` element's `id` attribute. With a `method` argument, returns
|
259
|
+
the `id` attribute for a form field with that name.
|
329
260
|
|
330
|
-
|
261
|
+
<%= form_for @post do |f| %>
|
262
|
+
<%# ... %>
|
331
263
|
|
332
|
-
|
333
|
-
|
264
|
+
<% content_for :sticky_footer do %>
|
265
|
+
<%= form.button(form: f.id) %>
|
266
|
+
<% end %>
|
267
|
+
<% end %>
|
334
268
|
|
335
|
-
*
|
269
|
+
*Sean Doyle*
|
336
270
|
|
337
|
-
*
|
271
|
+
* `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
|
272
|
+
the FormBuilder for the given attribute name.
|
338
273
|
|
339
|
-
|
274
|
+
<%= form_for @post do |f| %>
|
275
|
+
<%= f.label :title %>
|
276
|
+
<%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
|
277
|
+
<%= tag.span("is blank", id: f.field_id(:title, :error) %>
|
278
|
+
<% end %>
|
340
279
|
|
341
|
-
*
|
280
|
+
*Sean Doyle*
|
342
281
|
|
343
|
-
|
282
|
+
* Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
|
283
|
+
interpolated into ERB.
|
344
284
|
|
345
|
-
|
285
|
+
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
|
286
|
+
# => <input type="text" aria-label="Search">
|
346
287
|
|
347
|
-
*
|
288
|
+
*Sean Doyle*
|
348
289
|
|
349
290
|
|
350
|
-
Please check [6-
|
291
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/lib/action_view/base.rb
CHANGED
@@ -9,7 +9,7 @@ require "action_view/context"
|
|
9
9
|
require "action_view/template"
|
10
10
|
require "action_view/lookup_context"
|
11
11
|
|
12
|
-
module ActionView
|
12
|
+
module ActionView # :nodoc:
|
13
13
|
# = Action View Base
|
14
14
|
#
|
15
15
|
# Action View templates can be written in several ways.
|
@@ -142,7 +142,7 @@ module ActionView #:nodoc:
|
|
142
142
|
include Helpers, ::ERB::Util, Context
|
143
143
|
|
144
144
|
# Specify the proc used to decorate input tags that refer to attributes with errors.
|
145
|
-
cattr_accessor :field_error_proc, default: Proc.new { |html_tag, instance|
|
145
|
+
cattr_accessor :field_error_proc, default: Proc.new { |html_tag, instance| content_tag :div, html_tag, class: "field_with_errors" }
|
146
146
|
|
147
147
|
# How to complete the streaming when an exception occurs.
|
148
148
|
# This is our best guess: first try to close the attribute, then the tag.
|
@@ -156,9 +156,6 @@ module ActionView #:nodoc:
|
|
156
156
|
# Specify default_formats that can be rendered.
|
157
157
|
cattr_accessor :default_formats
|
158
158
|
|
159
|
-
# Specify whether an error should be raised for missing translations
|
160
|
-
cattr_accessor :raise_on_missing_translations, default: false
|
161
|
-
|
162
159
|
# Specify whether submit_tag should automatically disable on click
|
163
160
|
cattr_accessor :automatically_disable_submit_tag, default: true
|
164
161
|
|
@@ -179,7 +176,7 @@ module ActionView #:nodoc:
|
|
179
176
|
ActionView::Resolver.caching = value
|
180
177
|
end
|
181
178
|
|
182
|
-
def xss_safe?
|
179
|
+
def xss_safe? # :nodoc:
|
183
180
|
true
|
184
181
|
end
|
185
182
|
|
@@ -227,7 +224,7 @@ module ActionView #:nodoc:
|
|
227
224
|
|
228
225
|
# :startdoc:
|
229
226
|
|
230
|
-
def initialize(lookup_context, assigns, controller)
|
227
|
+
def initialize(lookup_context, assigns, controller) # :nodoc:
|
231
228
|
@_config = ActiveSupport::InheritableOptions.new
|
232
229
|
|
233
230
|
@lookup_context = lookup_context
|
data/lib/action_view/buffers.rb
CHANGED
@@ -18,7 +18,7 @@ module ActionView
|
|
18
18
|
# sbuf << 5
|
19
19
|
# puts sbuf # => "hello\u0005"
|
20
20
|
#
|
21
|
-
class OutputBuffer < ActiveSupport::SafeBuffer
|
21
|
+
class OutputBuffer < ActiveSupport::SafeBuffer # :nodoc:
|
22
22
|
def initialize(*)
|
23
23
|
super
|
24
24
|
encode!
|
@@ -38,7 +38,7 @@ module ActionView
|
|
38
38
|
alias :safe_append= :safe_concat
|
39
39
|
end
|
40
40
|
|
41
|
-
class StreamingBuffer
|
41
|
+
class StreamingBuffer # :nodoc:
|
42
42
|
def initialize(block)
|
43
43
|
@block = block
|
44
44
|
end
|