actionview 4.1.9 → 4.1.10.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: d79f805ea337057963332f86f983b377c43f9de0
4
- data.tar.gz: 60ddd556932d6f8d4eb261c5f3e27470acd7e8f6
3
+ metadata.gz: f519bc2fe4ea87f06956ee790b78166b2428c466
4
+ data.tar.gz: 05d733dde5fe30b217e69f637af9ecaa00f01fc8
5
5
  SHA512:
6
- metadata.gz: c11edfa72b5ec83e6f8d502dc40bbb153613a5c953d753ecfa1824d5e9341633ddbadca517763928fd6df0cfafdf82468731c80470fb0a9920ac3969d9f86ae1
7
- data.tar.gz: f1f625e84ce04682a190ade2bc922f7a9ca1f1ab7118c0ffff8d52189b78fe1289a7cf064417804c632c05a631345d6c79a8a026997c8a59183402db147b5788
6
+ metadata.gz: 8e61e2bc434ab53eb7bbb1e95b2020cc6a4bfa1b30025e2d3001f2f6fb6b4740e232800a097eb8f02641b90944a52df99c54090285b36c70b84809692e611c97
7
+ data.tar.gz: acf73d80fc7ab89c36e4999120d6a62f1904fd60c3c41e3cd6d4b5ad52a138bcf123c2fe2763006337a7c6e24121fcab5b766843aeede458a492deefb30c1f77
@@ -1,3 +1,17 @@
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
+ * Default translations that have a lower precidence than an html safe default,
9
+ but are not themselves safe, should not be marked as html_safe.
10
+
11
+ *Justin Coyne*
12
+
13
+ ## Rails 4.1.9 (January 6, 2015) ##
14
+
1
15
  * Added an explicit error message, in `ActionView::PartialRenderer`
2
16
  for partial `rendering`, when the value of option `as` has invalid characters.
3
17
 
@@ -7,8 +7,8 @@ module ActionView
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 1
10
- TINY = 9
11
- PRE = nil
10
+ TINY = 10
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -1142,11 +1142,11 @@ module ActionView
1142
1142
  object_name = model_name_from_record_or_class(object).param_key
1143
1143
  end
1144
1144
 
1145
- builder = options[:builder] || default_form_builder
1145
+ builder = options[:builder] || default_form_builder_class
1146
1146
  builder.new(object_name, object, self, options)
1147
1147
  end
1148
1148
 
1149
- def default_form_builder
1149
+ def default_form_builder_class
1150
1150
  builder = ActionView::Base.default_form_builder
1151
1151
  builder.respond_to?(:constantize) ? builder.constantize : builder
1152
1152
  end
@@ -35,14 +35,18 @@ module ActionView
35
35
  # naming convention helps to identify translations that include HTML tags so that
36
36
  # you know what kind of output to expect when you call translate in a template.
37
37
  def translate(key, options = {})
38
- options[:default] = wrap_translate_defaults(options[:default]) if options[:default]
38
+ options = options.dup
39
+ remaining_defaults = Array(options.delete(:default))
40
+ options[:default] = remaining_defaults.shift if remaining_defaults.first.kind_of? String
39
41
 
40
- # If the user has specified rescue_format then pass it all through, otherwise use
41
- # raise and do the work ourselves
42
- options[:raise] ||= ActionView::Base.raise_on_missing_translations
43
-
44
- raise_error = options[:raise] || options.key?(:rescue_format)
45
- unless raise_error
42
+ # If the user has explicitly decided to NOT raise errors, pass that option to I18n.
43
+ # Otherwise, tell I18n to raise an exception, which we rescue further in this method.
44
+ # Note: `raise_error` refers to us re-raising the error in this method. I18n is forced to raise by default.
45
+ if options[:raise] == false || (options.key?(:rescue_format) && options[:rescue_format].nil?)
46
+ raise_error = false
47
+ options[:raise] = false
48
+ else
49
+ raise_error = options[:raise] || options[:rescue_format] || ActionView::Base.raise_on_missing_translations
46
50
  options[:raise] = true
47
51
  end
48
52
 
@@ -60,10 +64,14 @@ module ActionView
60
64
  I18n.translate(scope_key_by_partial(key), options)
61
65
  end
62
66
  rescue I18n::MissingTranslationData => e
63
- raise e if raise_error
67
+ if remaining_defaults.present?
68
+ translate remaining_defaults.shift, options.merge(default: remaining_defaults)
69
+ else
70
+ raise e if raise_error
64
71
 
65
- keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
66
- content_tag('span', keys.last.to_s.titleize, :class => 'translation_missing', :title => "translation missing: #{keys.join('.')}")
72
+ keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
73
+ content_tag('span', keys.last.to_s.titleize, :class => 'translation_missing', :title => "translation missing: #{keys.join('.')}")
74
+ end
67
75
  end
68
76
  alias :t :translate
69
77
 
@@ -92,21 +100,6 @@ module ActionView
92
100
  def html_safe_translation_key?(key)
93
101
  key.to_s =~ /(\b|_|\.)html$/
94
102
  end
95
-
96
- def wrap_translate_defaults(defaults)
97
- new_defaults = []
98
- defaults = Array(defaults)
99
- while key = defaults.shift
100
- if key.is_a?(Symbol)
101
- new_defaults << lambda { |_, options| translate key, options.merge(:default => defaults) }
102
- break
103
- else
104
- new_defaults << key
105
- end
106
- end
107
-
108
- new_defaults
109
- end
110
103
  end
111
104
  end
112
105
  end
@@ -332,7 +332,7 @@ module ActionView
332
332
  prepend_formats(options[:formats])
333
333
 
334
334
  if String === partial
335
- @object = options[:object]
335
+ @object = options[:object] if options.has_key?(:object)
336
336
  @path = partial
337
337
  @collection = collection
338
338
  else
@@ -466,7 +466,7 @@ module ActionView
466
466
 
467
467
  def retrieve_template_keys
468
468
  keys = @locals.keys
469
- keys << @variable if @object || @collection
469
+ keys << @variable if defined?(@object) || @collection
470
470
  keys << @variable_counter if @collection
471
471
  keys
472
472
  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.9
4
+ version: 4.1.10.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: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-02-20 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.9
19
+ version: 4.1.10.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.9
26
+ version: 4.1.10.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.9
61
+ version: 4.1.10.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.9
68
+ version: 4.1.10.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.9
75
+ version: 4.1.10.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.9
82
+ version: 4.1.10.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: '0'
212
+ version: 1.3.1
213
213
  requirements:
214
214
  - none
215
215
  rubyforge_project: