actionview 4.2.0.beta4 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3e0b2b933e53444af04ebe433ac0c35aeb5e709
4
- data.tar.gz: 6d88a40b83339917fa89ad355d655e7413f0804a
3
+ metadata.gz: a08668bfc13af2f62c33c8b75748f793f87144f9
4
+ data.tar.gz: 4bec8fd6dbe643188029de41928392d789ffed15
5
5
  SHA512:
6
- metadata.gz: 6e264edd52ab507f2b0f8f5e03a55c3e241d09316eaf072671d14d5ebeb60ed3a48d4cd630062adfe04ae9122d61e3291efe40c249eb2ff7d3260d0a5e2b9f78
7
- data.tar.gz: fe4241fd0423e44d4e4dcd847a05f0780a789744d70d3aa12bd159c464a5fb65d33f5db8d90896b3e53bff7143bbc7c67900e1ac9ef768575a3b1496f29ef95e
6
+ metadata.gz: cd60f4038eb06ccdcd0e51dd7f9c03b1bb4e4a01bb12566e8d5a107d36561a4b84969dc3d30da7b62b86d9b786c364dcfb845e744823a7af3fdc14efeb824638
7
+ data.tar.gz: 090147b2c181337122eb7aa7db83ae800d9b52c09c1e8d9742b1616f23724ef023745393edfb7ab181fadc145b60ef793560aeef5d7689886266170f9341af76
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ * Local variable in a partial is now available even if a falsy value is
2
+ passed to `:object` when rendering a partial.
3
+
4
+ Fixes #17373.
5
+
6
+ *Agis Anastasopoulos*
7
+
8
+ * Add support for `:enforce_utf8` option in `form_for`.
9
+
10
+ This is the same option that was added in 06388b0 to `form_tag` and allows
11
+ users to skip the insertion of the UTF8 enforcer tag in a form.
12
+
13
+ * claudiob *
14
+
15
+ * Fix a bug that <%= foo(){ %> and <%= foo()do %> in view templates were not regarded
16
+ as Ruby block calls.
17
+
18
+ * Akira Matsuda *
19
+
1
20
  * Update `select_tag` to work correctly with `:include_blank` option passing a string.
2
21
 
3
22
  Fixes #16483.
@@ -8,7 +8,7 @@ module ActionView
8
8
  MAJOR = 4
9
9
  MINOR = 2
10
10
  TINY = 0
11
- PRE = "beta4"
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -177,7 +177,7 @@ module ActionView
177
177
  # and +:name+ (string). A format string would be something like "%{name} (%<number>02d)" for example.
178
178
  # See <tt>Kernel.sprintf</tt> for documentation on format sequences.
179
179
  # * <tt>:date_separator</tt> - Specifies a string to separate the date fields. Default is "" (i.e. nothing).
180
- # * <tt>:start_year</tt> - Set the start year for the year select. Default is <tt>Date.today.year - 5</tt>if
180
+ # * <tt>:start_year</tt> - Set the start year for the year select. Default is <tt>Date.today.year - 5</tt> if
181
181
  # you are creating new record. While editing existing record, <tt>:start_year</tt> defaults to
182
182
  # the current selected year minus 5.
183
183
  # * <tt>:end_year</tt> - Set the end year for the year select. Default is <tt>Date.today.year + 5</tt> if
@@ -164,6 +164,23 @@ module ActionView
164
164
  # * <tt>:namespace</tt> - A namespace for your form to ensure uniqueness of
165
165
  # id attributes on form elements. The namespace attribute will be prefixed
166
166
  # with underscore on the generated HTML id.
167
+ # * <tt>:method</tt> - The method to use when submitting the form, usually
168
+ # either "get" or "post". If "patch", "put", "delete", or another verb
169
+ # is used, a hidden input with name <tt>_method</tt> is added to
170
+ # simulate the verb over post.
171
+ # * <tt>:authenticity_token</tt> - Authenticity token to use in the form.
172
+ # Use only if you need to pass custom authenticity token string, or to
173
+ # not add authenticity_token field at all (by passing <tt>false</tt>).
174
+ # Remote forms may omit the embedded authenticity token by setting
175
+ # <tt>config.action_view.embed_authenticity_token_in_remote_forms = false</tt>.
176
+ # This is helpful when you're fragment-caching the form. Remote forms
177
+ # get the authenticity token from the <tt>meta</tt> tag, so embedding is
178
+ # unnecessary unless you support browsers without JavaScript.
179
+ # * <tt>:remote</tt> - If set to true, will allow the Unobtrusive
180
+ # JavaScript drivers to control the submit behavior. By default this
181
+ # behavior is an ajax submit.
182
+ # * <tt>:enforce_utf8</tt> - If set to false, a hidden input with name
183
+ # utf8 is not output.
167
184
  # * <tt>:html</tt> - Optional HTML attributes for the form tag.
168
185
  #
169
186
  # Also note that +form_for+ doesn't create an exclusive scope. It's still
@@ -420,6 +437,7 @@ module ActionView
420
437
  html_options[:data] = options.delete(:data) if options.has_key?(:data)
421
438
  html_options[:remote] = options.delete(:remote) if options.has_key?(:remote)
422
439
  html_options[:method] = options.delete(:method) if options.has_key?(:method)
440
+ html_options[:enforce_utf8] = options.delete(:enforce_utf8) if options.has_key?(:enforce_utf8)
423
441
  html_options[:authenticity_token] = options.delete(:authenticity_token)
424
442
 
425
443
  builder = instantiate_builder(object_name, object, options)
@@ -140,7 +140,9 @@ module ActionView
140
140
  include_blank = ''
141
141
  end
142
142
 
143
- option_tags = content_tag(:option, include_blank, value: '').safe_concat(option_tags)
143
+ if include_blank
144
+ option_tags = content_tag(:option, include_blank, value: '').safe_concat(option_tags)
145
+ end
144
146
  end
145
147
 
146
148
  if prompt = options.delete(:prompt)
@@ -123,7 +123,7 @@ module ActionView
123
123
  # cdata_section("hello]]>world")
124
124
  # # => <![CDATA[hello]]]]><![CDATA[>world]]>
125
125
  def cdata_section(content)
126
- splitted = content.to_s.gsub(']]>', ']]]]><![CDATA[>')
126
+ splitted = content.to_s.gsub(/\]\]\>/, ']]]]><![CDATA[>')
127
127
  "<![CDATA[#{splitted}]]>".html_safe
