actionview 7.0.4.3 → 7.0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +101 -0
- data/README.rdoc +2 -2
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/helpers/asset_tag_helper.rb +2 -2
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- data/lib/action_view/helpers/csrf_helper.rb +1 -1
- data/lib/action_view/helpers/date_helper.rb +55 -45
- data/lib/action_view/helpers/form_helper.rb +5 -4
- data/lib/action_view/helpers/form_options_helper.rb +2 -0
- data/lib/action_view/helpers/number_helper.rb +11 -10
- data/lib/action_view/helpers/output_safety_helper.rb +2 -2
- data/lib/action_view/helpers/tags/select.rb +1 -1
- data/lib/action_view/helpers/url_helper.rb +1 -1
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +20 -3
- data/lib/action_view/ripper_ast_parser.rb +1 -1
- data/lib/action_view/routing_url_for.rb +4 -4
- data/lib/action_view/template/resolver.rb +5 -3
- metadata +15 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbf8032007fb7b2acf39358fda63a7bb6c9fb14cc0fdb9c566230ab0b6b04c4a
|
|
4
|
+
data.tar.gz: 8b32c841e532b2f8112311673d6cfad2f729917a2f394236187b4f437316b47c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7cf741e2af1ee69051ecebcd8a72dbe54cd2df9ccca4ac3f49d069db5174d501f296ae9a5fbcbf319a8a1a74eff19c1a4cd2caa8fb3dc12e203ec6a9b55bd71
|
|
7
|
+
data.tar.gz: 6a0ea6598a57d7f0793c08af861fcb1b6a6d8fc36866f82e1e0b2583a2d8d901bd204046daf4f12cae567a9e88aa9edd56ebcb93429226f29c43432b92d80b9c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,104 @@
|
|
|
1
|
+
## Rails 7.0.8.6 (October 23, 2024) ##
|
|
2
|
+
|
|
3
|
+
* No changes.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Rails 7.0.8.5 (October 15, 2024) ##
|
|
7
|
+
|
|
8
|
+
* No changes.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Rails 7.0.8.4 (June 04, 2024) ##
|
|
12
|
+
|
|
13
|
+
* No changes.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Rails 7.0.8.3 (May 17, 2024) ##
|
|
17
|
+
|
|
18
|
+
* No changes.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Rails 7.0.8.2 (May 16, 2024) ##
|
|
22
|
+
|
|
23
|
+
* No changes.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Rails 7.0.8.1 (February 21, 2024) ##
|
|
27
|
+
|
|
28
|
+
* No changes.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Rails 7.0.8 (September 09, 2023) ##
|
|
32
|
+
|
|
33
|
+
* Fix `form_for` missing the hidden `_method` input for models with a
|
|
34
|
+
namespaced route.
|
|
35
|
+
|
|
36
|
+
*Hartley McGuire*
|
|
37
|
+
|
|
38
|
+
* Fix `render collection: @records, cache: true` inside `jbuilder` templates
|
|
39
|
+
|
|
40
|
+
The previous fix that shipped in `7.0.7` assumed template fragments are always strings,
|
|
41
|
+
this isn't true with `jbuilder`.
|
|
42
|
+
|
|
43
|
+
*Jean Boussier*
|
|
44
|
+
|
|
45
|
+
## Rails 7.0.7.2 (August 22, 2023) ##
|
|
46
|
+
|
|
47
|
+
* No changes.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Rails 7.0.7.1 (August 22, 2023) ##
|
|
51
|
+
|
|
52
|
+
* No changes.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Rails 7.0.7 (August 09, 2023) ##
|
|
56
|
+
|
|
57
|
+
* Fix `render collection: @records, cache: true` to cache fragments as bare strings
|
|
58
|
+
|
|
59
|
+
Previously it would incorrectly cache them as Action View buffers.
|
|
60
|
+
|
|
61
|
+
*Jean Boussier*
|
|
62
|
+
|
|
63
|
+
* Don't double-encode nested `field_id` and `field_name` index values
|
|
64
|
+
|
|
65
|
+
Pass `index: @options` as a default keyword argument to `field_id` and
|
|
66
|
+
`field_name` view helper methods.
|
|
67
|
+
|
|
68
|
+
*Sean Doyle*
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Rails 7.0.6 (June 29, 2023) ##
|
|
72
|
+
|
|
73
|
+
* No changes.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Rails 7.0.5.1 (June 26, 2023) ##
|
|
77
|
+
|
|
78
|
+
* No changes.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Rails 7.0.5 (May 24, 2023) ##
|
|
82
|
+
|
|
83
|
+
* `FormBuilder#id` finds id set by `form_for` and `form_with`.
|
|
84
|
+
|
|
85
|
+
*Matt Polito*
|
|
86
|
+
|
|
87
|
+
* Allow all available locales for template lookups.
|
|
88
|
+
|
|
89
|
+
*Ben Dilley*
|
|
90
|
+
|
|
91
|
+
* Choices of `select` can optionally contain html attributes as the last element
|
|
92
|
+
of the child arrays when using grouped/nested collections
|
|
93
|
+
|
|
94
|
+
```erb
|
|
95
|
+
<%= form.select :foo, [["North America", [["United States","US"],["Canada","CA"]], { disabled: "disabled" }]] %>
|
|
96
|
+
# => <select><optgroup label="North America" disabled="disabled"><option value="US">United States</option><option value="CA">Canada</option></optgroup></select>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
*Chris Gunther*
|
|
100
|
+
|
|
101
|
+
|
|
1
102
|
## Rails 7.0.4.3 (March 13, 2023) ##
|
|
2
103
|
|
|
3
104
|
* Ignore certain data-* attributes in rails-ujs when element is contenteditable
|
data/README.rdoc
CHANGED
|
@@ -13,7 +13,7 @@ The latest version of Action View can be installed with RubyGems:
|
|
|
13
13
|
|
|
14
14
|
$ gem install actionview
|
|
15
15
|
|
|
16
|
-
Source code can be downloaded as part of the Rails project on GitHub:
|
|
16
|
+
Source code can be downloaded as part of the \Rails project on GitHub:
|
|
17
17
|
|
|
18
18
|
* https://github.com/rails/rails/tree/main/actionview
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ API documentation is at
|
|
|
31
31
|
|
|
32
32
|
* https://api.rubyonrails.org
|
|
33
33
|
|
|
34
|
-
Bug reports for the Ruby on Rails project can be filed here:
|
|
34
|
+
Bug reports for the Ruby on \Rails project can be filed here:
|
|
35
35
|
|
|
36
36
|
* https://github.com/rails/rails/issues
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ module ActionView
|
|
|
41
41
|
# When the Asset Pipeline is enabled, you can pass the name of your manifest as
|
|
42
42
|
# source, and include other JavaScript or CoffeeScript files inside the manifest.
|
|
43
43
|
#
|
|
44
|
-
# If the server supports Early Hints header links for these assets will be
|
|
44
|
+
# If the server supports Early Hints, header links for these assets will be
|
|
45
45
|
# automatically pushed.
|
|
46
46
|
#
|
|
47
47
|
# ==== Options
|
|
@@ -130,7 +130,7 @@ module ActionView
|
|
|
130
130
|
# set <tt>extname: false</tt> in the options.
|
|
131
131
|
# You can modify the link attributes by passing a hash as the last argument.
|
|
132
132
|
#
|
|
133
|
-
# If the server supports Early Hints header links for these assets will be
|
|
133
|
+
# If the server supports Early Hints, header links for these assets will be
|
|
134
134
|
# automatically pushed.
|
|
135
135
|
#
|
|
136
136
|
# ==== Options
|
|
@@ -121,7 +121,7 @@ module ActionView
|
|
|
121
121
|
# <li><%= link_to 'Home', action: 'index' %></li>
|
|
122
122
|
# <% end %>
|
|
123
123
|
#
|
|
124
|
-
#
|
|
124
|
+
# And in another place:
|
|
125
125
|
#
|
|
126
126
|
# <% content_for :navigation do %>
|
|
127
127
|
# <li><%= link_to 'Login', action: 'login' %></li>
|
|
@@ -137,7 +137,7 @@ module ActionView
|
|
|
137
137
|
# <li><%= link_to 'Home', action: 'index' %></li>
|
|
138
138
|
# <% end %>
|
|
139
139
|
#
|
|
140
|
-
# <%#
|
|
140
|
+
# <%# Add some other content, or use a different template: %>
|
|
141
141
|
#
|
|
142
142
|
# <% content_for :navigation, flush: true do %>
|
|
143
143
|
# <li><%= link_to 'Login', action: 'login' %></li>
|
|
@@ -17,7 +17,7 @@ module ActionView
|
|
|
17
17
|
# You don't need to use these tags for regular forms as they generate their own hidden fields.
|
|
18
18
|
#
|
|
19
19
|
# For AJAX requests other than GETs, extract the "csrf-token" from the meta-tag and send as the
|
|
20
|
-
#
|
|
20
|
+
# +X-CSRF-Token+ HTTP header. If you are using rails-ujs, this happens automatically.
|
|
21
21
|
#
|
|
22
22
|
def csrf_meta_tags
|
|
23
23
|
if defined?(protect_against_forgery?) && protect_against_forgery?
|
|
@@ -1001,22 +1001,25 @@ module ActionView
|
|
|
1001
1001
|
end
|
|
1002
1002
|
|
|
1003
1003
|
# Build select option HTML from date value and options.
|
|
1004
|
-
# build_options(15, start: 1, end: 31)
|
|
1005
|
-
# => "<option value="1">1</option>
|
|
1006
|
-
# <option value="2">2</option>
|
|
1007
|
-
# <option value="3">3</option>..."
|
|
1008
1004
|
#
|
|
1009
|
-
#
|
|
1010
|
-
#
|
|
1011
|
-
#
|
|
1012
|
-
#
|
|
1013
|
-
# <option value="3">03</option>..."
|
|
1005
|
+
# build_options(15, start: 1, end: 31)
|
|
1006
|
+
# => "<option value="1">1</option>
|
|
1007
|
+
# <option value="2">2</option>
|
|
1008
|
+
# <option value="3">3</option>..."
|
|
1014
1009
|
#
|
|
1015
|
-
# If <tt
|
|
1016
|
-
#
|
|
1017
|
-
#
|
|
1018
|
-
#
|
|
1019
|
-
#
|
|
1010
|
+
# If <tt>use_two_digit_numbers: true</tt> option is passed:
|
|
1011
|
+
#
|
|
1012
|
+
# build_options(15, start: 1, end: 31, use_two_digit_numbers: true)
|
|
1013
|
+
# => "<option value="1">01</option>
|
|
1014
|
+
# <option value="2">02</option>
|
|
1015
|
+
# <option value="3">03</option>..."
|
|
1016
|
+
#
|
|
1017
|
+
# If <tt>:step</tt> options is passed:
|
|
1018
|
+
#
|
|
1019
|
+
# build_options(15, start: 1, end: 31, step: 2)
|
|
1020
|
+
# => "<option value="1">1</option>
|
|
1021
|
+
# <option value="3">3</option>
|
|
1022
|
+
# <option value="5">5</option>..."
|
|
1020
1023
|
def build_options(selected, options = {})
|
|
1021
1024
|
options = {
|
|
1022
1025
|
leading_zeros: true, ampm: false, use_two_digit_numbers: false
|
|
@@ -1041,22 +1044,25 @@ module ActionView
|
|
|
1041
1044
|
end
|
|
1042
1045
|
|
|
1043
1046
|
# Build select option HTML for day.
|
|
1044
|
-
#
|
|
1045
|
-
#
|
|
1046
|
-
#
|
|
1047
|
-
#
|
|
1047
|
+
#
|
|
1048
|
+
# build_day_options(2)
|
|
1049
|
+
# => "<option value="1">1</option>
|
|
1050
|
+
# <option value="2" selected="selected">2</option>
|
|
1051
|
+
# <option value="3">3</option>..."
|
|
1048
1052
|
#
|
|
1049
1053
|
# If <tt>day_format: ->(day) { day.ordinalize }</tt> option is passed to DateTimeSelector
|
|
1050
|
-
#
|
|
1051
|
-
#
|
|
1052
|
-
#
|
|
1053
|
-
#
|
|
1054
|
+
#
|
|
1055
|
+
# build_day_options(2)
|
|
1056
|
+
# => "<option value="1">1st</option>
|
|
1057
|
+
# <option value="2" selected="selected">2nd</option>
|
|
1058
|
+
# <option value="3">3rd</option>..."
|
|
1054
1059
|
#
|
|
1055
1060
|
# If <tt>use_two_digit_numbers: true</tt> option is passed to DateTimeSelector
|
|
1056
|
-
#
|
|
1057
|
-
#
|
|
1058
|
-
#
|
|
1059
|
-
#
|
|
1061
|
+
#
|
|
1062
|
+
# build_day_options(2)
|
|
1063
|
+
# => "<option value="1">01</option>
|
|
1064
|
+
# <option value="2" selected="selected">02</option>
|
|
1065
|
+
# <option value="3">03</option>..."
|
|
1060
1066
|
def build_day_options(selected)
|
|
1061
1067
|
select_options = []
|
|
1062
1068
|
(1..31).each do |value|
|
|
@@ -1071,16 +1077,16 @@ module ActionView
|
|
|
1071
1077
|
|
|
1072
1078
|
# Build select option HTML for year.
|
|
1073
1079
|
# If <tt>year_format</tt> option is not passed
|
|
1074
|
-
#
|
|
1075
|
-
#
|
|
1076
|
-
#
|
|
1077
|
-
#
|
|
1080
|
+
# build_year_options(1998, start: 1998, end: 2000)
|
|
1081
|
+
# => "<option value="1998" selected="selected">1998</option>
|
|
1082
|
+
# <option value="1999">1999</option>
|
|
1083
|
+
# <option value="2000">2000</option>"
|
|
1078
1084
|
#
|
|
1079
1085
|
# If <tt>year_format</tt> option is passed
|
|
1080
|
-
#
|
|
1081
|
-
#
|
|
1082
|
-
#
|
|
1083
|
-
#
|
|
1086
|
+
# build_year_options(1998, start: 1998, end: 2000, year_format: ->year { "Heisei #{ year - 1988 }" })
|
|
1087
|
+
# => "<option value="1998" selected="selected">Heisei 10</option>
|
|
1088
|
+
# <option value="1999">Heisei 11</option>
|
|
1089
|
+
# <option value="2000">Heisei 12</option>"
|
|
1084
1090
|
def build_year_options(selected, options = {})
|
|
1085
1091
|
start = options.delete(:start)
|
|
1086
1092
|
stop = options.delete(:end)
|
|
@@ -1098,10 +1104,11 @@ module ActionView
|
|
|
1098
1104
|
end
|
|
1099
1105
|
|
|
1100
1106
|
# Builds select tag from date type and HTML select options.
|
|
1101
|
-
#
|
|
1102
|
-
#
|
|
1103
|
-
#
|
|
1104
|
-
#
|
|
1107
|
+
#
|
|
1108
|
+
# build_select(:month, "<option value="1">January</option>...")
|
|
1109
|
+
# => "<select id="post_written_on_2i" name="post[written_on(2i)]">
|
|
1110
|
+
# <option value="1">January</option>...
|
|
1111
|
+
# </select>"
|
|
1105
1112
|
def build_select(type, select_options_as_html)
|
|
1106
1113
|
select_options = {
|
|
1107
1114
|
id: input_id_from_type(type),
|
|
@@ -1118,9 +1125,10 @@ module ActionView
|
|
|
1118
1125
|
(content_tag("select", select_html.html_safe, select_options) + "\n").html_safe
|
|
1119
1126
|
end
|
|
1120
1127
|
|
|
1121
|
-
# Builds the CSS class value for the select element
|
|
1122
|
-
#
|
|
1123
|
-
#
|
|
1128
|
+
# Builds the CSS class value for the select element.
|
|
1129
|
+
#
|
|
1130
|
+
# css_class_attribute(:year, 'date optional', { year: 'my-year' })
|
|
1131
|
+
# => "date optional my-year"
|
|
1124
1132
|
def css_class_attribute(type, html_options_class, options) # :nodoc:
|
|
1125
1133
|
css_class = \
|
|
1126
1134
|
case options
|
|
@@ -1134,8 +1142,9 @@ module ActionView
|
|
|
1134
1142
|
end
|
|
1135
1143
|
|
|
1136
1144
|
# Builds a prompt option tag with supplied options or from default options.
|
|
1137
|
-
#
|
|
1138
|
-
#
|
|
1145
|
+
#
|
|
1146
|
+
# prompt_option_tag(:month, prompt: 'Select month')
|
|
1147
|
+
# => "<option value="">Select month</option>"
|
|
1139
1148
|
def prompt_option_tag(type, options)
|
|
1140
1149
|
prompt = \
|
|
1141
1150
|
case options
|
|
@@ -1152,8 +1161,9 @@ module ActionView
|
|
|
1152
1161
|
end
|
|
1153
1162
|
|
|
1154
1163
|
# Builds hidden input tag for date part and value.
|
|
1155
|
-
#
|
|
1156
|
-
#
|
|
1164
|
+
#
|
|
1165
|
+
# build_hidden(:year, 2008)
|
|
1166
|
+
# => "<input type="hidden" id="date_year" name="date[year]" value="2008" autocomplete="off" />"
|
|
1157
1167
|
def build_hidden(type, value)
|
|
1158
1168
|
select_options = {
|
|
1159
1169
|
type: "hidden",
|
|
@@ -465,12 +465,13 @@ module ActionView
|
|
|
465
465
|
|
|
466
466
|
as = options[:as]
|
|
467
467
|
namespace = options[:namespace]
|
|
468
|
-
action = object.respond_to?(:persisted?) && object.persisted? ? :edit : :new
|
|
468
|
+
action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]
|
|
469
469
|
options[:html] ||= {}
|
|
470
470
|
options[:html].reverse_merge!(
|
|
471
471
|
class: as ? "#{action}_#{as}" : dom_class(object, action),
|
|
472
472
|
id: (as ? [namespace, action, as] : [namespace, dom_id(object, action)]).compact.join("_").presence,
|
|
473
473
|
)
|
|
474
|
+
options[:method] ||= method
|
|
474
475
|
end
|
|
475
476
|
private :apply_form_for_options!
|
|
476
477
|
|
|
@@ -1735,7 +1736,7 @@ module ActionView
|
|
|
1735
1736
|
# <tt><button></tt> element should be treated as the <tt><form></tt>
|
|
1736
1737
|
# element's submit button, regardless of where it exists in the DOM.
|
|
1737
1738
|
def id
|
|
1738
|
-
options.dig(:html, :id)
|
|
1739
|
+
options.dig(:html, :id) || options[:id]
|
|
1739
1740
|
end
|
|
1740
1741
|
|
|
1741
1742
|
# Generate an HTML <tt>id</tt> attribute value for the given field
|
|
@@ -1754,7 +1755,7 @@ module ActionView
|
|
|
1754
1755
|
# <tt>aria-describedby</tt> attribute referencing the <tt><span></tt>
|
|
1755
1756
|
# element, sharing a common <tt>id</tt> root (<tt>post_title</tt>, in this
|
|
1756
1757
|
# case).
|
|
1757
|
-
def field_id(method, *suffixes, namespace: @options[:namespace], index: @index)
|
|
1758
|
+
def field_id(method, *suffixes, namespace: @options[:namespace], index: @options[:index])
|
|
1758
1759
|
@template.field_id(@object_name, method, *suffixes, namespace: namespace, index: index)
|
|
1759
1760
|
end
|
|
1760
1761
|
|
|
@@ -1774,7 +1775,7 @@ module ActionView
|
|
|
1774
1775
|
# <%# => <input type="text" name="post[tag][]">
|
|
1775
1776
|
# <% end %>
|
|
1776
1777
|
#
|
|
1777
|
-
def field_name(method, *methods, multiple: false, index: @index)
|
|
1778
|
+
def field_name(method, *methods, multiple: false, index: @options[:index])
|
|
1778
1779
|
object_name = @options.fetch(:as) { @object_name }
|
|
1779
1780
|
|
|
1780
1781
|
@template.field_name(object_name, method, *methods, index: index, multiple: multiple)
|
|
@@ -500,6 +500,8 @@ module ActionView
|
|
|
500
500
|
# <tt><optgroup></tt> label while the second value must be an array of options. The second value can be a
|
|
501
501
|
# nested array of text-value pairs. See <tt>options_for_select</tt> for more info.
|
|
502
502
|
# Ex. ["North America",[["United States","US"],["Canada","CA"]]]
|
|
503
|
+
# An optional third value can be provided as HTML attributes for the <tt>optgroup</tt>.
|
|
504
|
+
# Ex. ["North America",[["United States","US"],["Canada","CA"]], { disabled: "disabled" }]
|
|
503
505
|
# * +selected_key+ - A value equal to the +value+ attribute for one of the <tt><option></tt> tags,
|
|
504
506
|
# which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options
|
|
505
507
|
# as you might have the same option in multiple groups. Each will then get <tt>selected="selected"</tt>.
|
|
@@ -202,7 +202,7 @@ module ActionView
|
|
|
202
202
|
# number_with_delimiter("123456.78",
|
|
203
203
|
# delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) # => "1,23,456.78"
|
|
204
204
|
#
|
|
205
|
-
#
|
|
205
|
+
# number_with_delimiter("112a", raise: true) # => raise InvalidNumberError
|
|
206
206
|
def number_with_delimiter(number, options = {})
|
|
207
207
|
delegate_number_helper_method(:number_to_delimited, number, options)
|
|
208
208
|
end
|
|
@@ -370,13 +370,14 @@ module ActionView
|
|
|
370
370
|
# out by default (set <tt>:strip_insignificant_zeros</tt> to
|
|
371
371
|
# +false+ to change that):
|
|
372
372
|
#
|
|
373
|
-
#
|
|
374
|
-
#
|
|
373
|
+
# number_to_human(12.00001) # => "12"
|
|
374
|
+
# number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0"
|
|
375
375
|
#
|
|
376
376
|
# ==== Custom Unit Quantifiers
|
|
377
377
|
#
|
|
378
378
|
# You can also use your own custom unit quantifiers:
|
|
379
|
-
#
|
|
379
|
+
#
|
|
380
|
+
# number_to_human(500000, units: {unit: "ml", thousand: "lt"}) # => "500 lt"
|
|
380
381
|
#
|
|
381
382
|
# If in your I18n locale you have:
|
|
382
383
|
# distance:
|
|
@@ -393,12 +394,12 @@ module ActionView
|
|
|
393
394
|
#
|
|
394
395
|
# Then you could do:
|
|
395
396
|
#
|
|
396
|
-
#
|
|
397
|
-
#
|
|
398
|
-
#
|
|
399
|
-
#
|
|
400
|
-
#
|
|
401
|
-
#
|
|
397
|
+
# number_to_human(543934, units: :distance) # => "544 kilometers"
|
|
398
|
+
# number_to_human(54393498, units: :distance) # => "54400 kilometers"
|
|
399
|
+
# number_to_human(54393498000, units: :distance) # => "54.4 gazillion-distance"
|
|
400
|
+
# number_to_human(343, units: :distance, precision: 1) # => "300 meters"
|
|
401
|
+
# number_to_human(1, units: :distance) # => "1 meter"
|
|
402
|
+
# number_to_human(0.34, units: :distance) # => "34 centimeters"
|
|
402
403
|
#
|
|
403
404
|
def number_to_human(number, options = {})
|
|
404
405
|
delegate_number_helper_method(:number_to_human, number, options)
|
|
@@ -34,7 +34,7 @@ module ActionView
|
|
|
34
34
|
# [nil, []]
|
|
35
35
|
# { nil => [] }
|
|
36
36
|
def grouped_choices?
|
|
37
|
-
!@choices.blank? && @choices.first.respond_to?(:
|
|
37
|
+
!@choices.blank? && @choices.first.respond_to?(:second) && Array === @choices.first.second
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -492,7 +492,7 @@ module ActionView
|
|
|
492
492
|
# * <tt>:body</tt> - Preset the body of the email.
|
|
493
493
|
# * <tt>:cc</tt> - Carbon Copy additional recipients on the email.
|
|
494
494
|
# * <tt>:bcc</tt> - Blind Carbon Copy additional recipients on the email.
|
|
495
|
-
# * <tt>:reply_to</tt> - Preset the Reply-To field of the email.
|
|
495
|
+
# * <tt>:reply_to</tt> - Preset the +Reply-To+ field of the email.
|
|
496
496
|
#
|
|
497
497
|
# ==== Obfuscation
|
|
498
498
|
# Prior to Rails 4.0, +mail_to+ provided options for encoding the address
|
|
@@ -88,15 +88,32 @@ module ActionView
|
|
|
88
88
|
# If the partial is not already cached it will also be
|
|
89
89
|
# written back to the underlying cache store.
|
|
90
90
|
def fetch_or_cache_partial(cached_partials, template, order_by:)
|
|
91
|
-
|
|
91
|
+
entries_to_write = {}
|
|
92
|
+
|
|
93
|
+
keyed_partials = order_by.index_with do |cache_key|
|
|
92
94
|
if content = cached_partials[cache_key]
|
|
93
95
|
build_rendered_template(content, template)
|
|
94
96
|
else
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
rendered_partial = yield
|
|
98
|
+
body = rendered_partial.body
|
|
99
|
+
|
|
100
|
+
# We want to cache buffers as raw strings. This both improve performance and
|
|
101
|
+
# avoid creating forward compatibility issues with the internal representation
|
|
102
|
+
# of these two types.
|
|
103
|
+
if body.is_a?(ActiveSupport::SafeBuffer)
|
|
104
|
+
body = body.to_str
|
|
97
105
|
end
|
|
106
|
+
|
|
107
|
+
entries_to_write[cache_key] = body
|
|
108
|
+
rendered_partial
|
|
98
109
|
end
|
|
99
110
|
end
|
|
111
|
+
|
|
112
|
+
unless entries_to_write.empty?
|
|
113
|
+
collection_cache.write_multi(entries_to_write)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
keyed_partials
|
|
100
117
|
end
|
|
101
118
|
end
|
|
102
119
|
end
|
|
@@ -6,14 +6,14 @@ module ActionView
|
|
|
6
6
|
module RoutingUrlFor
|
|
7
7
|
# Returns the URL for the set of +options+ provided. This takes the
|
|
8
8
|
# same options as +url_for+ in Action Controller (see the
|
|
9
|
-
# documentation for
|
|
10
|
-
# <tt>:only_path</tt> is <tt>true</tt> so you'll get the relative "/controller/action"
|
|
11
|
-
# instead of the fully qualified URL like "http://example.com/controller/action"
|
|
9
|
+
# documentation for ActionDispatch::Routing::UrlFor#url_for). Note that by default
|
|
10
|
+
# <tt>:only_path</tt> is <tt>true</tt> so you'll get the relative <tt>"/controller/action"</tt>
|
|
11
|
+
# instead of the fully qualified URL like <tt>"http://example.com/controller/action"</tt>.
|
|
12
12
|
#
|
|
13
13
|
# ==== Options
|
|
14
14
|
# * <tt>:anchor</tt> - Specifies the anchor name to be appended to the path.
|
|
15
15
|
# * <tt>:only_path</tt> - If true, returns the relative URL (omitting the protocol, host name, and port) (<tt>true</tt> by default unless <tt>:host</tt> is specified).
|
|
16
|
-
# * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in "/archive/2005/"
|
|
16
|
+
# * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in <tt>"/archive/2005/"</tt>. Note that this
|
|
17
17
|
# is currently not recommended since it breaks caching.
|
|
18
18
|
# * <tt>:host</tt> - Overrides the default (current) host if provided.
|
|
19
19
|
# * <tt>:protocol</tt> - Overrides the default (current) protocol if provided.
|
|
@@ -17,9 +17,11 @@ module ActionView
|
|
|
17
17
|
ParsedPath = Struct.new(:path, :details)
|
|
18
18
|
|
|
19
19
|
def build_path_regex
|
|
20
|
-
handlers = Template::Handlers.extensions.map
|
|
21
|
-
formats = Template::Types.symbols.map
|
|
22
|
-
|
|
20
|
+
handlers = Regexp.union(Template::Handlers.extensions.map(&:to_s))
|
|
21
|
+
formats = Regexp.union(Template::Types.symbols.map(&:to_s))
|
|
22
|
+
available_locales = I18n.available_locales.map(&:to_s)
|
|
23
|
+
regular_locales = [/[a-z]{2}(?:[-_][A-Z]{2})?/]
|
|
24
|
+
locales = Regexp.union(available_locales + regular_locales)
|
|
23
25
|
variants = "[^.]*"
|
|
24
26
|
|
|
25
27
|
%r{
|
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: 7.0.
|
|
4
|
+
version: 7.0.8.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-10-23 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: 7.0.
|
|
19
|
+
version: 7.0.8.6
|
|
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: 7.0.
|
|
26
|
+
version: 7.0.8.6
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: builder
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -92,28 +92,28 @@ dependencies:
|
|
|
92
92
|
requirements:
|
|
93
93
|
- - '='
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 7.0.
|
|
95
|
+
version: 7.0.8.6
|
|
96
96
|
type: :development
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - '='
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 7.0.
|
|
102
|
+
version: 7.0.8.6
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
104
|
name: activemodel
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - '='
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 7.0.
|
|
109
|
+
version: 7.0.8.6
|
|
110
110
|
type: :development
|
|
111
111
|
prerelease: false
|
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
113
113
|
requirements:
|
|
114
114
|
- - '='
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: 7.0.
|
|
116
|
+
version: 7.0.8.6
|
|
117
117
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
|
118
118
|
email: david@loudthinking.com
|
|
119
119
|
executables: []
|
|
@@ -246,12 +246,12 @@ licenses:
|
|
|
246
246
|
- MIT
|
|
247
247
|
metadata:
|
|
248
248
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
249
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.
|
|
250
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.
|
|
249
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.8.6/actionview/CHANGELOG.md
|
|
250
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.8.6/
|
|
251
251
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
252
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.
|
|
252
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.8.6/actionview
|
|
253
253
|
rubygems_mfa_required: 'true'
|
|
254
|
-
post_install_message:
|
|
254
|
+
post_install_message:
|
|
255
255
|
rdoc_options: []
|
|
256
256
|
require_paths:
|
|
257
257
|
- lib
|
|
@@ -267,8 +267,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
267
267
|
version: '0'
|
|
268
268
|
requirements:
|
|
269
269
|
- none
|
|
270
|
-
rubygems_version: 3.
|
|
271
|
-
signing_key:
|
|
270
|
+
rubygems_version: 3.5.16
|
|
271
|
+
signing_key:
|
|
272
272
|
specification_version: 4
|
|
273
273
|
summary: Rendering framework putting the V in MVC (part of Rails).
|
|
274
274
|
test_files: []
|