actionview 4.1.5 → 4.1.6.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 +20 -0
- data/lib/action_view/dependency_tracker.rb +10 -4
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/helpers/asset_url_helper.rb +1 -1
- data/lib/action_view/helpers/atom_feed_helper.rb +1 -1
- data/lib/action_view/helpers/form_options_helper.rb +84 -86
- data/lib/action_view/helpers/sanitize_helper.rb +2 -2
- data/lib/action_view/helpers/tags/select.rb +1 -1
- data/lib/action_view/tasks/dependencies.rake +10 -6
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aab9c52f19534a48ca3d478c36679775fbde02ff
|
4
|
+
data.tar.gz: e74051ca795915984aa24f10d45a1d338c8fb8de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82c73f46ce6cc13bf2ea5241785ae03297a78edea7593a9f4e630d984aba146b137188f59e31c9e0887ca0f201174fd1a012ba3f8ea21ac28be225cbe932fd73
|
7
|
+
data.tar.gz: 26182857d0392b01c2d9f24a1bdb88594adc97835b1abe75a635efbd817bd3497bee99740ba20dd6ea80dcadb1e9abe3292064b147a7f3eac0e434119723dfdc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## Rails 4.1.6 (August 19, 2014) ##
|
2
|
+
|
3
|
+
* Fix that render layout: 'messages/layout' should also be added to the dependency tracker tree.
|
4
|
+
|
5
|
+
*DHH*
|
6
|
+
|
7
|
+
* Return an absolute instead of relative path from an asset url in the case
|
8
|
+
of the `asset_host` proc returning nil
|
9
|
+
|
10
|
+
*Jolyon Pawlyn*
|
11
|
+
|
12
|
+
* Fix `html_escape_once` to properly handle hex escape sequences (e.g. ᨫ)
|
13
|
+
|
14
|
+
*John F. Douthat*
|
15
|
+
|
16
|
+
* Bring `cache_digest` rake tasks up-to-date with the latest API changes
|
17
|
+
|
18
|
+
*Jiri Pospisil*
|
19
|
+
|
20
|
+
|
1
21
|
## Rails 4.1.5 (August 18, 2014) ##
|
2
22
|
|
3
23
|
* No changes.
|
@@ -53,6 +53,12 @@ module ActionView
|
|
53
53
|
\s* # followed by optional spaces
|
54
54
|
/x
|
55
55
|
|
56
|
+
# Part of any hash containing the :layout key
|
57
|
+
LAYOUT_HASH_KEY = /
|
58
|
+
(?:\blayout:|:layout\s*=>) # layout key in either old or new style hash syntax
|
59
|
+
\s* # followed by optional spaces
|
60
|
+
/x
|
61
|
+
|
56
62
|
# Matches:
|
57
63
|
# partial: "comments/comment", collection: @all_comments => "comments/comment"
|
58
64
|
# (object: @single_comment, partial: "comments/comment") => "comments/comment"
|
@@ -65,9 +71,9 @@ module ActionView
|
|
65
71
|
# topics => "topics/topic"
|
66
72
|
# (message.topics) => "topics/topic"
|
67
73
|
RENDER_ARGUMENTS = /\A
|
68
|
-
(?:\s*\(?\s*)
|
69
|
-
(?:.*?#{PARTIAL_HASH_KEY})?
|
70
|
-
(?:#{STRING}|#{VARIABLE_OR_METHOD_CHAIN})
|
74
|
+
(?:\s*\(?\s*) # optional opening paren surrounded by spaces
|
75
|
+
(?:.*?#{PARTIAL_HASH_KEY}|#{LAYOUT_HASH_KEY})? # optional hash, up to the partial or layout key declaration
|
76
|
+
(?:#{STRING}|#{VARIABLE_OR_METHOD_CHAIN}) # finally, the dependency name of interest
|
71
77
|
/xm
|
72
78
|
|
73
79
|
def self.call(name, template)
|
@@ -85,8 +91,8 @@ module ActionView
|
|
85
91
|
attr_reader :name, :template
|
86
92
|
private :name, :template
|
87
93
|
|
88
|
-
private
|
89
94
|
|
95
|
+
private
|
90
96
|
def source
|
91
97
|
template.source
|
92
98
|
end
|
@@ -192,7 +192,6 @@ module ActionView
|
|
192
192
|
def compute_asset_host(source = "", options = {})
|
193
193
|
request = self.request if respond_to?(:request)
|
194
194
|
host = config.asset_host if defined? config.asset_host
|
195
|
-
host ||= request.base_url if request && options[:protocol] == :request
|
196
195
|
|
197
196
|
if host.respond_to?(:call)
|
198
197
|
arity = host.respond_to?(:arity) ? host.arity : host.method(:call).arity
|
@@ -203,6 +202,7 @@ module ActionView
|
|
203
202
|
host = host % (Zlib.crc32(source) % 4)
|
204
203
|
end
|
205
204
|
|
205
|
+
host ||= request.base_url if request && options[:protocol] == :request
|
206
206
|
return unless host
|
207
207
|
|
208
208
|
if host =~ URI_REGEXP
|
@@ -14,81 +14,81 @@ module ActionView
|
|
14
14
|
#
|
15
15
|
# * <tt>:include_blank</tt> - set to true or a prompt string if the first option element of the select element is a blank. Useful if there is not a default value required for the select element.
|
16
16
|
#
|
17
|
-
#
|
17
|
+
# select("post", "category", Post::CATEGORIES, {include_blank: true})
|
18
18
|
#
|
19
|
-
#
|
19
|
+
# could become:
|
20
20
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
21
|
+
# <select name="post[category]">
|
22
|
+
# <option></option>
|
23
|
+
# <option>joke</option>
|
24
|
+
# <option>poem</option>
|
25
|
+
# </select>
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Another common case is a select tag for a <tt>belongs_to</tt>-associated object.
|
28
28
|
#
|
29
|
-
#
|
29
|
+
# Example with <tt>@post.person_id => 2</tt>:
|
30
30
|
#
|
31
|
-
#
|
31
|
+
# select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: 'None'})
|
32
32
|
#
|
33
|
-
#
|
33
|
+
# could become:
|
34
34
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
35
|
+
# <select name="post[person_id]">
|
36
|
+
# <option value="">None</option>
|
37
|
+
# <option value="1">David</option>
|
38
|
+
# <option value="2" selected="selected">Sam</option>
|
39
|
+
# <option value="3">Tobias</option>
|
40
|
+
# </select>
|
41
41
|
#
|
42
42
|
# * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this prepends an option with a generic prompt -- "Please select" -- or the given prompt string.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {prompt: 'Select Person'})
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# could become:
|
47
47
|
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
48
|
+
# <select name="post[person_id]">
|
49
|
+
# <option value="">Select Person</option>
|
50
|
+
# <option value="1">David</option>
|
51
|
+
# <option value="2">Sam</option>
|
52
|
+
# <option value="3">Tobias</option>
|
53
|
+
# </select>
|
54
54
|
#
|
55
|
-
#
|
56
|
-
#
|
55
|
+
# * <tt>:index</tt> - like the other form helpers, +select+ can accept an <tt>:index</tt> option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this
|
56
|
+
# option to be in the +html_options+ parameter.
|
57
57
|
#
|
58
|
-
#
|
58
|
+
# select("album[]", "genre", %w[rap rock country], {}, { index: nil })
|
59
59
|
#
|
60
|
-
#
|
60
|
+
# becomes:
|
61
61
|
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
62
|
+
# <select name="album[][genre]" id="album__genre">
|
63
|
+
# <option value="rap">rap</option>
|
64
|
+
# <option value="rock">rock</option>
|
65
|
+
# <option value="country">country</option>
|
66
|
+
# </select>
|
67
67
|
#
|
68
68
|
# * <tt>:disabled</tt> - can be a single value or an array of values that will be disabled options in the final output.
|
69
69
|
#
|
70
|
-
#
|
70
|
+
# select("post", "category", Post::CATEGORIES, {disabled: 'restricted'})
|
71
71
|
#
|
72
|
-
#
|
72
|
+
# could become:
|
73
73
|
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
74
|
+
# <select name="post[category]">
|
75
|
+
# <option></option>
|
76
|
+
# <option>joke</option>
|
77
|
+
# <option>poem</option>
|
78
|
+
# <option disabled="disabled">restricted</option>
|
79
|
+
# </select>
|
80
80
|
#
|
81
|
-
#
|
81
|
+
# When used with the <tt>collection_select</tt> helper, <tt>:disabled</tt> can also be a Proc that identifies those options that should be disabled.
|
82
82
|
#
|
83
|
-
#
|
83
|
+
# collection_select(:post, :category_id, Category.all, :id, :name, {disabled: lambda{|category| category.archived? }})
|
84
84
|
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
85
|
+
# If the categories "2008 stuff" and "Christmas" return true when the method <tt>archived?</tt> is called, this would return:
|
86
|
+
# <select name="post[category_id]">
|
87
|
+
# <option value="1" disabled="disabled">2008 stuff</option>
|
88
|
+
# <option value="2" disabled="disabled">Christmas</option>
|
89
|
+
# <option value="3">Jokes</option>
|
90
|
+
# <option value="4">Poems</option>
|
91
|
+
# </select>
|
92
92
|
#
|
93
93
|
module FormOptionsHelper
|
94
94
|
# ERB::Util can mask some helpers like textilize. Make sure to include them.
|
@@ -152,11 +152,9 @@ module ActionView
|
|
152
152
|
# To prevent this the helper generates an auxiliary hidden field before
|
153
153
|
# every multiple select. The hidden field has the same name as multiple select and blank value.
|
154
154
|
#
|
155
|
-
#
|
156
|
-
# the deselected multiple select box), or both fields.
|
157
|
-
#
|
158
|
-
# form, and parameters extraction gets the last occurrence of any repeated
|
159
|
-
# key in the query string, that works for ordinary forms.
|
155
|
+
# <b>Note:</b> The client either sends only the hidden field (representing
|
156
|
+
# the deselected multiple select box), or both fields. This means that the resulting array
|
157
|
+
# always contains a blank string.
|
160
158
|
#
|
161
159
|
# In case if you don't want the helper to generate this hidden field you can specify
|
162
160
|
# <tt>include_hidden: false</tt> option.
|
@@ -463,21 +461,7 @@ module ActionView
|
|
463
461
|
end
|
464
462
|
|
465
463
|
# Returns a string of <tt><option></tt> tags, like <tt>options_for_select</tt>, but
|
466
|
-
# wraps them with <tt><optgroup></tt> tags
|
467
|
-
#
|
468
|
-
# Parameters:
|
469
|
-
# * +grouped_options+ - Accepts a nested array or hash of strings. The first value serves as the
|
470
|
-
# <tt><optgroup></tt> label while the second value must be an array of options. The second value can be a
|
471
|
-
# nested array of text-value pairs. See <tt>options_for_select</tt> for more info.
|
472
|
-
# Ex. ["North America",[["United States","US"],["Canada","CA"]]]
|
473
|
-
# * +selected_key+ - A value equal to the +value+ attribute for one of the <tt><option></tt> tags,
|
474
|
-
# which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options
|
475
|
-
# as you might have the same option in multiple groups. Each will then get <tt>selected="selected"</tt>.
|
476
|
-
#
|
477
|
-
# Options:
|
478
|
-
# * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this
|
479
|
-
# prepends an option with a generic prompt - "Please select" - or the given prompt string.
|
480
|
-
# * <tt>:divider</tt> - the divider for the options groups.
|
464
|
+
# wraps them with <tt><optgroup></tt> tags:
|
481
465
|
#
|
482
466
|
# grouped_options = [
|
483
467
|
# ['North America',
|
@@ -504,22 +488,36 @@ module ActionView
|
|
504
488
|
# <option value="France">France</option>
|
505
489
|
# </optgroup>
|
506
490
|
#
|
507
|
-
#
|
508
|
-
#
|
509
|
-
#
|
510
|
-
#
|
511
|
-
#
|
491
|
+
# Parameters:
|
492
|
+
# * +grouped_options+ - Accepts a nested array or hash of strings. The first value serves as the
|
493
|
+
# <tt><optgroup></tt> label while the second value must be an array of options. The second value can be a
|
494
|
+
# nested array of text-value pairs. See <tt>options_for_select</tt> for more info.
|
495
|
+
# Ex. ["North America",[["United States","US"],["Canada","CA"]]]
|
496
|
+
# * +selected_key+ - A value equal to the +value+ attribute for one of the <tt><option></tt> tags,
|
497
|
+
# which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options
|
498
|
+
# as you might have the same option in multiple groups. Each will then get <tt>selected="selected"</tt>.
|
512
499
|
#
|
513
|
-
#
|
514
|
-
#
|
515
|
-
#
|
516
|
-
#
|
517
|
-
#
|
518
|
-
#
|
519
|
-
#
|
520
|
-
#
|
521
|
-
#
|
522
|
-
#
|
500
|
+
# Options:
|
501
|
+
# * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this
|
502
|
+
# prepends an option with a generic prompt - "Please select" - or the given prompt string.
|
503
|
+
# * <tt>:divider</tt> - the divider for the options groups.
|
504
|
+
#
|
505
|
+
# grouped_options = [
|
506
|
+
# [['United States','US'], 'Canada'],
|
507
|
+
# ['Denmark','Germany','France']
|
508
|
+
# ]
|
509
|
+
# grouped_options_for_select(grouped_options, nil, divider: '---------')
|
510
|
+
#
|
511
|
+
# Possible output:
|
512
|
+
# <optgroup label="---------">
|
513
|
+
# <option value="US">United States</option>
|
514
|
+
# <option value="Canada">Canada</option>
|
515
|
+
# </optgroup>
|
516
|
+
# <optgroup label="---------">
|
517
|
+
# <option value="Denmark">Denmark</option>
|
518
|
+
# <option value="Germany">Germany</option>
|
519
|
+
# <option value="France">France</option>
|
520
|
+
# </optgroup>
|
523
521
|
#
|
524
522
|
# <b>Note:</b> Only the <tt><optgroup></tt> and <tt><option></tt> tags are returned, so you still have to
|
525
523
|
# wrap the output in an appropriate <tt><select></tt> tag.
|
@@ -48,7 +48,7 @@ module ActionView
|
|
48
48
|
# Change allowed default attributes
|
49
49
|
#
|
50
50
|
# class Application < Rails::Application
|
51
|
-
# config.action_view.sanitized_allowed_attributes = 'id', 'class', 'style'
|
51
|
+
# config.action_view.sanitized_allowed_attributes = ['id', 'class', 'style']
|
52
52
|
# end
|
53
53
|
#
|
54
54
|
# Please note that sanitizing user-provided text does not guarantee that the
|
@@ -204,7 +204,7 @@ module ActionView
|
|
204
204
|
# Adds to the Set of allowed HTML attributes for the +sanitize+ helper.
|
205
205
|
#
|
206
206
|
# class Application < Rails::Application
|
207
|
-
# config.action_view.sanitized_allowed_attributes = 'onclick', 'longdesc'
|
207
|
+
# config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
|
208
208
|
# end
|
209
209
|
#
|
210
210
|
def sanitized_allowed_attributes=(attributes)
|
@@ -3,7 +3,7 @@ module ActionView
|
|
3
3
|
module Tags # :nodoc:
|
4
4
|
class Select < Base # :nodoc:
|
5
5
|
def initialize(object_name, method_name, template_object, choices, options, html_options)
|
6
|
-
@choices = block_given? ? template_object.capture { yield } : choices
|
6
|
+
@choices = block_given? ? template_object.capture { yield || "" } : choices
|
7
7
|
@choices = @choices.to_a if @choices.is_a?(Range)
|
8
8
|
|
9
9
|
@html_options = html_options
|
@@ -2,16 +2,20 @@ namespace :cache_digests do
|
|
2
2
|
desc 'Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)'
|
3
3
|
task :nested_dependencies => :environment do
|
4
4
|
abort 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present?
|
5
|
-
|
6
|
-
format ||= :html
|
7
|
-
puts JSON.pretty_generate ActionView::Digestor.new(template, format, ApplicationController.new.lookup_context).nested_dependencies
|
5
|
+
puts JSON.pretty_generate ActionView::Digestor.new(name: template_name, finder: finder).nested_dependencies
|
8
6
|
end
|
9
7
|
|
10
8
|
desc 'Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)'
|
11
9
|
task :dependencies => :environment do
|
12
10
|
abort 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present?
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
puts JSON.pretty_generate ActionView::Digestor.new(name: template_name, finder: finder).dependencies
|
12
|
+
end
|
13
|
+
|
14
|
+
def template_name
|
15
|
+
ENV['TEMPLATE'].split('.', 2).first
|
16
|
+
end
|
17
|
+
|
18
|
+
def finder
|
19
|
+
ApplicationController.new.lookup_context
|
16
20
|
end
|
17
21
|
end
|
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: 4.1.
|
4
|
+
version: 4.1.6.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: 2014-08-
|
11
|
+
date: 2014-08-19 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: 4.1.
|
19
|
+
version: 4.1.6.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: 4.1.
|
26
|
+
version: 4.1.6.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.1.
|
61
|
+
version: 4.1.6.rc1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.1.
|
68
|
+
version: 4.1.6.rc1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activemodel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.1.
|
75
|
+
version: 4.1.6.rc1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.1.
|
82
|
+
version: 4.1.6.rc1
|
83
83
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
84
84
|
email: david@loudthinking.com
|
85
85
|
executables: []
|
@@ -207,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: 1.9.3
|
208
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
|
-
- - "
|
210
|
+
- - ">"
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version:
|
212
|
+
version: 1.3.1
|
213
213
|
requirements:
|
214
214
|
- none
|
215
215
|
rubyforge_project:
|