128
128
  end
129
129
 
@@ -25,7 +25,7 @@ module ActionView
25
25
  private
26
26
 
27
27
  def value(object)
28
- object.send @method_name if object
28
+ object.public_send @method_name if object
29
29
  end
30
30
 
31
31
  def value_before_type_cast(object)
@@ -366,10 +366,12 @@ module ActionView
366
366
  partial = options[:partial]
367
367
 
368
368
  if String === partial
369
+ @has_object = options.key?(:object)
369
370
  @object = options[:object]
370
371
  @collection = collection_from_options
371
372
  @path = partial
372
373
  else
374
+ @has_object = true
373
375
  @object = partial
374
376
  @collection = collection_from_object || collection_from_options
375
377
 
@@ -506,7 +508,7 @@ module ActionView
506
508
 
507
509
  def retrieve_template_keys
508
510
  keys = @locals.keys
509
- keys << @variable if @object || @collection
511
+ keys << @variable if @has_object || @collection
510
512
  if @collection
511
513
  keys << @variable_counter
512
514
  keys << @variable_iteration
@@ -35,13 +35,13 @@ module ActionView
35
35
  module ClassMethods
36
36
  def view_context_class
37
37
  @view_context_class ||= begin
38
- include_path_helpers = supports_path?
38
+ supports_path = supports_path?
39
39
  routes = respond_to?(:_routes) && _routes
40
40
  helpers = respond_to?(:_helpers) && _helpers
41
41
 
42
42
  Class.new(ActionView::Base) do
43
43
  if routes
44
- include routes.url_helpers(include_path_helpers)
44
+ include routes.url_helpers(supports_path)
45
45
  include routes.mounted_helpers
46
46
  end
47
47
 
@@ -80,21 +80,38 @@ module ActionView
80
80
  when String
81
81
  options
82
82
  when nil
83
- super({:only_path => true})
83
+ super(only_path: _generate_paths_by_default)
84
84
  when Hash
85
85
  options = options.symbolize_keys
86
- options[:only_path] = options[:host].nil? unless options.key?(:only_path)
86
+ unless options.key?(:only_path)
87
+ if options[:host].nil?
88
+ options[:only_path] = _generate_paths_by_default
89
+ else
90
+ options[:only_path] = false
91
+ end
92
+ end
93
+
87
94
  super(options)
88
95
  when :back
89
96
  _back_url
90
- when Symbol
91
- ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_string_call self, options
92
97
  when Array
93
- polymorphic_path(options, options.extract_options!)
94
- when Class
95
- ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_class_call self, options
98
+ if _generate_paths_by_default
99
+ polymorphic_path(options, options.extract_options!)
100
+ else
101
+ polymorphic_url(options, options.extract_options!)
102
+ end
96
103
  else
97
- ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_model_call self, options
104
+ method = _generate_paths_by_default ? :path : :url
105
+ builder = ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.send(method)
106
+
107
+ case options
108
+ when Symbol
109
+ builder.handle_string_call(self, options)
110
+ when Class
111
+ builder.handle_class_call(self, options)
112
+ else
113
+ builder.handle_model_call(self, options)
114
+ end
98
115
  end
99
116
  end
100
117
 
@@ -22,7 +22,7 @@ module ActionView #:nodoc:
22
22
 
23
23
  # Register an object that knows how to handle template files with the given
24
24
  # extensions. This can be used to implement new template types.
25
- # The handler must respond to `:call`, which will be passed the template
25
+ # The handler must respond to +:call+, which will be passed the template
26
26
  # and should return the rendered template as a String.
27
27
  def register_template_handler(*extensions, handler)
28
28
  raise(ArgumentError, "Extension is required") if extensions.empty?
@@ -35,7 +35,7 @@ module ActionView
35
35
  end
36
36
  end
37
37
 
38
- BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
38
+ BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
39
39
 
40
40
  def add_expr_literal(src, code)
41
41
  flush_newline_if_pending(src)
@@ -2,7 +2,7 @@ module ActionView
2
2
  module Template::Handlers
3
3
  class Raw
4
4
  def call(template)
5
- escaped = template.source.gsub(':', '\:')
5
+ escaped = template.source.gsub(/:/, '\:')
6
6
 
7
7
  '%q:' + escaped + ':;'
8
8
  end
@@ -125,6 +125,7 @@ module ActionView
125
125
  @_rendered_views ||= RenderedViewsCollection.new
126
126
  end
127
127
 
128
+ # Need to experiment if this priority is the best one: rendered => output_buffer
128
129
  class RenderedViewsCollection
129
130
  def initialize
130
131
  @rendered_views ||= Hash.new { |hash, key| hash[key] = [] }
@@ -158,7 +159,7 @@ module ActionView
158
159
 
159
160
  # Need to experiment if this priority is the best one: rendered => output_buffer
160
161
  def document_root_element
161
- Nokogiri::HTML::DocumentFragment.parse(@rendered.blank? ? @output_buffer : @rendered)
162
+ Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer : @rendered).root
162
163
  end
163
164
 
164
165
  def say_no_to_protect_against_forgery!
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.2.0.beta4
4
+ version: 4.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: 2014-10-30 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,110 +16,110 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0.beta4
19
+ version: 4.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: 4.2.0.beta4
26
+ version: 4.2.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erubis
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.7.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rails-html-sanitizer
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.0'
62
- - - '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: 1.0.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ~>
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: '1.0'
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 1.0.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rails-dom-testing
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ~>
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.0'
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 1.0.4
84
+ version: 1.0.5
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ~>
89
+ - - "~>"
90
90
  - !ruby/object:Gem::Version
91
91
  version: '1.0'
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 1.0.4
94
+ version: 1.0.5
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: actionpack
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 4.2.0.beta4
101
+ version: 4.2.0.rc1
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 4.2.0.beta4
108
+ version: 4.2.0.rc1
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: activemodel
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 4.2.0.beta4
115
+ version: 4.2.0.rc1
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 4.2.0.beta4
122
+ version: 4.2.0.rc1
123
123
  description: Simple, battle-tested conventions and helpers for building web pages.
124
124
  email: david@loudthinking.com
125
125
  executables: []
@@ -236,18 +236,18 @@ require_paths:
236
236
  - lib
237
237
  required_ruby_version: !ruby/object:Gem::Requirement
238
238
  requirements:
239
- - - '>='
239
+ - - ">="
240
240
  - !ruby/object:Gem::Version
241
241
  version: 1.9.3
242
242
  required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  requirements:
244
- - - '>'
244
+ - - ">"
245
245
  - !ruby/object:Gem::Version
246
246
  version: 1.3.1
247
247
  requirements:
248
248
  - none
249
249
  rubyforge_project:
250
- rubygems_version: 2.2.1
250
+ rubygems_version: 2.2.2
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Rendering framework putting the V in MVC (part of Rails).