actionpack 4.0.0.beta1 → 4.0.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 actionpack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +195 -11
- data/lib/abstract_controller/base.rb +1 -1
- data/lib/abstract_controller/helpers.rb +2 -2
- data/lib/abstract_controller/layouts.rb +10 -5
- data/lib/abstract_controller/rendering.rb +11 -3
- data/lib/abstract_controller/translation.rb +1 -1
- data/lib/action_controller/log_subscriber.rb +5 -0
- data/lib/action_controller/metal.rb +2 -3
- data/lib/action_controller/metal/force_ssl.rb +52 -17
- data/lib/action_controller/metal/helpers.rb +0 -1
- data/lib/action_controller/metal/hide_actions.rb +1 -1
- data/lib/action_controller/metal/http_authentication.rb +3 -2
- data/lib/action_controller/metal/live.rb +34 -0
- data/lib/action_controller/metal/rendering.rb +1 -1
- data/lib/action_controller/metal/strong_parameters.rb +7 -3
- data/lib/action_controller/test_case.rb +45 -11
- data/lib/action_dispatch.rb +4 -6
- data/lib/action_dispatch/http/cache.rb +2 -2
- data/lib/action_dispatch/http/headers.rb +39 -15
- data/lib/action_dispatch/http/mime_negotiation.rb +1 -1
- data/lib/action_dispatch/http/mime_type.rb +11 -3
- data/lib/action_dispatch/http/parameters.rb +17 -24
- data/lib/action_dispatch/http/request.rb +17 -2
- data/lib/action_dispatch/http/response.rb +2 -1
- data/lib/action_dispatch/http/upload.rb +5 -5
- data/lib/action_dispatch/http/url.rb +53 -12
- data/lib/action_dispatch/journey/formatter.rb +1 -1
- data/lib/action_dispatch/journey/path/pattern.rb +1 -1
- data/lib/action_dispatch/journey/route.rb +8 -0
- data/lib/action_dispatch/journey/router.rb +3 -1
- data/lib/action_dispatch/journey/visitors.rb +8 -0
- data/lib/action_dispatch/middleware/cookies.rb +169 -135
- data/lib/action_dispatch/middleware/exception_wrapper.rb +1 -0
- data/lib/action_dispatch/middleware/remote_ip.rb +2 -2
- data/lib/action_dispatch/middleware/request_id.rb +1 -1
- data/lib/action_dispatch/middleware/session/cookie_store.rb +38 -58
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/_trace.erb +4 -6
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/template_error.erb +1 -1
- data/lib/action_dispatch/routing.rb +28 -64
- data/lib/action_dispatch/routing/mapper.rb +61 -48
- data/lib/action_dispatch/routing/route_set.rb +17 -14
- data/lib/action_dispatch/testing/assertions/routing.rb +2 -2
- data/lib/action_dispatch/testing/assertions/selector.rb +2 -2
- data/lib/action_dispatch/testing/integration.rb +36 -35
- data/lib/action_dispatch/testing/test_process.rb +1 -1
- data/lib/action_pack/version.rb +7 -6
- data/lib/action_view/buffers.rb +6 -0
- data/lib/action_view/dependency_tracker.rb +3 -1
- data/lib/action_view/helpers/asset_tag_helper.rb +13 -8
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- data/lib/action_view/helpers/date_helper.rb +1 -1
- data/lib/action_view/helpers/form_helper.rb +56 -19
- data/lib/action_view/helpers/form_options_helper.rb +3 -3
- data/lib/action_view/helpers/form_tag_helper.rb +1 -1
- data/lib/action_view/helpers/javascript_helper.rb +2 -2
- data/lib/action_view/helpers/number_helper.rb +25 -0
- data/lib/action_view/helpers/tags/base.rb +9 -10
- data/lib/action_view/helpers/tags/check_box.rb +1 -1
- data/lib/action_view/helpers/tags/checkable.rb +2 -2
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +3 -3
- data/lib/action_view/helpers/tags/collection_helpers.rb +3 -3
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -3
- data/lib/action_view/helpers/tags/collection_select.rb +1 -1
- data/lib/action_view/helpers/tags/color_field.rb +2 -2
- data/lib/action_view/helpers/tags/date_field.rb +2 -2
- data/lib/action_view/helpers/tags/date_select.rb +2 -2
- data/lib/action_view/helpers/tags/datetime_field.rb +2 -2
- data/lib/action_view/helpers/tags/datetime_local_field.rb +2 -2
- data/lib/action_view/helpers/tags/datetime_select.rb +2 -2
- data/lib/action_view/helpers/tags/email_field.rb +2 -2
- data/lib/action_view/helpers/tags/file_field.rb +2 -2
- data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
- data/lib/action_view/helpers/tags/hidden_field.rb +2 -2
- data/lib/action_view/helpers/tags/label.rb +2 -2
- data/lib/action_view/helpers/tags/month_field.rb +2 -2
- data/lib/action_view/helpers/tags/number_field.rb +2 -2
- data/lib/action_view/helpers/tags/password_field.rb +2 -2
- data/lib/action_view/helpers/tags/radio_button.rb +2 -2
- data/lib/action_view/helpers/tags/range_field.rb +2 -2
- data/lib/action_view/helpers/tags/search_field.rb +2 -2
- data/lib/action_view/helpers/tags/select.rb +2 -3
- data/lib/action_view/helpers/tags/tel_field.rb +2 -2
- data/lib/action_view/helpers/tags/text_area.rb +2 -2
- data/lib/action_view/helpers/tags/text_field.rb +2 -2
- data/lib/action_view/helpers/tags/time_field.rb +2 -2
- data/lib/action_view/helpers/tags/time_select.rb +2 -2
- data/lib/action_view/helpers/tags/time_zone_select.rb +2 -2
- data/lib/action_view/helpers/tags/url_field.rb +2 -2
- data/lib/action_view/helpers/tags/week_field.rb +2 -2
- data/lib/action_view/helpers/text_helper.rb +8 -5
- data/lib/action_view/helpers/url_helper.rb +18 -6
- data/lib/action_view/lookup_context.rb +7 -1
- data/lib/action_view/path_set.rb +6 -0
- data/lib/action_view/renderer/abstract_renderer.rb +15 -0
- data/lib/action_view/renderer/partial_renderer.rb +14 -0
- data/lib/action_view/renderer/renderer.rb +6 -0
- data/lib/action_view/template.rb +3 -2
- data/lib/action_view/template/handlers/erb.rb +29 -3
- data/lib/action_view/template/resolver.rb +3 -3
- data/lib/action_view/test_case.rb +1 -0
- data/lib/action_view/vendor/html-scanner/html/sanitizer.rb +5 -5
- data/lib/action_view/vendor/html-scanner/html/selector.rb +8 -8
- metadata +8 -8
@@ -433,7 +433,7 @@ module ActionView
|
|
433
433
|
|
434
434
|
builder = instantiate_builder(object_name, object, options)
|
435
435
|
output = capture(builder, &block)
|
436
|
-
html_options[:multipart]
|
436
|
+
html_options[:multipart] ||= builder.multipart?
|
437
437
|
|
438
438
|
form_tag(options[:url] || {}, html_options) { output }
|
439
439
|
end
|
@@ -655,14 +655,6 @@ module ActionView
|
|
655
655
|
# ...
|
656
656
|
# <% end %>
|
657
657
|
#
|
658
|
-
# When projects is already an association on Person you can use
|
659
|
-
# +accepts_nested_attributes_for+ to define the writer method for you:
|
660
|
-
#
|
661
|
-
# class Person < ActiveRecord::Base
|
662
|
-
# has_many :projects
|
663
|
-
# accepts_nested_attributes_for :projects
|
664
|
-
# end
|
665
|
-
#
|
666
658
|
# If you want to destroy any of the associated models through the
|
667
659
|
# form, you have to enable it first using the <tt>:allow_destroy</tt>
|
668
660
|
# option for +accepts_nested_attributes_for+:
|
@@ -1160,12 +1152,65 @@ module ActionView
|
|
1160
1152
|
end
|
1161
1153
|
end
|
1162
1154
|
|
1155
|
+
# A +FormBuilder+ object is associated with a particular model object and
|
1156
|
+
# allows you to generate fields associated with the model object. The
|
1157
|
+
# +FormBuilder+ object is yielded when using +form_for+ or +fields_for+.
|
1158
|
+
# For example:
|
1159
|
+
#
|
1160
|
+
# <%= form_for @person do |person_form| %>
|
1161
|
+
# Name: <%= person_form.text_field :name %>
|
1162
|
+
# Admin: <%= person_form.check_box :admin %>
|
1163
|
+
# <% end %>
|
1164
|
+
#
|
1165
|
+
# In the above block, the a +FormBuilder+ object is yielded as the
|
1166
|
+
# +person_form+ variable. This allows you to generate the +text_field+
|
1167
|
+
# and +check_box+ fields by specifying their eponymous methods, which
|
1168
|
+
# modify the underlying template and associates the +@person+ model object
|
1169
|
+
# with the form.
|
1170
|
+
#
|
1171
|
+
# The +FormBuilder+ object can be thought of as serving as a proxy for the
|
1172
|
+
# methods in the +FormHelper+ module. This class, however, allows you to
|
1173
|
+
# call methods with the model object you are building the form for.
|
1174
|
+
#
|
1175
|
+
# You can create your own custom FormBuilder templates by subclasses this
|
1176
|
+
# class. For example:
|
1177
|
+
#
|
1178
|
+
# class MyFormBuilder < ActionView::Helpers::FormBuilder
|
1179
|
+
# def div_radio_button(method, tag_value, options = {})
|
1180
|
+
# @template.content_tag(:div,
|
1181
|
+
# @template.radio_button(
|
1182
|
+
# @object_name, method, tag_value, objectify_options(options)
|
1183
|
+
# )
|
1184
|
+
# )
|
1185
|
+
# end
|
1186
|
+
#
|
1187
|
+
# The above code creates a new method +div_radio_button+ which wraps a div
|
1188
|
+
# around the a new radio button. Note that when options are passed in, you
|
1189
|
+
# must called +objectify_options+ in order for the model object to get
|
1190
|
+
# correctly passed to the method. If +objectify_options+ is not called,
|
1191
|
+
# then the newly created helper will not be linked back to the model.
|
1192
|
+
#
|
1193
|
+
# The +div_radio_button+ code from above can now be used as follows:
|
1194
|
+
#
|
1195
|
+
# <%= form_for @person, :builder => MyFormBuilder do |f| %>
|
1196
|
+
# I am a child: <%= f.div_radio_button(:admin, "child") %>
|
1197
|
+
# I am an adult: <%= f.div_radio_button(:admin, "adult") %>
|
1198
|
+
# <% end -%>
|
1199
|
+
#
|
1200
|
+
# The standard set of helper methods for form building are located in the
|
1201
|
+
# +field_helpers+ class attribute.
|
1163
1202
|
class FormBuilder
|
1164
1203
|
include ModelNaming
|
1165
1204
|
|
1166
1205
|
# The methods which wrap a form helper call.
|
1167
1206
|
class_attribute :field_helpers
|
1168
|
-
self.field_helpers =
|
1207
|
+
self.field_helpers = [:fields_for, :label, :text_field, :password_field,
|
1208
|
+
:hidden_field, :file_field, :text_area, :check_box,
|
1209
|
+
:radio_button, :color_field, :search_field,
|
1210
|
+
:telephone_field, :phone_field, :date_field,
|
1211
|
+
:time_field, :datetime_field, :datetime_local_field,
|
1212
|
+
:month_field, :week_field, :url_field, :email_field,
|
1213
|
+
:number_field, :range_field]
|
1169
1214
|
|
1170
1215
|
attr_accessor :object_name, :object, :options
|
1171
1216
|
|
@@ -1247,7 +1292,7 @@ module ActionView
|
|
1247
1292
|
# Admin? : <%= permission_fields.check_box :admin %>
|
1248
1293
|
# <% end %>
|
1249
1294
|
#
|
1250
|
-
# <%=
|
1295
|
+
# <%= person_form.submit %>
|
1251
1296
|
# <% end %>
|
1252
1297
|
#
|
1253
1298
|
# In this case, the checkbox field will be represented by an HTML +input+
|
@@ -1425,14 +1470,6 @@ module ActionView
|
|
1425
1470
|
# ...
|
1426
1471
|
# <% end %>
|
1427
1472
|
#
|
1428
|
-
# When projects is already an association on Person you can use
|
1429
|
-
# +accepts_nested_attributes_for+ to define the writer method for you:
|
1430
|
-
#
|
1431
|
-
# class Person < ActiveRecord::Base
|
1432
|
-
# has_many :projects
|
1433
|
-
# accepts_nested_attributes_for :projects
|
1434
|
-
# end
|
1435
|
-
#
|
1436
1473
|
# If you want to destroy any of the associated models through the
|
1437
1474
|
# form, you have to enable it first using the <tt>:allow_destroy</tt>
|
1438
1475
|
# option for +accepts_nested_attributes_for+:
|
@@ -380,7 +380,7 @@ module ActionView
|
|
380
380
|
# should produce the desired results.
|
381
381
|
def options_from_collection_for_select(collection, value_method, text_method, selected = nil)
|
382
382
|
options = collection.map do |element|
|
383
|
-
[value_for_collection(element, text_method), value_for_collection(element, value_method)]
|
383
|
+
[value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element)]
|
384
384
|
end
|
385
385
|
selected, disabled = extract_selected_and_disabled(selected)
|
386
386
|
select_deselect = {
|
@@ -565,7 +565,7 @@ module ActionView
|
|
565
565
|
|
566
566
|
if priority_zones
|
567
567
|
if priority_zones.is_a?(Regexp)
|
568
|
-
priority_zones = zones.
|
568
|
+
priority_zones = zones.select { |z| z =~ priority_zones }
|
569
569
|
end
|
570
570
|
|
571
571
|
zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected)
|
@@ -752,7 +752,7 @@ module ActionView
|
|
752
752
|
end
|
753
753
|
|
754
754
|
def prompt_text(prompt)
|
755
|
-
prompt
|
755
|
+
prompt.kind_of?(String) ? prompt : I18n.translate('helpers.select.prompt', :default => 'Please select')
|
756
756
|
end
|
757
757
|
end
|
758
758
|
|
@@ -81,7 +81,7 @@ module ActionView
|
|
81
81
|
# # => <input class="ok" onclick="alert('Hello world!');" type="button" value="Greeting" />
|
82
82
|
#
|
83
83
|
def button_to_function(name, function=nil, html_options={})
|
84
|
-
message = "button_to_function is deprecated and will be removed from Rails 4.1. We
|
84
|
+
message = "button_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " +
|
85
85
|
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
|
86
86
|
ActiveSupport::Deprecation.warn message
|
87
87
|
|
@@ -103,7 +103,7 @@ module ActionView
|
|
103
103
|
# # => <a class="nav_link" href="#" onclick="alert('Hello world!'); return false;">Greeting</a>
|
104
104
|
#
|
105
105
|
def link_to_function(name, function, html_options={})
|
106
|
-
message = "link_to_function is deprecated and will be removed from Rails 4.1. We
|
106
|
+
message = "link_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " +
|
107
107
|
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
|
108
108
|
ActiveSupport::Deprecation.warn message
|
109
109
|
|
@@ -28,6 +28,8 @@ module ActionView
|
|
28
28
|
# Formats a +number+ into a US phone number (e.g., (555)
|
29
29
|
# 123-9876). You can customize the format in the +options+ hash.
|
30
30
|
#
|
31
|
+
# ==== Options
|
32
|
+
#
|
31
33
|
# * <tt>:area_code</tt> - Adds parentheses around the area code.
|
32
34
|
# * <tt>:delimiter</tt> - Specifies the delimiter to use
|
33
35
|
# (defaults to "-").
|
@@ -38,6 +40,8 @@ module ActionView
|
|
38
40
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
39
41
|
# the argument is invalid.
|
40
42
|
#
|
43
|
+
# ==== Examples
|
44
|
+
#
|
41
45
|
# number_to_phone(5551234) # => 555-1234
|
42
46
|
# number_to_phone("5551234") # => 555-1234
|
43
47
|
# number_to_phone(1235551234) # => 123-555-1234
|
@@ -61,6 +65,8 @@ module ActionView
|
|
61
65
|
# Formats a +number+ into a currency string (e.g., $13.65). You
|
62
66
|
# can customize the format in the +options+ hash.
|
63
67
|
#
|
68
|
+
# ==== Options
|
69
|
+
#
|
64
70
|
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
65
71
|
# (defaults to current locale).
|
66
72
|
# * <tt>:precision</tt> - Sets the level of precision (defaults
|
@@ -82,6 +88,8 @@ module ActionView
|
|
82
88
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
83
89
|
# the argument is invalid.
|
84
90
|
#
|
91
|
+
# ==== Examples
|
92
|
+
#
|
85
93
|
# number_to_currency(1234567890.50) # => $1,234,567,890.50
|
86
94
|
# number_to_currency(1234567890.506) # => $1,234,567,890.51
|
87
95
|
# number_to_currency(1234567890.506, precision: 3) # => $1,234,567,890.506
|
@@ -108,6 +116,7 @@ module ActionView
|
|
108
116
|
# Formats a +number+ as a percentage string (e.g., 65%). You can
|
109
117
|
# customize the format in the +options+ hash.
|
110
118
|
#
|
119
|
+
# ==== Options
|
111
120
|
#
|
112
121
|
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
113
122
|
# (defaults to current locale).
|
@@ -128,6 +137,8 @@ module ActionView
|
|
128
137
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
129
138
|
# the argument is invalid.
|
130
139
|
#
|
140
|
+
# ==== Examples
|
141
|
+
#
|
131
142
|
# number_to_percentage(100) # => 100.000%
|
132
143
|
# number_to_percentage("98") # => 98.000%
|
133
144
|
# number_to_percentage(100, precision: 0) # => 100%
|
@@ -151,6 +162,8 @@ module ActionView
|
|
151
162
|
# (e.g., 12,324). You can customize the format in the +options+
|
152
163
|
# hash.
|
153
164
|
#
|
165
|
+
# ==== Options
|
166
|
+
#
|
154
167
|
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
155
168
|
# (defaults to current locale).
|
156
169
|
# * <tt>:delimiter</tt> - Sets the thousands delimiter (defaults
|
@@ -160,6 +173,8 @@ module ActionView
|
|
160
173
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
161
174
|
# the argument is invalid.
|
162
175
|
#
|
176
|
+
# ==== Examples
|
177
|
+
#
|
163
178
|
# number_with_delimiter(12345678) # => 12,345,678
|
164
179
|
# number_with_delimiter("123456") # => 123,456
|
165
180
|
# number_with_delimiter(12345678.05) # => 12,345,678.05
|
@@ -185,6 +200,8 @@ module ActionView
|
|
185
200
|
# +:significant+ is +false+, and 5 if +:significant+ is +true+).
|
186
201
|
# You can customize the format in the +options+ hash.
|
187
202
|
#
|
203
|
+
# ==== Options
|
204
|
+
#
|
188
205
|
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
189
206
|
# (defaults to current locale).
|
190
207
|
# * <tt>:precision</tt> - Sets the precision of the number
|
@@ -202,6 +219,8 @@ module ActionView
|
|
202
219
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
203
220
|
# the argument is invalid.
|
204
221
|
#
|
222
|
+
# ==== Examples
|
223
|
+
#
|
205
224
|
# number_with_precision(111.2345) # => 111.235
|
206
225
|
# number_with_precision(111.2345, precision: 2) # => 111.23
|
207
226
|
# number_with_precision(13, precision: 5) # => 13.00000
|
@@ -233,6 +252,8 @@ module ActionView
|
|
233
252
|
# See <tt>number_to_human</tt> if you want to pretty-print a
|
234
253
|
# generic number.
|
235
254
|
#
|
255
|
+
# ==== Options
|
256
|
+
#
|
236
257
|
# * <tt>:locale</tt> - Sets the locale to be used for formatting
|
237
258
|
# (defaults to current locale).
|
238
259
|
# * <tt>:precision</tt> - Sets the precision of the number
|
@@ -252,6 +273,8 @@ module ActionView
|
|
252
273
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
253
274
|
# the argument is invalid.
|
254
275
|
#
|
276
|
+
# ==== Examples
|
277
|
+
#
|
255
278
|
# number_to_human_size(123) # => 123 Bytes
|
256
279
|
# number_to_human_size(1234) # => 1.21 KB
|
257
280
|
# number_to_human_size(12345) # => 12.1 KB
|
@@ -324,6 +347,8 @@ module ActionView
|
|
324
347
|
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when
|
325
348
|
# the argument is invalid.
|
326
349
|
#
|
350
|
+
# ==== Examples
|
351
|
+
#
|
327
352
|
# number_to_human(123) # => "123"
|
328
353
|
# number_to_human(1234) # => "1.23 Thousand"
|
329
354
|
# number_to_human(12345) # => "12.3 Thousand"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Helpers
|
3
|
-
module Tags
|
4
|
-
class Base
|
3
|
+
module Tags # :nodoc:
|
4
|
+
class Base # :nodoc:
|
5
5
|
include Helpers::ActiveModelInstanceTag, Helpers::TagHelper, Helpers::FormTagHelper
|
6
6
|
include FormOptionsHelper
|
7
7
|
|
@@ -73,27 +73,26 @@ module ActionView
|
|
73
73
|
|
74
74
|
def add_default_name_and_id(options)
|
75
75
|
if options.has_key?("index")
|
76
|
-
options["name"] ||= options.fetch("name"){ tag_name_with_index(options["index"]) }
|
76
|
+
options["name"] ||= options.fetch("name"){ tag_name_with_index(options["index"], options["multiple"]) }
|
77
77
|
options["id"] = options.fetch("id"){ tag_id_with_index(options["index"]) }
|
78
78
|
options.delete("index")
|
79
79
|
elsif defined?(@auto_index)
|
80
|
-
options["name"] ||= options.fetch("name"){ tag_name_with_index(@auto_index) }
|
80
|
+
options["name"] ||= options.fetch("name"){ tag_name_with_index(@auto_index, options["multiple"]) }
|
81
81
|
options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) }
|
82
82
|
else
|
83
|
-
options["name"] ||= options.fetch("name"){ tag_name }
|
83
|
+
options["name"] ||= options.fetch("name"){ tag_name(options["multiple"]) }
|
84
84
|
options["id"] = options.fetch("id"){ tag_id }
|
85
85
|
end
|
86
86
|
|
87
|
-
options["name"] += "[]" if options["multiple"]
|
88
87
|
options["id"] = [options.delete('namespace'), options["id"]].compact.join("_").presence
|
89
88
|
end
|
90
89
|
|
91
|
-
def tag_name
|
92
|
-
"#{@object_name}[#{sanitized_method_name}]"
|
90
|
+
def tag_name(multiple = false)
|
91
|
+
"#{@object_name}[#{sanitized_method_name}]#{"[]" if multiple}"
|
93
92
|
end
|
94
93
|
|
95
|
-
def tag_name_with_index(index)
|
96
|
-
"#{@object_name}[#{index}][#{sanitized_method_name}]"
|
94
|
+
def tag_name_with_index(index, multiple = false)
|
95
|
+
"#{@object_name}[#{index}][#{sanitized_method_name}]#{"[]" if multiple}"
|
97
96
|
end
|
98
97
|
|
99
98
|
def tag_id
|
@@ -2,11 +2,11 @@ require 'action_view/helpers/tags/collection_helpers'
|
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
5
|
-
module Tags
|
6
|
-
class CollectionCheckBoxes < Base
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class CollectionCheckBoxes < Base # :nodoc:
|
7
7
|
include CollectionHelpers
|
8
8
|
|
9
|
-
class CheckBoxBuilder < Builder
|
9
|
+
class CheckBoxBuilder < Builder # :nodoc:
|
10
10
|
def check_box(extra_html_options={})
|
11
11
|
html_options = extra_html_options.merge(@input_html_options)
|
12
12
|
@template_object.check_box(@object_name, @method_name, html_options, @value, nil)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Helpers
|
3
|
-
module Tags
|
4
|
-
module CollectionHelpers
|
5
|
-
class Builder
|
3
|
+
module Tags # :nodoc:
|
4
|
+
module CollectionHelpers # :nodoc:
|
5
|
+
class Builder # :nodoc:
|
6
6
|
attr_reader :object, :text, :value
|
7
7
|
|
8
8
|
def initialize(template_object, object_name, method_name, object,
|
@@ -2,11 +2,11 @@ require 'action_view/helpers/tags/collection_helpers'
|
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
5
|
-
module Tags
|
6
|
-
class CollectionRadioButtons < Base
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class CollectionRadioButtons < Base # :nodoc:
|
7
7
|
include CollectionHelpers
|
8
8
|
|
9
|
-
class RadioButtonBuilder < Builder
|
9
|
+
class RadioButtonBuilder < Builder # :nodoc:
|
10
10
|
def radio_button(extra_html_options={})
|
11
11
|
html_options = extra_html_options.merge(@input_html_options)
|
12
12
|
@template_object.radio_button(@object_name, @method_name, @value, html_options)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Helpers
|
3
|
-
module Tags
|
4
|
-
class ColorField < TextField
|
3
|
+
module Tags # :nodoc:
|
4
|
+
class ColorField < TextField # :nodoc:
|
5
5
|
def render
|
6
6
|
options = @options.stringify_keys
|
7
7
|
options["value"] = @options.fetch("value") { validate_color_string(value(object)) }
|
@@ -2,8 +2,8 @@ require 'active_support/core_ext/time/calculations'
|
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
5
|
-
module Tags
|
6
|
-
class DateSelect < Base
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class DateSelect < Base # :nodoc:
|
7
7
|
def initialize(object_name, method_name, template_object, options, html_options)
|
8
8
|
@html_options = html_options
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Helpers
|
3
|
-
module Tags
|
4
|
-
class DatetimeField < TextField
|
3
|
+
module Tags # :nodoc:
|
4
|
+
class DatetimeField < TextField # :nodoc:
|
5
5
|
def render
|
6
6
|
options = @options.stringify_keys
|
7
7
|
options["value"] = @options.fetch("value") { format_date(value(object)) }
|