actionview 5.0.0.rc1 → 5.0.0.rc2

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: 18a90de0809651abe647f6226ad50a18a850dd74
4
- data.tar.gz: 5efd67dfbbaef15c7a8b9924dc75649c050b178b
3
+ metadata.gz: e8b3721ce2507d7b9067da855ad90f146cee478c
4
+ data.tar.gz: 3b1ac62c559fa959bb7d23a5d37e489236c735af
5
5
  SHA512:
6
- metadata.gz: 3e49e650795fc92a4a1b172e367c9e6a91e94b65de26e22194f3e504375cbb30f26cbd6fb1a9b84936560cb79e2cfb10c89b4cc7a77b42d4bbb4385cbe95032c
7
- data.tar.gz: bc8f526cabd17074af1ce3665850f7da7f431b8ac842237cdbfc4f5831a89d86c5a544e38e260e44549b96bcbbe68ca6fe541e57378ca879dc88c963e67683e2
6
+ metadata.gz: 1780255cdb54fe0685814e5104a5faf7bde16ffb7cba4fd07abc4033e82c386bd2d63011bc7a398493f399f7fc0291490f0f5a5bdc428dcf30c11a3be444332d
7
+ data.tar.gz: c6596a1577f814cca03c60680acf688e211f5c36e6e9503a86700f9f47d351e6841dc33531831bc14d499ea79bbd9e3ebee8bb76e42521e840acb4f994a94d43
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## Rails 5.0.0.rc2 (June 22, 2016) ##
2
+
3
+ * Change `datetime_field` and `datetime_field_tag` to generate `datetime-local` fields.
4
+
5
+ As a new specification of the HTML 5 the text field type `datetime` will no longer exist
6
+ and it is recomended to use `datetime-local`.
7
+ Ref: https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)
8
+
9
+ *Herminio Torres*
10
+
11
+ * Raw template handler (which is also the default template handler in Rails 5) now outputs
12
+ HTML-safe strings.
13
+
14
+ In Rails 5 the default template handler was changed to the raw template handler. Because
15
+ the ERB template handler escaped strings by default this broke some applications that
16
+ expected plain JS or HTML files to be rendered unescaped. This fixes the issue caused
17
+ by changing the default handler by changing the Raw template handler to output HTML-safe
18
+ strings.
19
+
20
+ *Eileen M. Uchitelle*
21
+
22
+ * `select_tag`'s `include_blank` option for generation for blank option tag, now adds an empty space label,
23
+ when the value as well as content for option tag are empty, so that we confirm with html specification.
24
+ Ref: https://www.w3.org/TR/html5/forms.html#the-option-element.
25
+
26
+ Generation of option before:
27
+
28
+ ```html
29
+ <option value=""></option>
30
+ ```
31
+
32
+ Generation of option after:
33
+
34
+ ```html
35
+ <option value="" label=" "></option>
36
+ ```
37
+
38
+ *Vipul A M *
39
+
40
+
1
41
  ## Rails 5.0.0.rc1 (May 06, 2016) ##
2
42
 
3
43
  * No changes.
@@ -25,12 +65,6 @@
25
65
 
26
66
  *Neil Matatall*
27
67
 
28
- * Deprecate `datetime_field` and `datetime_field_tag` helpers.
29
- Datetime input type was removed from HTML specification.
30
- One can use `datetime_local_field` and `datetime_local_field_tag` instead.
31
-
32
- *Wojciech Wnętrzak*
33
-
34
68
  * Added log "Rendering ...", when starting to render a template to log that
35
69
  we have started rendering something. This helps to easily identify the origin
36
70
  of queries in the log whether they came from controller or views.
@@ -314,6 +348,10 @@
314
348
 
315
349
  *Mauro George*
316
350
 
351
+ * Add support for Reply-To field in `mail_to` helper.
352
+
353
+ *Mark Dodwell*
354
+
317
355
  * Add an explicit error message, in `ActionView::PartialRenderer` for partial
318
356
  `rendering`, when the value of option `as` has invalid characters.
319
357
 
@@ -6,13 +6,6 @@ module ActionView
6
6
  class Digestor
7
7
  @@digest_mutex = Mutex.new
