actionview 5.0.7.2 → 5.1.7
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 +4 -4
- data/CHANGELOG.md +169 -345
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/action_view/base.rb +19 -19
- data/lib/action_view/buffers.rb +1 -1
- data/lib/action_view/context.rb +1 -1
- data/lib/action_view/dependency_tracker.rb +4 -5
- data/lib/action_view/digestor.rb +22 -13
- data/lib/action_view/flows.rb +5 -6
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/helpers/active_model_helper.rb +8 -8
- data/lib/action_view/helpers/asset_tag_helper.rb +62 -36
- data/lib/action_view/helpers/asset_url_helper.rb +111 -49
- data/lib/action_view/helpers/atom_feed_helper.rb +12 -13
- data/lib/action_view/helpers/cache_helper.rb +32 -20
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- data/lib/action_view/helpers/controller_helper.rb +2 -2
- data/lib/action_view/helpers/csrf_helper.rb +3 -3
- data/lib/action_view/helpers/date_helper.rb +119 -109
- data/lib/action_view/helpers/debug_helper.rb +2 -3
- data/lib/action_view/helpers/form_helper.rb +440 -31
- data/lib/action_view/helpers/form_options_helper.rb +12 -12
- data/lib/action_view/helpers/form_tag_helper.rb +20 -19
- data/lib/action_view/helpers/javascript_helper.rb +6 -6
- data/lib/action_view/helpers/number_helper.rb +48 -46
- data/lib/action_view/helpers/output_safety_helper.rb +8 -8
- data/lib/action_view/helpers/record_tag_helper.rb +2 -2
- data/lib/action_view/helpers/rendering_helper.rb +2 -3
- data/lib/action_view/helpers/sanitize_helper.rb +16 -12
- data/lib/action_view/helpers/tag_helper.rb +194 -77
- data/lib/action_view/helpers/tags/base.rb +121 -102
- data/lib/action_view/helpers/tags/check_box.rb +17 -17
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +9 -8
- data/lib/action_view/helpers/tags/collection_helpers.rb +60 -60
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -2
- data/lib/action_view/helpers/tags/collection_select.rb +2 -2
- data/lib/action_view/helpers/tags/date_select.rb +36 -36
- data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
- data/lib/action_view/helpers/tags/label.rb +4 -0
- data/lib/action_view/helpers/tags/password_field.rb +1 -1
- data/lib/action_view/helpers/tags/radio_button.rb +4 -4
- data/lib/action_view/helpers/tags/select.rb +9 -9
- data/lib/action_view/helpers/tags/text_area.rb +1 -1
- data/lib/action_view/helpers/tags/text_field.rb +5 -5
- data/lib/action_view/helpers/tags/translator.rb +14 -12
- data/lib/action_view/helpers/text_helper.rb +20 -19
- data/lib/action_view/helpers/translation_helper.rb +6 -6
- data/lib/action_view/helpers/url_helper.rb +48 -46
- data/lib/action_view/helpers.rb +1 -1
- data/lib/action_view/layouts.rb +51 -47
- data/lib/action_view/log_subscriber.rb +25 -9
- data/lib/action_view/lookup_context.rb +19 -25
- data/lib/action_view/path_set.rb +19 -19
- data/lib/action_view/railtie.rb +13 -4
- data/lib/action_view/record_identifier.rb +6 -6
- data/lib/action_view/renderer/abstract_renderer.rb +17 -17
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +7 -1
- data/lib/action_view/renderer/partial_renderer.rb +188 -187
- data/lib/action_view/renderer/renderer.rb +4 -0
- data/lib/action_view/renderer/streaming_template_renderer.rb +45 -47
- data/lib/action_view/renderer/template_renderer.rb +64 -66
- data/lib/action_view/rendering.rb +4 -5
- data/lib/action_view/routing_url_for.rb +9 -13
- data/lib/action_view/tasks/cache_digests.rake +7 -7
- data/lib/action_view/template/error.rb +5 -15
- data/lib/action_view/template/handlers/builder.rb +7 -7
- data/lib/action_view/template/handlers/erb/deprecated_erubis.rb +9 -0
- data/lib/action_view/template/handlers/erb/erubi.rb +81 -0
- data/lib/action_view/template/handlers/erb/erubis.rb +81 -0
- data/lib/action_view/template/handlers/erb.rb +9 -76
- data/lib/action_view/template/handlers.rb +4 -4
- data/lib/action_view/template/html.rb +2 -4
- data/lib/action_view/template/resolver.rb +107 -90
- data/lib/action_view/template/text.rb +5 -8
- data/lib/action_view/template/types.rb +1 -1
- data/lib/action_view/template.rb +26 -27
- data/lib/action_view/test_case.rb +20 -21
- data/lib/action_view/testing/resolvers.rb +29 -30
- data/lib/action_view/version.rb +1 -1
- data/lib/action_view/view_paths.rb +20 -8
- data/lib/action_view.rb +5 -5
- data/lib/assets/compiled/rails-ujs.js +683 -0
- metadata +18 -12
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view/helpers/tags/collection_helpers"
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
@@ -7,9 +7,10 @@ module ActionView
|
|
7
7
|
include CollectionHelpers
|
8
8
|
|
9
9
|
class CheckBoxBuilder < Builder # :nodoc:
|
10
|
-
def check_box(extra_html_options={})
|
10
|
+
def check_box(extra_html_options = {})
|
11
11
|
html_options = extra_html_options.merge(@input_html_options)
|
12
12
|
html_options[:multiple] = true
|
13
|
+
html_options[:skip_default_ids] = false
|
13
14
|
@template_object.check_box(@object_name, @method_name, html_options, @value, nil)
|
14
15
|
end
|
15
16
|
end
|
@@ -20,13 +21,13 @@ module ActionView
|
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
def render_component(builder)
|
25
|
+
builder.check_box + builder.label
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def hidden_field_name
|
29
|
+
"#{super}[]"
|
30
|
+
end
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
@@ -17,7 +17,7 @@ module ActionView
|
|
17
17
|
@input_html_options = input_html_options
|
18
18
|
end
|
19
19
|
|
20
|
-
def label(label_html_options={}, &block)
|
20
|
+
def label(label_html_options = {}, &block)
|
21
21
|
html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options)
|
22
22
|
html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id]
|
23
23
|
|
@@ -36,81 +36,81 @@ module ActionView
|
|
36
36
|
|
37
37
|
private
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# Generate default options for collection helpers, such as :checked and
|
45
|
-
# :disabled.
|
46
|
-
def default_html_options_for_collection(item, value) #:nodoc:
|
47
|
-
html_options = @html_options.dup
|
48
|
-
|
49
|
-
[:checked, :selected, :disabled, :readonly].each do |option|
|
50
|
-
current_value = @options[option]
|
51
|
-
next if current_value.nil?
|
39
|
+
def instantiate_builder(builder_class, item, value, text, html_options)
|
40
|
+
builder_class.new(@template_object, @object_name, @method_name, item,
|
41
|
+
sanitize_attribute_name(value), text, value, html_options)
|
42
|
+
end
|
52
43
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
44
|
+
# Generate default options for collection helpers, such as :checked and
|
45
|
+
# :disabled.
|
46
|
+
def default_html_options_for_collection(item, value)
|
47
|
+
html_options = @html_options.dup
|
48
|
+
|
49
|
+
[:checked, :selected, :disabled, :readonly].each do |option|
|
50
|
+
current_value = @options[option]
|
51
|
+
next if current_value.nil?
|
52
|
+
|
53
|
+
accept = if current_value.respond_to?(:call)
|
54
|
+
current_value.call(item)
|
55
|
+
else
|
56
|
+
Array(current_value).map(&:to_s).include?(value.to_s)
|
57
|
+
end
|
58
|
+
|
59
|
+
if accept
|
60
|
+
html_options[option] = true
|
61
|
+
elsif option == :checked
|
62
|
+
html_options[option] = false
|
63
|
+
end
|
57
64
|
end
|
58
65
|
|
59
|
-
|
60
|
-
|
61
|
-
elsif option == :checked
|
62
|
-
html_options[option] = false
|
63
|
-
end
|
66
|
+
html_options[:object] = @object
|
67
|
+
html_options
|
64
68
|
end
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
def sanitize_attribute_name(value)
|
71
|
+
"#{sanitized_method_name}_#{sanitized_value(value)}"
|
72
|
+
end
|
69
73
|
|
70
|
-
|
71
|
-
|
72
|
-
|
74
|
+
def render_collection
|
75
|
+
@collection.map do |item|
|
76
|
+
value = value_for_collection(item, @value_method)
|
77
|
+
text = value_for_collection(item, @text_method)
|
78
|
+
default_html_options = default_html_options_for_collection(item, value)
|
79
|
+
additional_html_options = option_html_attributes(item)
|
73
80
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
text = value_for_collection(item, @text_method)
|
78
|
-
default_html_options = default_html_options_for_collection(item, value)
|
79
|
-
additional_html_options = option_html_attributes(item)
|
81
|
+
yield item, value, text, default_html_options.merge(additional_html_options)
|
82
|
+
end.join.html_safe
|
83
|
+
end
|
80
84
|
|
81
|
-
|
82
|
-
|
83
|
-
|
85
|
+
def render_collection_for(builder_class, &block)
|
86
|
+
options = @options.stringify_keys
|
87
|
+
rendered_collection = render_collection do |item, value, text, default_html_options|
|
88
|
+
builder = instantiate_builder(builder_class, item, value, text, default_html_options)
|
84
89
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
90
|
+
if block_given?
|
91
|
+
@template_object.capture(builder, &block)
|
92
|
+
else
|
93
|
+
render_component(builder)
|
94
|
+
end
|
95
|
+
end
|
89
96
|
|
90
|
-
|
91
|
-
|
97
|
+
# Prepend a hidden field to make sure something will be sent back to the
|
98
|
+
# server if all radio buttons are unchecked.
|
99
|
+
if options.fetch("include_hidden", true)
|
100
|
+
hidden_field + rendered_collection
|
92
101
|
else
|
93
|
-
|
102
|
+
rendered_collection
|
94
103
|
end
|
95
104
|
end
|
96
105
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
hidden_field + rendered_collection
|
101
|
-
else
|
102
|
-
rendered_collection
|
106
|
+
def hidden_field
|
107
|
+
hidden_name = @html_options[:name] || hidden_field_name
|
108
|
+
@template_object.hidden_field_tag(hidden_name, "", id: nil)
|
103
109
|
end
|
104
|
-
end
|
105
110
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
def hidden_field_name #:nodoc:
|
112
|
-
"#{tag_name(false, @options[:index])}"
|
113
|
-
end
|
111
|
+
def hidden_field_name
|
112
|
+
"#{tag_name(false, @options[:index])}"
|
113
|
+
end
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view/helpers/tags/collection_helpers"
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
@@ -7,8 +7,9 @@ module ActionView
|
|
7
7
|
include CollectionHelpers
|
8
8
|
|
9
9
|
class RadioButtonBuilder < Builder # :nodoc:
|
10
|
-
def radio_button(extra_html_options={})
|
10
|
+
def radio_button(extra_html_options = {})
|
11
11
|
html_options = extra_html_options.merge(@input_html_options)
|
12
|
+
html_options[:skip_default_ids] = false
|
12
13
|
@template_object.radio_button(@object_name, @method_name, @value, html_options)
|
13
14
|
end
|
14
15
|
end
|
@@ -13,8 +13,8 @@ module ActionView
|
|
13
13
|
|
14
14
|
def render
|
15
15
|
option_tags_options = {
|
16
|
-
:
|
17
|
-
:
|
16
|
+
selected: @options.fetch(:selected) { value(@object) },
|
17
|
+
disabled: @options[:disabled]
|
18
18
|
}
|
19
19
|
|
20
20
|
select_content_tag(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "active_support/core_ext/time/calculations"
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
@@ -16,56 +16,56 @@ module ActionView
|
|
16
16
|
|
17
17
|
class << self
|
18
18
|
def select_type
|
19
|
-
@select_type ||=
|
19
|
+
@select_type ||= name.split("::").last.sub("Select", "").downcase
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def select_type
|
26
|
+
self.class.select_type
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def datetime_selector(options, html_options)
|
30
|
+
datetime = options.fetch(:selected) { value(object) || default_datetime(options) }
|
31
|
+
@auto_index ||= nil
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
options = options.dup
|
34
|
+
options[:field_name] = @method_name
|
35
|
+
options[:include_position] = true
|
36
|
+
options[:prefix] ||= @object_name
|
37
|
+
options[:index] = @auto_index if @auto_index && !options.has_key?(:index)
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
DateTimeSelector.new(datetime, options, html_options)
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
def default_datetime(options)
|
43
|
+
return if options[:include_blank] || options[:prompt]
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
case options[:default]
|
46
|
+
when nil
|
47
|
+
Time.current
|
48
|
+
when Date, Time
|
49
|
+
options[:default]
|
50
|
+
else
|
51
|
+
default = options[:default].dup
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
# Rename :minute and :second to :min and :sec
|
54
|
+
default[:min] ||= default[:minute]
|
55
|
+
default[:sec] ||= default[:second]
|
56
56
|
|
57
|
-
|
57
|
+
time = Time.current
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
[:year, :month, :day, :hour, :min, :sec].each do |key|
|
60
|
+
default[key] ||= time.send(key)
|
61
|
+
end
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
Time.utc(
|
64
|
+
default[:year], default[:month], default[:day],
|
65
|
+
default[:hour], default[:min], default[:sec]
|
66
|
+
)
|
67
|
+
end
|
67
68
|
end
|
68
|
-
end
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -15,8 +15,8 @@ module ActionView
|
|
15
15
|
|
16
16
|
def render
|
17
17
|
option_tags_options = {
|
18
|
-
:
|
19
|
-
:
|
18
|
+
selected: @options.fetch(:selected) { value(@object) },
|
19
|
+
disabled: @options[:disabled]
|
20
20
|
}
|
21
21
|
|
22
22
|
select_content_tag(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view/helpers/tags/checkable"
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
@@ -22,9 +22,9 @@ module ActionView
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def checked?(value)
|
26
|
+
value.to_s == @tag_value.to_s
|
27
|
+
end
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -13,8 +13,8 @@ module ActionView
|
|
13
13
|
|
14
14
|
def render
|
15
15
|
option_tags_options = {
|
16
|
-
:
|
17
|
-
:
|
16
|
+
selected: @options.fetch(:selected) { value(@object) },
|
17
|
+
disabled: @options[:disabled]
|
18
18
|
}
|
19
19
|
|
20
20
|
option_tags = if grouped_choices?
|
@@ -28,13 +28,13 @@ module ActionView
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
# Grouped choices look like this:
|
32
|
+
#
|
33
|
+
# [nil, []]
|
34
|
+
# { nil => [] }
|
35
|
+
def grouped_choices?
|
36
|
+
!@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last
|
37
|
+
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view/helpers/tags/placeholderable"
|
2
2
|
|
3
3
|
module ActionView
|
4
4
|
module Helpers
|
@@ -17,15 +17,15 @@ module ActionView
|
|
17
17
|
|
18
18
|
class << self
|
19
19
|
def field_type
|
20
|
-
@field_type ||=
|
20
|
+
@field_type ||= name.split("::").last.sub("Field", "").downcase
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def field_type
|
27
|
+
self.class.field_type
|
28
|
+
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -14,26 +14,28 @@ module ActionView
|
|
14
14
|
translated_attribute || human_attribute_name
|
15
15
|
end
|
16
16
|
|
17
|
+
# TODO Change this to private once we've dropped Ruby 2.2 support.
|
18
|
+
# Workaround for Ruby 2.2 "private attribute?" warning.
|
17
19
|
protected
|
18
20
|
|
19
|
-
|
21
|
+
attr_reader :object_name, :method_and_value, :scope, :model
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
def i18n_default
|
26
|
+
if model
|
27
|
+
key = model.model_name.i18n_key
|
28
|
+
["#{key}.#{method_and_value}".to_sym, ""]
|
29
|
+
else
|
30
|
+
""
|
31
|
+
end
|
29
32
|
end
|
30
|
-
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
def human_attribute_name
|
35
|
+
if model && model.class.respond_to?(:human_attribute_name)
|
36
|
+
model.class.human_attribute_name(method_and_value)
|
37
|
+
end
|
35
38
|
end
|
36
|
-
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_support/core_ext/string/filters"
|
2
|
+
require "active_support/core_ext/array/extract_options"
|
3
3
|
|
4
4
|
module ActionView
|
5
5
|
# = Action View Text Helpers
|
@@ -135,7 +135,7 @@ module ActionView
|
|
135
135
|
else
|
136
136
|
match = Array(phrases).map do |p|
|
137
137
|
Regexp === p ? p.to_s : Regexp.escape(p)
|
138
|
-
end.join(
|
138
|
+
end.join("|")
|
139
139
|
|
140
140
|
if block_given?
|
141
141
|
text.gsub(/(#{match})(?![^<]*?>)/i) { |found| yield found }
|
@@ -151,7 +151,7 @@ module ActionView
|
|
151
151
|
# defined in <tt>:radius</tt> (which defaults to 100). If the excerpt radius overflows the beginning or end of the +text+,
|
152
152
|
# then the <tt>:omission</tt> option (which defaults to "...") will be prepended/appended accordingly. Use the
|
153
153
|
# <tt>:separator</tt> option to choose the delimitation. The resulting string will be stripped in any case. If the +phrase+
|
154
|
-
# isn't found, nil is returned.
|
154
|
+
# isn't found, +nil+ is returned.
|
155
155
|
#
|
156
156
|
# excerpt('This is an example', 'an', radius: 5)
|
157
157
|
# # => ...s is an exam...
|
@@ -187,7 +187,7 @@ module ActionView
|
|
187
187
|
unless separator.empty?
|
188
188
|
text.split(separator).each do |value|
|
189
189
|
if value.match(regex)
|
190
|
-
|
190
|
+
phrase = value
|
191
191
|
break
|
192
192
|
end
|
193
193
|
end
|
@@ -262,10 +262,11 @@ module ActionView
|
|
262
262
|
end
|
263
263
|
|
264
264
|
# Returns +text+ transformed into HTML using simple formatting rules.
|
265
|
-
# Two or more consecutive newlines(<tt>\n\n</tt>) are
|
266
|
-
# paragraph and wrapped in <tt><p></tt> tags. One newline
|
267
|
-
#
|
268
|
-
# method does not remove the
|
265
|
+
# Two or more consecutive newlines(<tt>\n\n</tt> or <tt>\r\n\r\n</tt>) are
|
266
|
+
# considered a paragraph and wrapped in <tt><p></tt> tags. One newline
|
267
|
+
# (<tt>\n</tt> or <tt>\r\n</tt>) is considered a linebreak and a
|
268
|
+
# <tt><br /></tt> tag is appended. This method does not remove the
|
269
|
+
# newlines from the +text+.
|
269
270
|
#
|
270
271
|
# You can pass any HTML attributes into <tt>html_options</tt>. These
|
271
272
|
# will be added to all created paragraphs.
|
@@ -350,7 +351,7 @@ module ActionView
|
|
350
351
|
# <% end %>
|
351
352
|
def cycle(first_value, *values)
|
352
353
|
options = values.extract_options!
|
353
|
-
name = options.fetch(:name,
|
354
|
+
name = options.fetch(:name, "default")
|
354
355
|
|
355
356
|
values.unshift(*first_value)
|
356
357
|
|
@@ -424,17 +425,17 @@ module ActionView
|
|
424
425
|
|
425
426
|
private
|
426
427
|
|
427
|
-
|
428
|
-
|
429
|
-
|
428
|
+
def next_index
|
429
|
+
step_index(1)
|
430
|
+
end
|
430
431
|
|
431
|
-
|
432
|
-
|
433
|
-
|
432
|
+
def previous_index
|
433
|
+
step_index(-1)
|
434
|
+
end
|
434
435
|
|
435
|
-
|
436
|
-
|
437
|
-
|
436
|
+
def step_index(n)
|
437
|
+
(@index + n) % @values.size
|
438
|
+
end
|
438
439
|
end
|
439
440
|
|
440
441
|
private
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "action_view/helpers/tag_helper"
|
2
|
+
require "active_support/core_ext/string/access"
|
3
|
+
require "i18n/exceptions"
|
4
4
|
|
5
5
|
module ActionView
|
6
6
|
# = Action View Translation Helpers
|
@@ -100,12 +100,12 @@ module ActionView
|
|
100
100
|
|
101
101
|
interpolations = options.except(:default, :scope)
|
102
102
|
if interpolations.any?
|
103
|
-
title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(
|
103
|
+
title << ", " << interpolations.map { |k, v| "#{k}: #{ERB::Util.html_escape(v)}" }.join(", ")
|
104
104
|
end
|
105
105
|
|
106
106
|
return title unless ActionView::Base.debug_missing_translation
|
107
107
|
|
108
|
-
content_tag(
|
108
|
+
content_tag("span", keys.last.to_s.titleize, class: "translation_missing", title: title)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
alias :t :translate
|
@@ -133,7 +133,7 @@ module ActionView
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def html_safe_translation_key?(key)
|
136
|
-
|
136
|
+
/(\b|_|\.)html$/.match?(key.to_s)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|