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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +141 -272
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -3
- data/lib/action_view/base.rb +33 -21
- data/lib/action_view/buffers.rb +1 -1
- data/lib/action_view/context.rb +1 -1
- data/lib/action_view/dependency_tracker.rb +52 -20
- data/lib/action_view/digestor.rb +86 -83
- data/lib/action_view/flows.rb +9 -11
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers/active_model_helper.rb +8 -8
- data/lib/action_view/helpers/asset_tag_helper.rb +74 -38
- data/lib/action_view/helpers/asset_url_helper.rb +160 -59
- data/lib/action_view/helpers/atom_feed_helper.rb +16 -16
- data/lib/action_view/helpers/cache_helper.rb +90 -35
- data/lib/action_view/helpers/capture_helper.rb +7 -6
- data/lib/action_view/helpers/controller_helper.rb +3 -2
- data/lib/action_view/helpers/csrf_helper.rb +3 -3
- data/lib/action_view/helpers/date_helper.rb +156 -108
- data/lib/action_view/helpers/debug_helper.rb +3 -4
- data/lib/action_view/helpers/form_helper.rb +475 -94
- data/lib/action_view/helpers/form_options_helper.rb +87 -47
- data/lib/action_view/helpers/form_tag_helper.rb +88 -57
- data/lib/action_view/helpers/javascript_helper.rb +10 -10
- data/lib/action_view/helpers/number_helper.rb +76 -59
- data/lib/action_view/helpers/output_safety_helper.rb +34 -4
- data/lib/action_view/helpers/record_tag_helper.rb +12 -99
- data/lib/action_view/helpers/rendering_helper.rb +3 -3
- data/lib/action_view/helpers/sanitize_helper.rb +17 -14
- data/lib/action_view/helpers/tag_helper.rb +198 -73
- data/lib/action_view/helpers/tags/base.rb +132 -97
- data/lib/action_view/helpers/tags/check_box.rb +17 -17
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +9 -33
- data/lib/action_view/helpers/tags/collection_helpers.rb +68 -36
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -11
- data/lib/action_view/helpers/tags/collection_select.rb +2 -2
- data/lib/action_view/helpers/tags/date_select.rb +36 -36
- data/lib/action_view/helpers/tags/datetime_field.rb +1 -1
- data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
- data/lib/action_view/helpers/tags/label.rb +5 -1
- data/lib/action_view/helpers/tags/password_field.rb +1 -1
- data/lib/action_view/helpers/tags/placeholderable.rb +1 -1
- data/lib/action_view/helpers/tags/radio_button.rb +4 -4
- data/lib/action_view/helpers/tags/search_field.rb +12 -9
- data/lib/action_view/helpers/tags/select.rb +9 -9
- data/lib/action_view/helpers/tags/text_area.rb +1 -1
- data/lib/action_view/helpers/tags/text_field.rb +5 -6
- data/lib/action_view/helpers/tags/translator.rb +15 -13
- data/lib/action_view/helpers/text_helper.rb +47 -30
- data/lib/action_view/helpers/translation_helper.rb +60 -30
- data/lib/action_view/helpers/url_helper.rb +132 -104
- data/lib/action_view/helpers.rb +1 -1
- data/lib/action_view/layouts.rb +59 -54
- data/lib/action_view/log_subscriber.rb +56 -7
- data/lib/action_view/lookup_context.rb +76 -61
- data/lib/action_view/model_naming.rb +1 -1
- data/lib/action_view/path_set.rb +28 -19
- data/lib/action_view/railtie.rb +30 -6
- data/lib/action_view/record_identifier.rb +51 -25
- data/lib/action_view/renderer/abstract_renderer.rb +19 -15
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +55 -0
- data/lib/action_view/renderer/partial_renderer.rb +208 -206
- data/lib/action_view/renderer/renderer.rb +2 -6
- data/lib/action_view/renderer/streaming_template_renderer.rb +46 -48
- data/lib/action_view/renderer/template_renderer.rb +65 -66
- data/lib/action_view/rendering.rb +16 -9
- data/lib/action_view/routing_url_for.rb +25 -17
- data/lib/action_view/tasks/cache_digests.rake +23 -0
- data/lib/action_view/template/error.rb +14 -13
- data/lib/action_view/template/handlers/builder.rb +7 -7
- data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +9 -0
- data/lib/action_view/template/handlers/erb/erubi.rb +81 -0
- data/lib/action_view/template/handlers/erb/erubis.rb +81 -0
- data/lib/action_view/template/handlers/erb.rb +9 -76
- data/lib/action_view/template/handlers/html.rb +9 -0
- data/lib/action_view/template/handlers/raw.rb +1 -3
- data/lib/action_view/template/handlers.rb +8 -6
- data/lib/action_view/template/html.rb +2 -4
- data/lib/action_view/template/resolver.rb +133 -109
- data/lib/action_view/template/text.rb +5 -8
- data/lib/action_view/template/types.rb +15 -17
- data/lib/action_view/template.rb +51 -28
- data/lib/action_view/test_case.rb +32 -27
- data/lib/action_view/testing/resolvers.rb +29 -31
- data/lib/action_view/version.rb +1 -1
- data/lib/action_view/view_paths.rb +26 -32
- data/lib/action_view.rb +5 -5
- data/lib/assets/compiled/rails-ujs.js +685 -0
- metadata +23 -23
- data/lib/action_view/tasks/dependencies.rake +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e9b05cb9e60dbd3b1aa2689adf77008a3364b79
|
4
|
+
data.tar.gz: dd8f6bdfb4670846a21195cabf8d2a366f818615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a01cdde81fcf96e681dc8f90acfc0d213be8db2079bdb776df4c6cfce1167408cca5736259e6066da6c724ca355e63af80d0e765a0bdef9149d7492f0e7ac6c3
|
7
|
+
data.tar.gz: b1ca351dbcf16fce71eab9296fe1b696ec670e718c631150bec36f163bd95708d63f9a847ee2ad211b76ae33375cfdfdb53cea74efa2a82a94a09eb8b45a3518
|
data/CHANGELOG.md
CHANGED
@@ -1,347 +1,216 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 5.1.0 (April 27, 2017) ##
|
2
2
|
|
3
|
-
*
|
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
|
-
|
8
|
+
Fixes #28060.
|
7
9
|
|
8
|
-
*
|
10
|
+
*Andrew Hood*
|
9
11
|
|
12
|
+
* Change the ERB handler from Erubis to Erubi.
|
10
13
|
|
11
|
-
|
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
|
-
|
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
|
-
|
24
|
+
*Jeremy Evans*
|
17
25
|
|
18
|
-
*
|
26
|
+
* Allow render locals to be assigned to instance variables in a view.
|
19
27
|
|
28
|
+
Fixes #27480.
|
20
29
|
|
21
|
-
|
30
|
+
*Andrew White*
|
22
31
|
|
23
|
-
*
|
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
|
-
*
|
34
|
+
*Maksym Pugach*
|
27
35
|
|
28
|
-
*
|
36
|
+
* Return correct object name in form helper method after `fields_for`.
|
29
37
|
|
30
|
-
Fixes #
|
38
|
+
Fixes #26931.
|
31
39
|
|
32
|
-
*
|
40
|
+
*Yuji Yaginuma*
|
33
41
|
|
34
|
-
*
|
42
|
+
* Use `ActionView::Resolver.caching?` (`config.action_view.cache_template_loading`)
|
43
|
+
to enable template recompilation.
|
35
44
|
|
36
|
-
|
45
|
+
Before it was enabled by `consider_all_requests_local`, which caused
|
46
|
+
recompilation in tests.
|
37
47
|
|
38
|
-
*
|
48
|
+
*Max Melentiev*
|
39
49
|
|
40
|
-
*
|
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
|
-
|
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
|
-
|
58
|
+
Used like `form_for`:
|
47
59
|
|
48
|
-
|
60
|
+
```erb
|
61
|
+
<%= form_with model: @post do |form| %>
|
62
|
+
<%= form.text_field :title %>
|
63
|
+
<% end %>
|
64
|
+
```
|
49
65
|
|
50
|
-
|
66
|
+
*Kasper Timm Hansen*, *Marek Kirejczyk*
|
51
67
|
|
52
|
-
|
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
|
-
|
76
|
+
Can also be used within form helpers such as `form_with`.
|
56
77
|
|
57
|
-
*
|
58
|
-
method.
|
78
|
+
*Kasper Timm Hansen*
|
59
79
|
|
60
|
-
|
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
|
-
*
|
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. ᨫ).
|
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
|
-
|
86
|
+
Only locals with valid variable names get set directly. Others
|
87
|
+
will still be available in `local_assigns`.
|
249
88
|
|
250
|
-
|
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
|
-
|
91
|
+
```erb
|
92
|
+
<%= render "example", class: "text-center", message: "Hello world!" %>
|
255
93
|
|
256
|
-
|
94
|
+
<!-- _example.html.erb: -->
|
95
|
+
<%= tag.div class: local_assigns[:class] do %>
|
96
|
+
<p><%= message %></p>
|
97
|
+
<% end %>
|
98
|
+
```
|
257
99
|
|
258
|
-
|
100
|
+
*Peter Schilling*, *Matthew Draper*
|
259
101
|
|
260
|
-
|
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
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
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
|
-
|
272
|
-
Post".
|
109
|
+
*Richard Schneeman*
|
273
110
|
|
274
|
-
|
111
|
+
* Add `:poster_skip_pipeline` option to the `video_tag` helper
|
275
112
|
|
276
|
-
|
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
|
-
|
117
|
+
*Richard Schneeman*
|
279
118
|
|
280
|
-
|
119
|
+
* Show cache hits and misses when rendering partials.
|
281
120
|
|
282
|
-
|
121
|
+
Partials using the `cache` helper will show whether a render hit or missed
|
122
|
+
the cache:
|
283
123
|
|
284
|
-
|
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
|
-
|
129
|
+
This removes the need for the old fragment cache logging:
|
287
130
|
|
288
|
-
|
289
|
-
|
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
|
-
|
138
|
+
Though that full output can be reenabled with
|
139
|
+
`config.action_controller.enable_fragment_cache_logging = true`.
|
292
140
|
|
293
|
-
|
294
|
-
<link href="/assets/myicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
|
141
|
+
*Stan Lo*
|
295
142
|
|
296
|
-
|
143
|
+
* Changed partial rendering with a collection to allow collections which
|
144
|
+
implement `to_a`.
|
297
145
|
|
298
|
-
|
299
|
-
|
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
|
-
*
|
152
|
+
*Steven Harman*
|
302
153
|
|
303
|
-
*
|
154
|
+
* New syntax for tag helpers. Avoid positional parameters and support HTML5 by default.
|
155
|
+
Example usage of tag helpers before:
|
304
156
|
|
305
|
-
|
306
|
-
|
307
|
-
|
157
|
+
```ruby
|
158
|
+
tag(:br, nil, true)
|
159
|
+
content_tag(:div, content_tag(:p, "Hello world!"), class: "strong")
|
308
160
|
|
309
|
-
|
161
|
+
<%= content_tag :div, class: "strong" do -%>
|
162
|
+
Hello world!
|
163
|
+
<% end -%>
|
164
|
+
```
|
310
165
|
|
311
|
-
|
166
|
+
Example usage of tag helpers after:
|
312
167
|
|
313
|
-
|
168
|
+
```ruby
|
169
|
+
tag.br
|
170
|
+
tag.div tag.p("Hello world!"), class: "strong"
|
314
171
|
|
315
|
-
|
172
|
+
<%= tag.div class: "strong" do %>
|
173
|
+
Hello world!
|
174
|
+
<% end %>
|
175
|
+
```
|
316
176
|
|
317
|
-
*
|
177
|
+
*Marek Kirejczyk*, *Kasper Timm Hansen*
|
318
178
|
|
319
|
-
|
179
|
+
* Change `datetime_field` and `datetime_field_tag` to generate `datetime-local` fields.
|
320
180
|
|
321
|
-
|
322
|
-
|
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
|
-
|
185
|
+
*Herminio Torres*
|
325
186
|
|
326
|
-
|
187
|
+
* Raw template handler (which is also the default template handler in Rails 5) now outputs
|
188
|
+
HTML-safe strings.
|
327
189
|
|
328
|
-
|
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
|
-
*
|
196
|
+
*Eileen M. Uchitelle*
|
331
197
|
|
332
|
-
*
|
333
|
-
|
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
|
-
|
202
|
+
Generation of option before:
|
336
203
|
|
337
|
-
|
204
|
+
```html
|
205
|
+
<option value=""></option>
|
206
|
+
```
|
338
207
|
|
339
|
-
|
208
|
+
Generation of option after:
|
340
209
|
|
341
|
-
|
342
|
-
|
343
|
-
|
210
|
+
```html
|
211
|
+
<option value="" label=" "></option>
|
212
|
+
```
|
344
213
|
|
345
|
-
*
|
214
|
+
*Vipul A M*
|
346
215
|
|
347
|
-
Please check [
|
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
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
|
-
|
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/
|
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
|
-
|
data/lib/action_view/base.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
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
|
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
|
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
|
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,
|
37
|
-
# including the trailing newline.
|
38
|
-
# Note however that
|
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
|
-
#
|
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
|
130
|
-
# code
|
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=, :
|
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, :
|
179
|
-
delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, :
|
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) }
|
data/lib/action_view/buffers.rb
CHANGED
data/lib/action_view/context.rb
CHANGED
@@ -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
|