8
8
 
9
- class PerRequestDigestCacheExpiry < Struct.new(:app) # :nodoc:
10
- def call(env)
11
- ActionView::LookupContext::DetailsKey.clear
12
- app.call(env)
13
- end
14
- end
15
-
16
9
  class << self
17
10
  # Supported options:
18
11
  #
@@ -22,7 +15,7 @@ module ActionView
22
15
  # * <tt>partial</tt> - Specifies whether the template is a partial
23
16
  def digest(name:, finder:, dependencies: [])
24
17
  dependencies ||= []
25
- cache_key = ([ name ].compact + dependencies).join('.')
18
+ cache_key = [ name, finder.rendered_format, dependencies ].flatten.compact.join('.')
26
19
 
27
20
  # this is a correctly done double-checked locking idiom
28
21
  # (Concurrent::Map's lookups have volatile semantics)
@@ -46,8 +39,12 @@ module ActionView
46
39
  def tree(name, finder, partial = false, seen = {})
47
40
  logical_name = name.gsub(%r|/_|, "/")
48
41
 
49
- if finder.disable_cache { finder.exists?(logical_name, [], partial) }
50
- template = finder.disable_cache { finder.find(logical_name, [], partial) }
42
+ options = {}
43
+ options[:formats] = [finder.rendered_format] if finder.rendered_format
44
+
45
+ if finder.disable_cache { finder.exists?(logical_name, [], partial, [], options) }
46
+ template = finder.disable_cache { finder.find(logical_name, [], partial, [], options) }
47
+ finder.rendered_format ||= template.formats.first
51
48
 
52
49
  if node = seen[template.identifier] # handle cycles in the tree
53
50
  node
@@ -8,7 +8,7 @@ module ActionView
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "rc1"
11
+ PRE = "rc2"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -3,6 +3,7 @@ require 'action_view/helpers/tag_helper'
3
3
  require 'active_support/core_ext/array/extract_options'
4
4
  require 'active_support/core_ext/date/conversions'
5
5
  require 'active_support/core_ext/hash/slice'
6
+ require 'active_support/core_ext/object/acts_like'
6
7
  require 'active_support/core_ext/object/with_options'
7
8
 
8
9
  module ActionView
@@ -860,24 +860,6 @@ module ActionView
860
860
  #
861
861
  # file_field(:attachment, :file, class: 'file_input')
862
862
  # # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
863
- #
864
- # ==== Gotcha
865
- #
866
- # The HTML specification says that when a file field is empty, web browsers
867
- # do not send any value to the server. Unfortunately this introduces a
868
- # gotcha: if a +User+ model has an +avatar+ field, and no file is selected,
869
- # then the +avatar+ parameter is empty. Thus, any mass-assignment idiom like
870
- #
871
- # @user.update(params[:user])
872
- #
873
- # wouldn't update the +avatar+ field.
874
- #
875
- # To prevent this, the helper generates an auxiliary hidden field before
876
- # every file field. The hidden field has the same name as the file one and
877
- # a blank value.
878
- #
879
- # In case you don't want the helper to generate this hidden field you can
880
- # specify the <tt>include_hidden: false</tt> option.
881
863
  def file_field(object_name, method, options = {})
882
864
  Tags::FileField.new(object_name, method, self, options).render
883
865
  end
@@ -1092,42 +1074,9 @@ module ActionView
1092
1074
  Tags::TimeField.new(object_name, method, self, options).render
1093
1075
  end
1094
1076
 
