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