actionview 5.2.0.beta2 → 5.2.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 +5 -5
- data/CHANGELOG.md +18 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -2
- data/lib/action_view.rb +1 -1
- data/lib/action_view/digestor.rb +1 -1
- data/lib/action_view/gem_version.rb +1 -1
- data/lib/action_view/helpers/asset_tag_helper.rb +96 -15
- data/lib/action_view/helpers/asset_url_helper.rb +6 -6
- data/lib/action_view/helpers/date_helper.rb +2 -2
- data/lib/action_view/helpers/form_helper.rb +6 -7
- data/lib/action_view/helpers/form_options_helper.rb +8 -4
- data/lib/action_view/helpers/text_helper.rb +4 -4
- data/lib/action_view/helpers/url_helper.rb +5 -0
- data/lib/action_view/renderer/streaming_template_renderer.rb +2 -0
- data/lib/assets/compiled/rails-ujs.js +14 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7546a7966a4112a3dc5a0145fd071e37c819723d2153c0fe153a6a50511ff5a7
|
4
|
+
data.tar.gz: f92dc57125505c479d7107817ae59aedd14a37e28a4078777a78fb968c77a5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc5caf199d1c8d187c3835ba18fe1d874d6dbbf537cc6046f52f7b7dc8c5407539450d6cae37cc352e580b261cded9c3c9695f79eff81a6190dd0c80cd99e570
|
7
|
+
data.tar.gz: ea54f7079224d349df20dd66aa8de28e7c4af61059646ecc93d1c630ef53a678cc8e9ac650ab945049a6f3b856397008ad98defe51ed9c6d83d191595d7d8f62
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## Rails 5.2.0.rc1 (January 30, 2018) ##
|
2
|
+
|
3
|
+
* Allow the use of callable objects as group methods for grouped selects.
|
4
|
+
|
5
|
+
Until now, the `option_groups_from_collection_for_select` method was only able to
|
6
|
+
handle method names as `group_method` and `group_label_method` parameters,
|
7
|
+
it is now able to receive procs and other callable objects too.
|
8
|
+
|
9
|
+
*Jérémie Bonal*
|
10
|
+
|
11
|
+
* Add `preload_link_tag` helper
|
12
|
+
|
13
|
+
This helper that allows to the browser to initiate early fetch of resources
|
14
|
+
(different to the specified in `javascript_include_tag` and `stylesheet_link_tag`).
|
15
|
+
Additionally, this sends Early Hints if supported by browser.
|
16
|
+
|
17
|
+
*Guillermo Iguaran*
|
18
|
+
|
1
19
|
## Rails 5.2.0.beta2 (November 28, 2017) ##
|
2
20
|
|
3
21
|
* No changes.
|
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ The latest version of Action View can be installed with RubyGems:
|
|
11
11
|
|
12
12
|
$ gem install actionview
|
13
13
|
|
14
|
-
Source code can be downloaded as part of the Rails project on GitHub
|
14
|
+
Source code can be downloaded as part of the Rails project on GitHub:
|
15
15
|
|
16
16
|
* https://github.com/rails/rails/tree/master/actionview
|
17
17
|
|
@@ -29,7 +29,7 @@ API documentation is at
|
|
29
29
|
|
30
30
|
* http://api.rubyonrails.org
|
31
31
|
|
32
|
-
Bug reports
|
32
|
+
Bug reports for the Ruby on Rails project can be filed here:
|
33
33
|
|
34
34
|
* https://github.com/rails/rails/issues
|
35
35
|
|
data/lib/action_view.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright (c) 2004-
|
4
|
+
# Copyright (c) 2004-2018 David Heinemeier Hansson
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
# a copy of this software and associated documentation files (the
|
data/lib/action_view/digestor.rb
CHANGED
@@ -89,7 +89,7 @@ module ActionView
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def digest(finder, stack = [])
|
92
|
-
Digest
|
92
|
+
ActiveSupport::Digest.hexdigest("#{template.source}-#{dependency_digest(finder, stack)}")
|
93
93
|
end
|
94
94
|
|
95
95
|
def dependency_digest(finder, stack)
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require "active_support/core_ext/array/extract_options"
|
4
4
|
require "active_support/core_ext/hash/keys"
|
5
|
+
require "active_support/core_ext/object/inclusion"
|
6
|
+
require "active_support/core_ext/object/try"
|
5
7
|
require "action_view/helpers/asset_url_helper"
|
6
8
|
require "action_view/helpers/tag_helper"
|
7
9
|
|
@@ -45,11 +47,11 @@ module ActionView
|
|
45
47
|
# When the last parameter is a hash you can add HTML attributes using that
|
46
48
|
# parameter. The following options are supported:
|
47
49
|
#
|
48
|
-
# * <tt>:extname</tt> - Append an extension to the generated
|
49
|
-
# already exists. This only applies for relative
|
50
|
-
# * <tt>:protocol</tt> - Sets the protocol of the generated
|
51
|
-
# applies when a relative
|
52
|
-
# * <tt>:host</tt> - When a relative
|
50
|
+
# * <tt>:extname</tt> - Append an extension to the generated URL unless the extension
|
51
|
+
# already exists. This only applies for relative URLs.
|
52
|
+
# * <tt>:protocol</tt> - Sets the protocol of the generated URL. This option only
|
53
|
+
# applies when a relative URL and +host+ options are provided.
|
54
|
+
# * <tt>:host</tt> - When a relative URL is provided the host is added to the
|
53
55
|
# that path.
|
54
56
|
# * <tt>:skip_pipeline</tt> - This option is used to bypass the asset pipeline
|
55
57
|
# when it is set to true.
|
@@ -91,7 +93,7 @@ module ActionView
|
|
91
93
|
content_tag("script".freeze, "", tag_options)
|
92
94
|
}.join("\n").html_safe
|
93
95
|
|
94
|
-
request.send_early_hints("Link" => early_hints_links.join("\n")) if respond_to?(:request)
|
96
|
+
request.send_early_hints("Link" => early_hints_links.join("\n")) if respond_to?(:request) && request
|
95
97
|
|
96
98
|
sources_tags
|
97
99
|
end
|
@@ -140,7 +142,7 @@ module ActionView
|
|
140
142
|
tag(:link, tag_options)
|
141
143
|
}.join("\n").html_safe
|
142
144
|
|
143
|
-
request.send_early_hints("Link" => early_hints_links.join("\n")) if respond_to?(:request)
|
145
|
+
request.send_early_hints("Link" => early_hints_links.join("\n")) if respond_to?(:request) && request
|
144
146
|
|
145
147
|
sources_tags
|
146
148
|
end
|
@@ -221,8 +223,69 @@ module ActionView
|
|
221
223
|
}.merge!(options.symbolize_keys))
|
222
224
|
end
|
223
225
|
|
226
|
+
# Returns a link tag that browsers can use to preload the +source+.
|
227
|
+
# The +source+ can be the path of a resource managed by asset pipeline,
|
228
|
+
# a full path, or an URI.
|
229
|
+
#
|
230
|
+
# ==== Options
|
231
|
+
#
|
232
|
+
# * <tt>:type</tt> - Override the auto-generated mime type, defaults to the mime type for +source+ extension.
|
233
|
+
# * <tt>:as</tt> - Override the auto-generated value for as attribute, calculated using +source+ extension and mime type.
|
234
|
+
# * <tt>:crossorigin</tt> - Specify the crossorigin attribute, required to load cross-origin resources.
|
235
|
+
# * <tt>:nopush</tt> - Specify if the use of server push is not desired for the resource. Defaults to +false+.
|
236
|
+
#
|
237
|
+
# ==== Examples
|
238
|
+
#
|
239
|
+
# preload_link_tag("custom_theme.css")
|
240
|
+
# # => <link rel="preload" href="/assets/custom_theme.css" as="style" type="text/css" />
|
241
|
+
#
|
242
|
+
# preload_link_tag("/videos/video.webm")
|
243
|
+
# # => <link rel="preload" href="/videos/video.mp4" as="video" type="video/webm" />
|
244
|
+
#
|
245
|
+
# preload_link_tag(post_path(format: :json), as: "fetch")
|
246
|
+
# # => <link rel="preload" href="/posts.json" as="fetch" type="application/json" />
|
247
|
+
#
|
248
|
+
# preload_link_tag("worker.js", as: "worker")
|
249
|
+
# # => <link rel="preload" href="/assets/worker.js" as="worker" type="text/javascript" />
|
250
|
+
#
|
251
|
+
# preload_link_tag("//example.com/font.woff2")
|
252
|
+
# # => <link rel="preload" href="//example.com/font.woff2" as="font" type="font/woff2" crossorigin="anonymous"/>
|
253
|
+
#
|
254
|
+
# preload_link_tag("//example.com/font.woff2", crossorigin: "use-credentials")
|
255
|
+
# # => <link rel="preload" href="//example.com/font.woff2" as="font" type="font/woff2" crossorigin="use-credentials" />
|
256
|
+
#
|
257
|
+
# preload_link_tag("/media/audio.ogg", nopush: true)
|
258
|
+
# # => <link rel="preload" href="/media/audio.ogg" as="audio" type="audio/ogg" />
|
259
|
+
#
|
260
|
+
def preload_link_tag(source, options = {})
|
261
|
+
href = asset_path(source, skip_pipeline: options.delete(:skip_pipeline))
|
262
|
+
extname = File.extname(source).downcase.delete(".")
|
263
|
+
mime_type = options.delete(:type) || Template::Types[extname].try(:to_s)
|
264
|
+
as_type = options.delete(:as) || resolve_link_as(extname, mime_type)
|
265
|
+
crossorigin = options.delete(:crossorigin)
|
266
|
+
crossorigin = "anonymous" if crossorigin == true || (crossorigin.blank? && as_type == "font")
|
267
|
+
nopush = options.delete(:nopush) || false
|
268
|
+
|
269
|
+
link_tag = tag.link({
|
270
|
+
rel: "preload",
|
271
|
+
href: href,
|
272
|
+
as: as_type,
|
273
|
+
type: mime_type,
|
274
|
+
crossorigin: crossorigin
|
275
|
+
}.merge!(options.symbolize_keys))
|
276
|
+
|
277
|
+
early_hints_link = "<#{href}>; rel=preload; as=#{as_type}"
|
278
|
+
early_hints_link += "; type=#{mime_type}" if mime_type
|
279
|
+
early_hints_link += "; crossorigin=#{crossorigin}" if crossorigin
|
280
|
+
early_hints_link += "; nopush" if nopush
|
281
|
+
|
282
|
+
request.send_early_hints("Link" => early_hints_link) if respond_to?(:request) && request
|
283
|
+
|
284
|
+
link_tag
|
285
|
+
end
|
286
|
+
|
224
287
|
# Returns an HTML image tag for the +source+. The +source+ can be a full
|
225
|
-
# path, a file or an Active Storage attachment.
|
288
|
+
# path, a file, or an Active Storage attachment.
|
226
289
|
#
|
227
290
|
# ==== Options
|
228
291
|
#
|
@@ -310,12 +373,13 @@ module ActionView
|
|
310
373
|
# Returns an HTML video tag for the +sources+. If +sources+ is a string,
|
311
374
|
# a single video tag will be returned. If +sources+ is an array, a video
|
312
375
|
# tag with nested source tags for each source will be returned. The
|
313
|
-
# +sources+ can be full paths or files that
|
376
|
+
# +sources+ can be full paths or files that exist in your public videos
|
314
377
|
# directory.
|
315
378
|
#
|
316
379
|
# ==== Options
|
317
|
-
#
|
318
|
-
#
|
380
|
+
#
|
381
|
+
# When the last parameter is a hash you can add HTML attributes using that
|
382
|
+
# parameter. The following options are supported:
|
319
383
|
#
|
320
384
|
# * <tt>:poster</tt> - Set an image (like a screenshot) to be shown
|
321
385
|
# before the video loads. The path is calculated like the +src+ of +image_tag+.
|
@@ -332,7 +396,7 @@ module ActionView
|
|
332
396
|
# video_tag("trailer.ogg")
|
333
397
|
# # => <video src="/videos/trailer.ogg"></video>
|
334
398
|
# video_tag("trailer.ogg", controls: true, preload: 'none')
|
335
|
-
# # => <video preload="none" controls="controls" src="/videos/trailer.ogg"
|
399
|
+
# # => <video preload="none" controls="controls" src="/videos/trailer.ogg"></video>
|
336
400
|
# video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png")
|
337
401
|
# # => <video src="/videos/trailer.m4v" width="16" height="10" poster="/assets/screenshot.png"></video>
|
338
402
|
# video_tag("trailer.m4v", size: "16x10", poster: "screenshot.png", poster_skip_pipeline: true)
|
@@ -359,9 +423,14 @@ module ActionView
|
|
359
423
|
end
|
360
424
|
end
|
361
425
|
|
362
|
-
# Returns an HTML audio tag for the +
|
363
|
-
#
|
364
|
-
#
|
426
|
+
# Returns an HTML audio tag for the +sources+. If +sources+ is a string,
|
427
|
+
# a single audio tag will be returned. If +sources+ is an array, an audio
|
428
|
+
# tag with nested source tags for each source will be returned. The
|
429
|
+
# +sources+ can be full paths or files that exist in your public audios
|
430
|
+
# directory.
|
431
|
+
#
|
432
|
+
# When the last parameter is a hash you can add HTML attributes using that
|
433
|
+
# parameter.
|
365
434
|
#
|
366
435
|
# audio_tag("sound")
|
367
436
|
# # => <audio src="/audios/sound"></audio>
|
@@ -417,6 +486,18 @@ module ActionView
|
|
417
486
|
raise ArgumentError, "Cannot pass a :size option with a :height or :width option"
|
418
487
|
end
|
419
488
|
end
|
489
|
+
|
490
|
+
def resolve_link_as(extname, mime_type)
|
491
|
+
if extname == "js"
|
492
|
+
"script"
|
493
|
+
elsif extname == "css"
|
494
|
+
"style"
|
495
|
+
elsif extname == "vtt"
|
496
|
+
"track"
|
497
|
+
elsif (type = mime_type.to_s.split("/")[0]) && type.in?(%w(audio video font))
|
498
|
+
type
|
499
|
+
end
|
500
|
+
end
|
420
501
|
end
|
421
502
|
end
|
422
503
|
end
|
@@ -6,7 +6,7 @@ module ActionView
|
|
6
6
|
# = Action View Asset URL Helpers
|
7
7
|
module Helpers #:nodoc:
|
8
8
|
# This module provides methods for generating asset paths and
|
9
|
-
#
|
9
|
+
# URLs.
|
10
10
|
#
|
11
11
|
# image_path("rails.png")
|
12
12
|
# # => "/assets/rails.png"
|
@@ -57,8 +57,8 @@ module ActionView
|
|
57
57
|
# You can read more about setting up your DNS CNAME records from your ISP.
|
58
58
|
#
|
59
59
|
# Note: This is purely a browser performance optimization and is not meant
|
60
|
-
# for server load balancing. See
|
61
|
-
# for background and
|
60
|
+
# for server load balancing. See https://www.die.net/musings/page_load_time/
|
61
|
+
# for background and https://www.browserscope.org/?category=network for
|
62
62
|
# connection limit data.
|
63
63
|
#
|
64
64
|
# Alternatively, you can exert more control over the asset host by setting
|
@@ -97,7 +97,7 @@ module ActionView
|
|
97
97
|
# still sending assets for plain HTTP requests from asset hosts. If you don't
|
98
98
|
# have SSL certificates for each of the asset hosts this technique allows you
|
99
99
|
# to avoid warnings in the client about mixed media.
|
100
|
-
# Note that the request parameter might not be supplied, e.g. when the assets
|
100
|
+
# Note that the +request+ parameter might not be supplied, e.g. when the assets
|
101
101
|
# are precompiled via a Rake task. Make sure to use a +Proc+ instead of a lambda,
|
102
102
|
# since a +Proc+ allows missing parameters and sets them to +nil+.
|
103
103
|
#
|
@@ -149,13 +149,13 @@ module ActionView
|
|
149
149
|
# Below lists scenarios that apply to +asset_path+ whether or not you're
|
150
150
|
# using the asset pipeline.
|
151
151
|
#
|
152
|
-
# - All fully qualified
|
152
|
+
# - All fully qualified URLs are returned immediately. This bypasses the
|
153
153
|
# asset pipeline and all other behavior described.
|
154
154
|
#
|
155
155
|
# asset_path("http://www.example.com/js/xmlhr.js") # => "http://www.example.com/js/xmlhr.js"
|
156
156
|
#
|
157
157
|
# - All assets that begin with a forward slash are assumed to be full
|
158
|
-
#
|
158
|
+
# URLs and will not be expanded. This will bypass the asset pipeline.
|
159
159
|
#
|
160
160
|
# asset_path("/foo.png") # => "/foo.png"
|
161
161
|
#
|
@@ -116,7 +116,7 @@ module ActionView
|
|
116
116
|
when 10..19 then locale.t :less_than_x_seconds, count: 20
|
117
117
|
when 20..39 then locale.t :half_a_minute
|
118
118
|
when 40..59 then locale.t :less_than_x_minutes, count: 1
|
119
|
-
|
119
|
+
else locale.t :x_minutes, count: 1
|
120
120
|
end
|
121
121
|
|
122
122
|
when 2...45 then locale.t :x_minutes, count: distance_in_minutes
|
@@ -131,7 +131,7 @@ module ActionView
|
|
131
131
|
when 43200...86400 then locale.t :about_x_months, count: (distance_in_minutes.to_f / 43200.0).round
|
132
132
|
# 60 days up to 365 days
|
133
133
|
when 86400...525600 then locale.t :x_months, count: (distance_in_minutes.to_f / 43200.0).round
|
134
|
-
|
134
|
+
else
|
135
135
|
from_year = from_time.year
|
136
136
|
from_year += 1 if from_time.month >= 3
|
137
137
|
to_year = to_time.year
|
@@ -19,7 +19,7 @@ module ActionView
|
|
19
19
|
# compared to using vanilla HTML.
|
20
20
|
#
|
21
21
|
# Typically, a form designed to create or update a resource reflects the
|
22
|
-
# identity of the resource in several ways: (i) the
|
22
|
+
# identity of the resource in several ways: (i) the URL that the form is
|
23
23
|
# sent to (the form element's +action+ attribute) should result in a request
|
24
24
|
# being routed to the appropriate controller action (with the appropriate <tt>:id</tt>
|
25
25
|
# parameter in the case of an existing resource), (ii) input fields should
|
@@ -166,7 +166,7 @@ module ActionView
|
|
166
166
|
# So for example you may use a named route directly. When the model is
|
167
167
|
# represented by a string or symbol, as in the example above, if the
|
168
168
|
# <tt>:url</tt> option is not specified, by default the form will be
|
169
|
-
# sent back to the current
|
169
|
+
# sent back to the current URL (We will describe below an alternative
|
170
170
|
# resource-oriented usage of +form_for+ in which the URL does not need
|
171
171
|
# to be specified explicitly).
|
172
172
|
# * <tt>:namespace</tt> - A namespace for your form to ensure uniqueness of
|
@@ -608,7 +608,7 @@ module ActionView
|
|
608
608
|
# This is helpful when fragment-caching the form. Remote forms
|
609
609
|
# get the authenticity token from the <tt>meta</tt> tag, so embedding is
|
610
610
|
# unnecessary unless you support browsers without JavaScript.
|
611
|
-
# * <tt>:local</tt> - By default form submits are remote and
|
611
|
+
# * <tt>:local</tt> - By default form submits are remote and unobtrusive XHRs.
|
612
612
|
# Disable remote submits with <tt>local: true</tt>.
|
613
613
|
# * <tt>:skip_enforcing_utf8</tt> - By default a hidden field named +utf8+
|
614
614
|
# is output to enforce UTF-8 submits. Set to true to skip the field.
|
@@ -1014,14 +1014,13 @@ module ActionView
|
|
1014
1014
|
# <%= fields :comment do |fields| %>
|
1015
1015
|
# <%= fields.text_field :body %>
|
1016
1016
|
# <% end %>
|
1017
|
-
# # => <input type="text" name="comment[body]>
|
1017
|
+
# # => <input type="text" name="comment[body]">
|
1018
1018
|
#
|
1019
1019
|
# # Using a model infers the scope and assigns field values:
|
1020
|
-
# <%= fields model: Comment.new(body: "full bodied") do |fields|
|
1020
|
+
# <%= fields model: Comment.new(body: "full bodied") do |fields| %>
|
1021
1021
|
# <%= fields.text_field :body %>
|
1022
1022
|
# <% end %>
|
1023
|
-
# # =>
|
1024
|
-
# <input type="text" name="comment[body] value="full bodied">
|
1023
|
+
# # => <input type="text" name="comment[body]" value="full bodied">
|
1025
1024
|
#
|
1026
1025
|
# # Using +fields+ with +form_with+:
|
1027
1026
|
# <%= form_with model: @post do |form| %>
|
@@ -214,9 +214,13 @@ module ActionView
|
|
214
214
|
# * +method+ - The attribute of +object+ corresponding to the select tag
|
215
215
|
# * +collection+ - An array of objects representing the <tt><optgroup></tt> tags.
|
216
216
|
# * +group_method+ - The name of a method which, when called on a member of +collection+, returns an
|
217
|
-
# array of child objects representing the <tt><option></tt> tags.
|
217
|
+
# array of child objects representing the <tt><option></tt> tags. It can also be any object that responds
|
218
|
+
# to +call+, such as a +proc+, that will be called for each member of the +collection+ to retrieve the
|
219
|
+
# value.
|
218
220
|
# * +group_label_method+ - The name of a method which, when called on a member of +collection+, returns a
|
219
|
-
# string to be used as the +label+ attribute for its <tt><optgroup></tt> tag.
|
221
|
+
# string to be used as the +label+ attribute for its <tt><optgroup></tt> tag. It can also be any object
|
222
|
+
# that responds to +call+, such as a +proc+, that will be called for each member of the +collection+ to
|
223
|
+
# retrieve the label.
|
220
224
|
# * +option_key_method+ - The name of a method which, when called on a child object of a member of
|
221
225
|
# +collection+, returns a value to be used as the +value+ attribute for its <tt><option></tt> tag.
|
222
226
|
# * +option_value_method+ - The name of a method which, when called on a child object of a member of
|
@@ -457,9 +461,9 @@ module ActionView
|
|
457
461
|
def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)
|
458
462
|
collection.map do |group|
|
459
463
|
option_tags = options_from_collection_for_select(
|
460
|
-
group
|
464
|
+
value_for_collection(group, group_method), option_key_method, option_value_method, selected_key)
|
461
465
|
|
462
|
-
content_tag("optgroup".freeze, option_tags, label: group
|
466
|
+
content_tag("optgroup".freeze, option_tags, label: value_for_collection(group, group_label_method))
|
463
467
|
end.join.html_safe
|
464
468
|
end
|
465
469
|
|
@@ -13,9 +13,9 @@ module ActionView
|
|
13
13
|
#
|
14
14
|
# ==== Sanitization
|
15
15
|
#
|
16
|
-
# Most text helpers
|
17
|
-
# This means HTML tags will appear in the page but all malicious
|
18
|
-
# Let's look at some examples using the +simple_format+ method:
|
16
|
+
# Most text helpers that generate HTML output sanitize the given input by default,
|
17
|
+
# but do not escape it. This means HTML tags will appear in the page but all malicious
|
18
|
+
# code will be removed. Let's look at some examples using the +simple_format+ method:
|
19
19
|
#
|
20
20
|
# simple_format('<a href="http://example.com/">Example</a>')
|
21
21
|
# # => "<p><a href=\"http://example.com/\">Example</a></p>"
|
@@ -128,7 +128,7 @@ module ActionView
|
|
128
128
|
# # => You searched for: <a href="search?q=rails">rails</a>
|
129
129
|
#
|
130
130
|
# highlight('<a href="javascript:alert(\'no!\')">ruby</a> on rails', 'rails', sanitize: false)
|
131
|
-
# # =>
|
131
|
+
# # => <a href="javascript:alert('no!')">ruby</a> on <mark>rails</mark>
|
132
132
|
def highlight(text, phrases, options = {})
|
133
133
|
text = sanitize(text) if options.fetch(:sanitize, true)
|
134
134
|
|
@@ -139,6 +139,11 @@ module ActionView
|
|
139
139
|
# link_to "Profiles", controller: "profiles"
|
140
140
|
# # => <a href="/profiles">Profiles</a>
|
141
141
|
#
|
142
|
+
# When name is +nil+ the href is presented instead
|
143
|
+
#
|
144
|
+
# link_to nil, "http://example.com"
|
145
|
+
# # => <a href="http://www.example.com">http://www.example.com</a>
|
146
|
+
#
|
142
147
|
# You can use a block as well if your link target is hard to fit into the name parameter. ERB example:
|
143
148
|
#
|
144
149
|
# <%= link_to(@profile) do %>
|
@@ -65,7 +65,9 @@ module ActionView
|
|
65
65
|
yielder = lambda { |*name| view._layout_for(*name) }
|
66
66
|
|
67
67
|
instrument(:template, identifier: template.identifier, layout: layout.try(:virtual_path)) do
|
68
|
+
outer_config = I18n.config
|
68
69
|
fiber = Fiber.new do
|
70
|
+
I18n.config = outer_config
|
69
71
|
if layout
|
70
72
|
layout.render(view, locals, output, &yielder)
|
71
73
|
else
|
@@ -101,7 +101,7 @@ Released under the MIT license
|
|
101
101
|
|
102
102
|
}).call(this);
|
103
103
|
(function() {
|
104
|
-
var CustomEvent, fire, matches;
|
104
|
+
var CustomEvent, fire, matches, preventDefault;
|
105
105
|
|
106
106
|
matches = Rails.matches;
|
107
107
|
|
@@ -115,6 +115,19 @@ Released under the MIT license
|
|
115
115
|
return evt;
|
116
116
|
};
|
117
117
|
CustomEvent.prototype = window.Event.prototype;
|
118
|
+
preventDefault = CustomEvent.prototype.preventDefault;
|
119
|
+
CustomEvent.prototype.preventDefault = function() {
|
120
|
+
var result;
|
121
|
+
result = preventDefault.call(this);
|
122
|
+
if (this.cancelable && !this.defaultPrevented) {
|
123
|
+
Object.defineProperty(this, 'defaultPrevented', {
|
124
|
+
get: function() {
|
125
|
+
return true;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
}
|
129
|
+
return result;
|
130
|
+
};
|
118
131
|
}
|
119
132
|
|
120
133
|
fire = Rails.fire = function(obj, name, data) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.0.
|
4
|
+
version: 5.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.2.0.
|
19
|
+
version: 5.2.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.2.0.
|
26
|
+
version: 5.2.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,28 +92,28 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.2.0.
|
95
|
+
version: 5.2.0.rc1
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 5.2.0.
|
102
|
+
version: 5.2.0.rc1
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activemodel
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 5.2.0.
|
109
|
+
version: 5.2.0.rc1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 5.2.0.
|
116
|
+
version: 5.2.0.rc1
|
117
117
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
118
118
|
email: david@loudthinking.com
|
119
119
|
executables: []
|
@@ -229,8 +229,8 @@ homepage: http://rubyonrails.org
|
|
229
229
|
licenses:
|
230
230
|
- MIT
|
231
231
|
metadata:
|
232
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.0.
|
233
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.0.
|
232
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.0.rc1/actionview
|
233
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc1/actionview/CHANGELOG.md
|
234
234
|
post_install_message:
|
235
235
|
rdoc_options: []
|
236
236
|
require_paths:
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
requirements:
|
249
249
|
- none
|
250
250
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.7.3
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: Rendering framework putting the V in MVC (part of Rails).
|