1095
- # Returns a text_field of type "datetime".
1096
- #
1097
- # datetime_field("user", "born_on")
1098
- # # => <input id="user_born_on" name="user[born_on]" type="datetime" />
1099
- #
1100
- # The default value is generated by trying to call +strftime+ with "%Y-%m-%dT%T.%L%z"
1101
- # on the object's value, which makes it behave as expected for instances
1102
- # of DateTime and ActiveSupport::TimeWithZone.
1103
- #
1104
- # @user.born_on = Date.new(1984, 1, 12)
1105
- # datetime_field("user", "born_on")
1106
- # # => <input id="user_born_on" name="user[born_on]" type="datetime" value="1984-01-12T00:00:00.000+0000" />
1107
- #
1108
- # You can create values for the "min" and "max" attributes by passing
1109
- # instances of Date or Time to the options hash.
1110
- #
1111
- # datetime_field("user", "born_on", min: Date.today)
1112
- # # => <input id="user_born_on" name="user[born_on]" type="datetime" min="2014-05-20T00:00:00.000+0000" />
1113
- #
1114
- # Alternatively, you can pass a String formatted as an ISO8601 datetime
1115
- # with UTC offset as the values for "min" and "max."
1116
- #
1117
- # datetime_field("user", "born_on", min: "2014-05-20T00:00:00+0000")
1118
- # # => <input id="user_born_on" name="user[born_on]" type="datetime" min="2014-05-20T00:00:00.000+0000" />
1119
- #
1120
- def datetime_field(object_name, method, options = {})
1121
- ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
1122
- datetime_field is deprecated and will be removed in Rails 5.1.
1123
- Use datetime_local_field instead.
1124
- MESSAGE
1125
- Tags::DatetimeField.new(object_name, method, self, options).render
1126
- end
1127
-
1128
1077
  # Returns a text_field of type "datetime-local".
1129
1078
  #
1130
- # datetime_local_field("user", "born_on")
1079
+ # datetime_field("user", "born_on")
1131
1080
  # # => <input id="user_born_on" name="user[born_on]" type="datetime-local" />
1132
1081
  #
1133
1082
  # The default value is generated by trying to call +strftime+ with "%Y-%m-%dT%T"
@@ -1135,25 +1084,27 @@ module ActionView
1135
1084
  # of DateTime and ActiveSupport::TimeWithZone.
1136
1085
  #
1137
1086
  # @user.born_on = Date.new(1984, 1, 12)
1138
- # datetime_local_field("user", "born_on")
1087
+ # datetime_field("user", "born_on")
1139
1088
  # # => <input id="user_born_on" name="user[born_on]" type="datetime-local" value="1984-01-12T00:00:00" />
1140
1089
  #
1141
1090
  # You can create values for the "min" and "max" attributes by passing
1142
1091
  # instances of Date or Time to the options hash.
1143
1092
  #
1144
- # datetime_local_field("user", "born_on", min: Date.today)
1093
+ # datetime_field("user", "born_on", min: Date.today)
1145
1094
  # # => <input id="user_born_on" name="user[born_on]" type="datetime-local" min="2014-05-20T00:00:00.000" />
1146
1095
  #
1147
1096
  # Alternatively, you can pass a String formatted as an ISO8601 datetime as
1148
1097
  # the values for "min" and "max."
1149
1098
  #
1150
- # datetime_local_field("user", "born_on", min: "2014-05-20T00:00:00")
1099
+ # datetime_field("user", "born_on", min: "2014-05-20T00:00:00")
1151
1100
  # # => <input id="user_born_on" name="user[born_on]" type="datetime-local" min="2014-05-20T00:00:00.000" />
1152
1101
  #
1153
- def datetime_local_field(object_name, method, options = {})
1102
+ def datetime_field(object_name, method, options = {})
1154
1103
  Tags::DatetimeLocalField.new(object_name, method, self, options).render
1155
1104
  end
1156
1105
 
1106
+ alias datetime_local_field datetime_field
1107
+
1157
1108
  # Returns a text_field of type "month".
1158
1109
  #
1159
1110
  # month_field("user", "born_on")
@@ -134,13 +134,15 @@ module ActionView
134
134
 
135
135
  if options.include?(:include_blank)
136
136
  include_blank = options.delete(:include_blank)
137
+ options_for_blank_options_tag = { value: '' }
137
138
 
138
139
  if include_blank == true
139
140
  include_blank = ''
141
+ options_for_blank_options_tag[:label] = ' '
140
142
  end
141
143
 
142
144
  if include_blank
143
- option_tags = content_tag("option".freeze, include_blank, value: '').safe_concat(option_tags)
145
+ option_tags = content_tag("option".freeze, include_blank, options_for_blank_options_tag).safe_concat(option_tags)
144
146
  end
145
147
  end
146
148
 
@@ -683,21 +685,6 @@ module ActionView
683
685
  text_field_tag(name, value, options.merge(type: :time))
684
686
  end
685
687
 
686
- # Creates a text field of type "datetime".
687
- #
688
- # === Options
689
- # * <tt>:min</tt> - The minimum acceptable value.
690
- # * <tt>:max</tt> - The maximum acceptable value.
691
- # * <tt>:step</tt> - The acceptable value granularity.
692
- # * Otherwise accepts the same options as text_field_tag.
693
- def datetime_field_tag(name, value = nil, options = {})
694
- ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
695
- datetime_field_tag is deprecated and will be removed in Rails 5.1.
696
- Use datetime_local_field_tag instead.
697
- MESSAGE
698
- text_field_tag(name, value, options.merge(type: :datetime))
699
- end
700
-
701
688
  # Creates a text field of type "datetime-local".
702
689
  #
703
690
  # === Options
@@ -705,10 +692,12 @@ module ActionView
705
692
  # * <tt>:max</tt> - The maximum acceptable value.
706
693
  # * <tt>:step</tt> - The acceptable value granularity.
707
694
  # * Otherwise accepts the same options as text_field_tag.
708
- def datetime_local_field_tag(name, value = nil, options = {})
695
+ def datetime_field_tag(name, value = nil, options = {})
709
696
  text_field_tag(name, value, options.merge(type: 'datetime-local'))
710
697
  end
711
698
 
699
+ alias datetime_local_field_tag datetime_field_tag
700
+
712
701
  # Creates a text field of type "month".
713
702
  #
714
703
  # === Options
@@ -14,7 +14,7 @@ module ActionView
14
14
  private
15
15
 
16
16
  def format_date(value)
17
- value.try(:strftime, "%Y-%m-%dT%T.%L%z")
17
+ raise NoImplementedError
18
18
  end
19
19
 
20
20
  def datetime_value(value)
@@ -2,21 +2,6 @@ module ActionView
2
2
  module Helpers
3
3
  module Tags # :nodoc:
4
4
  class FileField < TextField # :nodoc:
5
-
6
- def render
7
- options = @options.stringify_keys
8
-
9
- if options.fetch("include_hidden", true)
10
- add_default_name_and_id(options)
11
- options[:type] = "file"
12
- tag("input", name: options["name"], type: "hidden", value: "") + tag("input", options)
13
- else
14
- options.delete("include_hidden")
15
- @options = options
16
-
17
- super
18
- end
19
- end
20
5
  end
21
6
  end
22
7
  end
@@ -40,7 +40,7 @@ module ActionView
40
40
  initializer "action_view.per_request_digest_cache" do |app|
41
41
  ActiveSupport.on_load(:action_view) do
42
42
  if app.config.consider_all_requests_local
43
- app.middleware.use ActionView::Digestor::PerRequestDigestCacheExpiry
43
+ app.executor.to_run { ActionView::LookupContext::DetailsKey.clear }
44
44
  end
45
45
  end
46
46
  end
@@ -2,7 +2,7 @@ module ActionView
2
2
  module Template::Handlers
3
3
  class Raw
4
4
  def call(template)
5
- "#{template.source.inspect};"
5
+ "#{template.source.inspect}.html_safe;"
6
6
  end
7
7
  end
8
8
  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: 5.0.0.rc1
4
+ version: 5.0.0.rc2
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: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-06-22 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.0.0.rc1
19
+ version: 5.0.0.rc2
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.0.0.rc1
26
+ version: 5.0.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 5.0.0.rc1
101
+ version: 5.0.0.rc2
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: 5.0.0.rc1
108
+ version: 5.0.0.rc2
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: 5.0.0.rc1
115
+ version: 5.0.0.rc2
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: 5.0.0.rc1
122
+ version: 5.0.0.rc2
123
123
  description: Simple, battle-tested conventions and helpers for building web pages.
124
124
  email: david@loudthinking.com
125
125
  executables: []
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
251
  - none
252
252
  rubyforge_project:
253
- rubygems_version: 2.5.1
253
+ rubygems_version: 2.6.4
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: Rendering framework putting the V in MVC (part of Rails).