actionpack 3.2.19 → 4.2.11.3
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 +7 -0
- data/CHANGELOG.md +412 -503
- data/MIT-LICENSE +1 -1
- data/README.rdoc +11 -294
- data/lib/abstract_controller/asset_paths.rb +2 -2
- data/lib/abstract_controller/base.rb +52 -18
- data/lib/abstract_controller/callbacks.rb +87 -89
- data/lib/abstract_controller/collector.rb +17 -3
- data/lib/abstract_controller/helpers.rb +41 -14
- data/lib/abstract_controller/logger.rb +1 -2
- data/lib/abstract_controller/railties/routes_helpers.rb +3 -3
- data/lib/abstract_controller/rendering.rb +65 -118
- data/lib/abstract_controller/translation.rb +16 -1
- data/lib/abstract_controller/url_for.rb +7 -7
- data/lib/abstract_controller.rb +2 -10
- data/lib/action_controller/base.rb +61 -28
- data/lib/action_controller/caching/fragments.rb +30 -54
- data/lib/action_controller/caching.rb +38 -35
- data/lib/action_controller/log_subscriber.rb +35 -18
- data/lib/action_controller/metal/conditional_get.rb +103 -34
- data/lib/action_controller/metal/data_streaming.rb +20 -26
- data/lib/action_controller/metal/etag_with_template_digest.rb +50 -0
- data/lib/action_controller/metal/exceptions.rb +19 -6
- data/lib/action_controller/metal/flash.rb +41 -9
- data/lib/action_controller/metal/force_ssl.rb +70 -12
- data/lib/action_controller/metal/head.rb +30 -7
- data/lib/action_controller/metal/helpers.rb +11 -11
- data/lib/action_controller/metal/hide_actions.rb +0 -1
- data/lib/action_controller/metal/http_authentication.rb +140 -94
- data/lib/action_controller/metal/implicit_render.rb +1 -1
- data/lib/action_controller/metal/instrumentation.rb +11 -7
- data/lib/action_controller/metal/live.rb +328 -0
- data/lib/action_controller/metal/mime_responds.rb +161 -152
- data/lib/action_controller/metal/params_wrapper.rb +126 -81
- data/lib/action_controller/metal/rack_delegation.rb +10 -4
- data/lib/action_controller/metal/redirecting.rb +44 -41
- data/lib/action_controller/metal/renderers.rb +48 -19
- data/lib/action_controller/metal/rendering.rb +46 -11
- data/lib/action_controller/metal/request_forgery_protection.rb +250 -29
- data/lib/action_controller/metal/streaming.rb +30 -38
- data/lib/action_controller/metal/strong_parameters.rb +669 -0
- data/lib/action_controller/metal/testing.rb +12 -18
- data/lib/action_controller/metal/url_for.rb +31 -29
- data/lib/action_controller/metal.rb +31 -40
- data/lib/action_controller/model_naming.rb +12 -0
- data/lib/action_controller/railtie.rb +38 -18
- data/lib/action_controller/railties/helpers.rb +22 -0
- data/lib/action_controller/test_case.rb +359 -173
- data/lib/action_controller.rb +9 -16
- data/lib/action_dispatch/http/cache.rb +64 -11
- data/lib/action_dispatch/http/filter_parameters.rb +20 -10
- data/lib/action_dispatch/http/filter_redirect.rb +38 -0
- data/lib/action_dispatch/http/headers.rb +85 -17
- data/lib/action_dispatch/http/mime_negotiation.rb +55 -5
- data/lib/action_dispatch/http/mime_type.rb +167 -114
- data/lib/action_dispatch/http/mime_types.rb +2 -1
- data/lib/action_dispatch/http/parameter_filter.rb +44 -46
- data/lib/action_dispatch/http/parameters.rb +30 -46
- data/lib/action_dispatch/http/rack_cache.rb +2 -3
- data/lib/action_dispatch/http/request.rb +108 -45
- data/lib/action_dispatch/http/response.rb +247 -48
- data/lib/action_dispatch/http/upload.rb +60 -29
- data/lib/action_dispatch/http/url.rb +135 -45
- data/lib/action_dispatch/journey/backwards.rb +5 -0
- data/lib/action_dispatch/journey/formatter.rb +166 -0
- data/lib/action_dispatch/journey/gtg/builder.rb +162 -0
- data/lib/action_dispatch/journey/gtg/simulator.rb +47 -0
- data/lib/action_dispatch/journey/gtg/transition_table.rb +157 -0
- data/lib/action_dispatch/journey/nfa/builder.rb +76 -0
- data/lib/action_dispatch/journey/nfa/dot.rb +36 -0
- data/lib/action_dispatch/journey/nfa/simulator.rb +47 -0
- data/lib/action_dispatch/journey/nfa/transition_table.rb +163 -0
- data/lib/action_dispatch/journey/nodes/node.rb +128 -0
- data/lib/action_dispatch/journey/parser.rb +198 -0
- data/lib/action_dispatch/journey/parser.y +49 -0
- data/lib/action_dispatch/journey/parser_extras.rb +23 -0
- data/lib/action_dispatch/journey/path/pattern.rb +193 -0
- data/lib/action_dispatch/journey/route.rb +125 -0
- data/lib/action_dispatch/journey/router/strexp.rb +27 -0
- data/lib/action_dispatch/journey/router/utils.rb +93 -0
- data/lib/action_dispatch/journey/router.rb +144 -0
- data/lib/action_dispatch/journey/routes.rb +80 -0
- data/lib/action_dispatch/journey/scanner.rb +61 -0
- data/lib/action_dispatch/journey/visitors.rb +221 -0
- data/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
- data/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
- data/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
- data/lib/action_dispatch/journey.rb +5 -0
- data/lib/action_dispatch/middleware/callbacks.rb +16 -11
- data/lib/action_dispatch/middleware/cookies.rb +346 -125
- data/lib/action_dispatch/middleware/debug_exceptions.rb +52 -24
- data/lib/action_dispatch/middleware/exception_wrapper.rb +75 -9
- data/lib/action_dispatch/middleware/flash.rb +85 -72
- data/lib/action_dispatch/middleware/params_parser.rb +16 -31
- data/lib/action_dispatch/middleware/public_exceptions.rb +39 -14
- data/lib/action_dispatch/middleware/reloader.rb +16 -7
- data/lib/action_dispatch/middleware/remote_ip.rb +132 -40
- data/lib/action_dispatch/middleware/request_id.rb +3 -7
- data/lib/action_dispatch/middleware/session/abstract_store.rb +22 -20
- data/lib/action_dispatch/middleware/session/cache_store.rb +3 -3
- data/lib/action_dispatch/middleware/session/cookie_store.rb +84 -29
- data/lib/action_dispatch/middleware/session/mem_cache_store.rb +8 -3
- data/lib/action_dispatch/middleware/show_exceptions.rb +15 -44
- data/lib/action_dispatch/middleware/ssl.rb +72 -0
- data/lib/action_dispatch/middleware/stack.rb +6 -1
- data/lib/action_dispatch/middleware/static.rb +80 -23
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +34 -0
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
- data/lib/action_dispatch/middleware/templates/rescues/_source.erb +27 -0
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
- data/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +133 -5
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
- data/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
- data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
- data/lib/action_dispatch/railtie.rb +19 -6
- data/lib/action_dispatch/request/session.rb +193 -0
- data/lib/action_dispatch/request/utils.rb +35 -0
- data/lib/action_dispatch/routing/endpoint.rb +10 -0
- data/lib/action_dispatch/routing/inspector.rb +234 -0
- data/lib/action_dispatch/routing/mapper.rb +897 -436
- data/lib/action_dispatch/routing/polymorphic_routes.rb +213 -92
- data/lib/action_dispatch/routing/redirection.rb +97 -37
- data/lib/action_dispatch/routing/route_set.rb +432 -239
- data/lib/action_dispatch/routing/routes_proxy.rb +7 -4
- data/lib/action_dispatch/routing/url_for.rb +63 -34
- data/lib/action_dispatch/routing.rb +57 -89
- data/lib/action_dispatch/testing/assertions/dom.rb +2 -36
- data/lib/action_dispatch/testing/assertions/response.rb +24 -38
- data/lib/action_dispatch/testing/assertions/routing.rb +55 -54
- data/lib/action_dispatch/testing/assertions/selector.rb +2 -434
- data/lib/action_dispatch/testing/assertions/tag.rb +2 -137
- data/lib/action_dispatch/testing/assertions.rb +11 -7
- data/lib/action_dispatch/testing/integration.rb +88 -72
- data/lib/action_dispatch/testing/test_process.rb +9 -6
- data/lib/action_dispatch/testing/test_request.rb +13 -9
- data/lib/action_dispatch/testing/test_response.rb +1 -5
- data/lib/action_dispatch.rb +24 -21
- data/lib/action_pack/gem_version.rb +15 -0
- data/lib/action_pack/version.rb +5 -7
- data/lib/action_pack.rb +1 -1
- metadata +181 -292
- data/lib/abstract_controller/layouts.rb +0 -423
- data/lib/abstract_controller/view_paths.rb +0 -96
- data/lib/action_controller/caching/actions.rb +0 -185
- data/lib/action_controller/caching/pages.rb +0 -187
- data/lib/action_controller/caching/sweeping.rb +0 -97
- data/lib/action_controller/deprecated/integration_test.rb +0 -2
- data/lib/action_controller/deprecated/performance_test.rb +0 -1
- data/lib/action_controller/deprecated.rb +0 -3
- data/lib/action_controller/metal/compatibility.rb +0 -65
- data/lib/action_controller/metal/responder.rb +0 -286
- data/lib/action_controller/metal/session_management.rb +0 -14
- data/lib/action_controller/railties/paths.rb +0 -25
- data/lib/action_controller/record_identifier.rb +0 -85
- data/lib/action_controller/vendor/html-scanner/html/document.rb +0 -68
- data/lib/action_controller/vendor/html-scanner/html/node.rb +0 -532
- data/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +0 -177
- data/lib/action_controller/vendor/html-scanner/html/selector.rb +0 -830
- data/lib/action_controller/vendor/html-scanner/html/tokenizer.rb +0 -107
- data/lib/action_controller/vendor/html-scanner/html/version.rb +0 -11
- data/lib/action_controller/vendor/html-scanner.rb +0 -20
- data/lib/action_dispatch/middleware/best_standards_support.rb +0 -30
- data/lib/action_dispatch/middleware/body_proxy.rb +0 -30
- data/lib/action_dispatch/middleware/head.rb +0 -18
- data/lib/action_dispatch/middleware/rescue.rb +0 -26
- data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb +0 -31
- data/lib/action_dispatch/middleware/templates/rescues/_trace.erb +0 -26
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb +0 -10
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.erb +0 -2
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.erb +0 -15
- data/lib/action_dispatch/middleware/templates/rescues/template_error.erb +0 -17
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb +0 -2
- data/lib/action_dispatch/testing/performance_test.rb +0 -10
- data/lib/action_view/asset_paths.rb +0 -142
- data/lib/action_view/base.rb +0 -220
- data/lib/action_view/buffers.rb +0 -43
- data/lib/action_view/context.rb +0 -36
- data/lib/action_view/flows.rb +0 -79
- data/lib/action_view/helpers/active_model_helper.rb +0 -50
- data/lib/action_view/helpers/asset_paths.rb +0 -7
- data/lib/action_view/helpers/asset_tag_helper.rb +0 -457
- data/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb +0 -146
- data/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb +0 -93
- data/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb +0 -193
- data/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb +0 -148
- data/lib/action_view/helpers/atom_feed_helper.rb +0 -200
- data/lib/action_view/helpers/cache_helper.rb +0 -64
- data/lib/action_view/helpers/capture_helper.rb +0 -203
- data/lib/action_view/helpers/controller_helper.rb +0 -25
- data/lib/action_view/helpers/csrf_helper.rb +0 -32
- data/lib/action_view/helpers/date_helper.rb +0 -1062
- data/lib/action_view/helpers/debug_helper.rb +0 -40
- data/lib/action_view/helpers/form_helper.rb +0 -1486
- data/lib/action_view/helpers/form_options_helper.rb +0 -658
- data/lib/action_view/helpers/form_tag_helper.rb +0 -685
- data/lib/action_view/helpers/javascript_helper.rb +0 -110
- data/lib/action_view/helpers/number_helper.rb +0 -622
- data/lib/action_view/helpers/output_safety_helper.rb +0 -38
- data/lib/action_view/helpers/record_tag_helper.rb +0 -111
- data/lib/action_view/helpers/rendering_helper.rb +0 -90
- data/lib/action_view/helpers/sanitize_helper.rb +0 -259
- data/lib/action_view/helpers/tag_helper.rb +0 -160
- data/lib/action_view/helpers/text_helper.rb +0 -426
- data/lib/action_view/helpers/translation_helper.rb +0 -91
- data/lib/action_view/helpers/url_helper.rb +0 -693
- data/lib/action_view/helpers.rb +0 -60
- data/lib/action_view/locale/en.yml +0 -160
- data/lib/action_view/log_subscriber.rb +0 -28
- data/lib/action_view/lookup_context.rb +0 -254
- data/lib/action_view/path_set.rb +0 -89
- data/lib/action_view/railtie.rb +0 -55
- data/lib/action_view/renderer/abstract_renderer.rb +0 -41
- data/lib/action_view/renderer/partial_renderer.rb +0 -415
- data/lib/action_view/renderer/renderer.rb +0 -54
- data/lib/action_view/renderer/streaming_template_renderer.rb +0 -106
- data/lib/action_view/renderer/template_renderer.rb +0 -94
- data/lib/action_view/template/error.rb +0 -128
- data/lib/action_view/template/handlers/builder.rb +0 -26
- data/lib/action_view/template/handlers/erb.rb +0 -125
- data/lib/action_view/template/handlers.rb +0 -50
- data/lib/action_view/template/resolver.rb +0 -272
- data/lib/action_view/template/text.rb +0 -30
- data/lib/action_view/template.rb +0 -337
- data/lib/action_view/test_case.rb +0 -245
- data/lib/action_view/testing/resolvers.rb +0 -50
- data/lib/action_view.rb +0 -84
- data/lib/sprockets/assets.rake +0 -99
- data/lib/sprockets/bootstrap.rb +0 -37
- data/lib/sprockets/compressors.rb +0 -83
- data/lib/sprockets/helpers/isolated_helper.rb +0 -13
- data/lib/sprockets/helpers/rails_helper.rb +0 -182
- data/lib/sprockets/helpers.rb +0 -6
- data/lib/sprockets/railtie.rb +0 -62
- data/lib/sprockets/static_compiler.rb +0 -56
data/lib/action_view/helpers.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'active_support/benchmarkable'
|
2
|
-
|
3
|
-
module ActionView #:nodoc:
|
4
|
-
module Helpers #:nodoc:
|
5
|
-
extend ActiveSupport::Autoload
|
6
|
-
|
7
|
-
autoload :ActiveModelHelper
|
8
|
-
autoload :AssetTagHelper
|
9
|
-
autoload :AtomFeedHelper
|
10
|
-
autoload :CacheHelper
|
11
|
-
autoload :CaptureHelper
|
12
|
-
autoload :ControllerHelper
|
13
|
-
autoload :CsrfHelper
|
14
|
-
autoload :DateHelper
|
15
|
-
autoload :DebugHelper
|
16
|
-
autoload :FormHelper
|
17
|
-
autoload :FormOptionsHelper
|
18
|
-
autoload :FormTagHelper
|
19
|
-
autoload :JavaScriptHelper, "action_view/helpers/javascript_helper"
|
20
|
-
autoload :NumberHelper
|
21
|
-
autoload :OutputSafetyHelper
|
22
|
-
autoload :RecordTagHelper
|
23
|
-
autoload :RenderingHelper
|
24
|
-
autoload :SanitizeHelper
|
25
|
-
autoload :TagHelper
|
26
|
-
autoload :TextHelper
|
27
|
-
autoload :TranslationHelper
|
28
|
-
autoload :UrlHelper
|
29
|
-
|
30
|
-
extend ActiveSupport::Concern
|
31
|
-
|
32
|
-
included do
|
33
|
-
extend SanitizeHelper::ClassMethods
|
34
|
-
end
|
35
|
-
|
36
|
-
include ActiveSupport::Benchmarkable
|
37
|
-
include ActiveModelHelper
|
38
|
-
include AssetTagHelper
|
39
|
-
include AtomFeedHelper
|
40
|
-
include CacheHelper
|
41
|
-
include CaptureHelper
|
42
|
-
include ControllerHelper
|
43
|
-
include CsrfHelper
|
44
|
-
include DateHelper
|
45
|
-
include DebugHelper
|
46
|
-
include FormHelper
|
47
|
-
include FormOptionsHelper
|
48
|
-
include FormTagHelper
|
49
|
-
include JavaScriptHelper
|
50
|
-
include NumberHelper
|
51
|
-
include OutputSafetyHelper
|
52
|
-
include RecordTagHelper
|
53
|
-
include RenderingHelper
|
54
|
-
include SanitizeHelper
|
55
|
-
include TagHelper
|
56
|
-
include TextHelper
|
57
|
-
include TranslationHelper
|
58
|
-
include UrlHelper
|
59
|
-
end
|
60
|
-
end
|
@@ -1,160 +0,0 @@
|
|
1
|
-
"en":
|
2
|
-
number:
|
3
|
-
# Used in number_with_delimiter()
|
4
|
-
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
|
5
|
-
format:
|
6
|
-
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
|
7
|
-
separator: "."
|
8
|
-
# Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three)
|
9
|
-
delimiter: ","
|
10
|
-
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
|
11
|
-
precision: 3
|
12
|
-
# If set to true, precision will mean the number of significant digits instead
|
13
|
-
# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
|
14
|
-
significant: false
|
15
|
-
# If set, the zeros after the decimal separator will always be stripped (eg.: 1.200 will be 1.2)
|
16
|
-
strip_insignificant_zeros: false
|
17
|
-
|
18
|
-
# Used in number_to_currency()
|
19
|
-
currency:
|
20
|
-
format:
|
21
|
-
# Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
|
22
|
-
format: "%u%n"
|
23
|
-
unit: "$"
|
24
|
-
# These five are to override number.format and are optional
|
25
|
-
separator: "."
|
26
|
-
delimiter: ","
|
27
|
-
precision: 2
|
28
|
-
significant: false
|
29
|
-
strip_insignificant_zeros: false
|
30
|
-
|
31
|
-
# Used in number_to_percentage()
|
32
|
-
percentage:
|
33
|
-
format:
|
34
|
-
# These five are to override number.format and are optional
|
35
|
-
# separator:
|
36
|
-
delimiter: ""
|
37
|
-
# precision:
|
38
|
-
# significant: false
|
39
|
-
# strip_insignificant_zeros: false
|
40
|
-
|
41
|
-
# Used in number_to_precision()
|
42
|
-
precision:
|
43
|
-
format:
|
44
|
-
# These five are to override number.format and are optional
|
45
|
-
# separator:
|
46
|
-
delimiter: ""
|
47
|
-
# precision:
|
48
|
-
# significant: false
|
49
|
-
# strip_insignificant_zeros: false
|
50
|
-
|
51
|
-
# Used in number_to_human_size() and number_to_human()
|
52
|
-
human:
|
53
|
-
format:
|
54
|
-
# These five are to override number.format and are optional
|
55
|
-
# separator:
|
56
|
-
delimiter: ""
|
57
|
-
precision: 3
|
58
|
-
significant: true
|
59
|
-
strip_insignificant_zeros: true
|
60
|
-
# Used in number_to_human_size()
|
61
|
-
storage_units:
|
62
|
-
# Storage units output formatting.
|
63
|
-
# %u is the storage unit, %n is the number (default: 2 MB)
|
64
|
-
format: "%n %u"
|
65
|
-
units:
|
66
|
-
byte:
|
67
|
-
one: "Byte"
|
68
|
-
other: "Bytes"
|
69
|
-
kb: "KB"
|
70
|
-
mb: "MB"
|
71
|
-
gb: "GB"
|
72
|
-
tb: "TB"
|
73
|
-
# Used in number_to_human()
|
74
|
-
decimal_units:
|
75
|
-
format: "%n %u"
|
76
|
-
# Decimal units output formatting
|
77
|
-
# By default we will only quantify some of the exponents
|
78
|
-
# but the commented ones might be defined or overridden
|
79
|
-
# by the user.
|
80
|
-
units:
|
81
|
-
# femto: Quadrillionth
|
82
|
-
# pico: Trillionth
|
83
|
-
# nano: Billionth
|
84
|
-
# micro: Millionth
|
85
|
-
# mili: Thousandth
|
86
|
-
# centi: Hundredth
|
87
|
-
# deci: Tenth
|
88
|
-
unit: ""
|
89
|
-
# ten:
|
90
|
-
# one: Ten
|
91
|
-
# other: Tens
|
92
|
-
# hundred: Hundred
|
93
|
-
thousand: Thousand
|
94
|
-
million: Million
|
95
|
-
billion: Billion
|
96
|
-
trillion: Trillion
|
97
|
-
quadrillion: Quadrillion
|
98
|
-
|
99
|
-
# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
100
|
-
datetime:
|
101
|
-
distance_in_words:
|
102
|
-
half_a_minute: "half a minute"
|
103
|
-
less_than_x_seconds:
|
104
|
-
one: "less than 1 second"
|
105
|
-
other: "less than %{count} seconds"
|
106
|
-
x_seconds:
|
107
|
-
one: "1 second"
|
108
|
-
other: "%{count} seconds"
|
109
|
-
less_than_x_minutes:
|
110
|
-
one: "less than a minute"
|
111
|
-
other: "less than %{count} minutes"
|
112
|
-
x_minutes:
|
113
|
-
one: "1 minute"
|
114
|
-
other: "%{count} minutes"
|
115
|
-
about_x_hours:
|
116
|
-
one: "about 1 hour"
|
117
|
-
other: "about %{count} hours"
|
118
|
-
x_days:
|
119
|
-
one: "1 day"
|
120
|
-
other: "%{count} days"
|
121
|
-
about_x_months:
|
122
|
-
one: "about 1 month"
|
123
|
-
other: "about %{count} months"
|
124
|
-
x_months:
|
125
|
-
one: "1 month"
|
126
|
-
other: "%{count} months"
|
127
|
-
about_x_years:
|
128
|
-
one: "about 1 year"
|
129
|
-
other: "about %{count} years"
|
130
|
-
over_x_years:
|
131
|
-
one: "over 1 year"
|
132
|
-
other: "over %{count} years"
|
133
|
-
almost_x_years:
|
134
|
-
one: "almost 1 year"
|
135
|
-
other: "almost %{count} years"
|
136
|
-
prompts:
|
137
|
-
year: "Year"
|
138
|
-
month: "Month"
|
139
|
-
day: "Day"
|
140
|
-
hour: "Hour"
|
141
|
-
minute: "Minute"
|
142
|
-
second: "Seconds"
|
143
|
-
|
144
|
-
helpers:
|
145
|
-
select:
|
146
|
-
# Default value for :prompt => true in FormOptionsHelper
|
147
|
-
prompt: "Please select"
|
148
|
-
|
149
|
-
# Default translation keys for submit FormHelper
|
150
|
-
submit:
|
151
|
-
create: 'Create %{model}'
|
152
|
-
update: 'Update %{model}'
|
153
|
-
submit: 'Save %{model}'
|
154
|
-
|
155
|
-
# Default translation keys for button FormHelper
|
156
|
-
button:
|
157
|
-
create: 'Create %{model}'
|
158
|
-
update: 'Update %{model}'
|
159
|
-
submit: 'Save %{model}'
|
160
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module ActionView
|
2
|
-
# = Action View Log Subscriber
|
3
|
-
#
|
4
|
-
# Provides functionality so that Rails can output logs from Action View.
|
5
|
-
class LogSubscriber < ActiveSupport::LogSubscriber
|
6
|
-
def render_template(event)
|
7
|
-
message = " Rendered #{from_rails_root(event.payload[:identifier])}"
|
8
|
-
message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
|
9
|
-
message << (" (%.1fms)" % event.duration)
|
10
|
-
info(message)
|
11
|
-
end
|
12
|
-
alias :render_partial :render_template
|
13
|
-
alias :render_collection :render_template
|
14
|
-
|
15
|
-
# TODO: Ideally, ActionView should have its own logger so it does not depend on AC.logger
|
16
|
-
def logger
|
17
|
-
ActionController::Base.logger if defined?(ActionController::Base)
|
18
|
-
end
|
19
|
-
|
20
|
-
protected
|
21
|
-
|
22
|
-
def from_rails_root(string)
|
23
|
-
string.sub("#{Rails.root}/", "").sub(/^app\/views\//, "")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
ActionView::LogSubscriber.attach_to :action_view
|
@@ -1,254 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/array/wrap'
|
2
|
-
require 'active_support/core_ext/object/blank'
|
3
|
-
require 'active_support/core_ext/module/remove_method'
|
4
|
-
|
5
|
-
module ActionView
|
6
|
-
# = Action View Lookup Context
|
7
|
-
#
|
8
|
-
# LookupContext is the object responsible to hold all information required to lookup
|
9
|
-
# templates, i.e. view paths and details. The LookupContext is also responsible to
|
10
|
-
# generate a key, given to view paths, used in the resolver cache lookup. Since
|
11
|
-
# this key is generated just once during the request, it speeds up all cache accesses.
|
12
|
-
class LookupContext #:nodoc:
|
13
|
-
attr_accessor :prefixes, :rendered_format
|
14
|
-
|
15
|
-
mattr_accessor :fallbacks
|
16
|
-
@@fallbacks = FallbackFileSystemResolver.instances
|
17
|
-
|
18
|
-
mattr_accessor :registered_details
|
19
|
-
self.registered_details = []
|
20
|
-
|
21
|
-
def self.register_detail(name, options = {}, &block)
|
22
|
-
self.registered_details << name
|
23
|
-
initialize = registered_details.map { |n| "@details[:#{n}] = details[:#{n}] || default_#{n}" }
|
24
|
-
|
25
|
-
Accessors.send :define_method, :"default_#{name}", &block
|
26
|
-
Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1
|
27
|
-
def #{name}
|
28
|
-
@details[:#{name}]
|
29
|
-
end
|
30
|
-
|
31
|
-
def #{name}=(value)
|
32
|
-
value = value.present? ? Array.wrap(value) : default_#{name}
|
33
|
-
_set_detail(:#{name}, value) if value != @details[:#{name}]
|
34
|
-
end
|
35
|
-
|
36
|
-
remove_possible_method :initialize_details
|
37
|
-
def initialize_details(details)
|
38
|
-
#{initialize.join("\n")}
|
39
|
-
end
|
40
|
-
METHOD
|
41
|
-
end
|
42
|
-
|
43
|
-
# Holds accessors for the registered details.
|
44
|
-
module Accessors #:nodoc:
|
45
|
-
end
|
46
|
-
|
47
|
-
register_detail(:locale) do
|
48
|
-
locales = [I18n.locale]
|
49
|
-
locales.concat(I18n.fallbacks[I18n.locale]) if I18n.respond_to? :fallbacks
|
50
|
-
locales << I18n.default_locale
|
51
|
-
locales.uniq!
|
52
|
-
locales
|
53
|
-
end
|
54
|
-
register_detail(:formats) { Mime::SET.symbols }
|
55
|
-
register_detail(:handlers){ Template::Handlers.extensions }
|
56
|
-
|
57
|
-
class DetailsKey #:nodoc:
|
58
|
-
alias :eql? :equal?
|
59
|
-
alias :object_hash :hash
|
60
|
-
|
61
|
-
attr_reader :hash
|
62
|
-
@details_keys = Hash.new
|
63
|
-
|
64
|
-
def self.get(details)
|
65
|
-
if details[:formats]
|
66
|
-
details = details.dup
|
67
|
-
syms = Set.new Mime::SET.symbols
|
68
|
-
details[:formats] = details[:formats].select { |v|
|
69
|
-
syms.include? v
|
70
|
-
}
|
71
|
-
end
|
72
|
-
@details_keys[details] ||= new
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.clear
|
76
|
-
@details_keys.clear
|
77
|
-
end
|
78
|
-
|
79
|
-
def initialize
|
80
|
-
@hash = object_hash
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Add caching behavior on top of Details.
|
85
|
-
module DetailsCache
|
86
|
-
attr_accessor :cache
|
87
|
-
|
88
|
-
# Calculate the details key. Remove the handlers from calculation to improve performance
|
89
|
-
# since the user cannot modify it explicitly.
|
90
|
-
def details_key #:nodoc:
|
91
|
-
@details_key ||= DetailsKey.get(@details) if @cache
|
92
|
-
end
|
93
|
-
|
94
|
-
# Temporary skip passing the details_key forward.
|
95
|
-
def disable_cache
|
96
|
-
old_value, @cache = @cache, false
|
97
|
-
yield
|
98
|
-
ensure
|
99
|
-
@cache = old_value
|
100
|
-
end
|
101
|
-
|
102
|
-
protected
|
103
|
-
|
104
|
-
def _set_detail(key, value)
|
105
|
-
@details = @details.dup if @details_key
|
106
|
-
@details_key = nil
|
107
|
-
@details[key] = value
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# Helpers related to template lookup using the lookup context information.
|
112
|
-
module ViewPaths
|
113
|
-
attr_reader :view_paths
|
114
|
-
|
115
|
-
# Whenever setting view paths, makes a copy so we can manipulate then in
|
116
|
-
# instance objects as we wish.
|
117
|
-
def view_paths=(paths)
|
118
|
-
@view_paths = ActionView::PathSet.new(Array.wrap(paths))
|
119
|
-
end
|
120
|
-
|
121
|
-
def find(name, prefixes = [], partial = false, keys = [], options = {})
|
122
|
-
@view_paths.find(*args_for_lookup(name, prefixes, partial, keys, options))
|
123
|
-
end
|
124
|
-
alias :find_template :find
|
125
|
-
|
126
|
-
def find_all(name, prefixes = [], partial = false, keys = [], options = {})
|
127
|
-
@view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options))
|
128
|
-
end
|
129
|
-
|
130
|
-
def exists?(name, prefixes = [], partial = false, keys = [], options = {})
|
131
|
-
@view_paths.exists?(*args_for_lookup(name, prefixes, partial, keys, options))
|
132
|
-
end
|
133
|
-
alias :template_exists? :exists?
|
134
|
-
|
135
|
-
# Add fallbacks to the view paths. Useful in cases you are rendering a :file.
|
136
|
-
def with_fallbacks
|
137
|
-
added_resolvers = 0
|
138
|
-
self.class.fallbacks.each do |resolver|
|
139
|
-
next if view_paths.include?(resolver)
|
140
|
-
view_paths.push(resolver)
|
141
|
-
added_resolvers += 1
|
142
|
-
end
|
143
|
-
yield
|
144
|
-
ensure
|
145
|
-
added_resolvers.times { view_paths.pop }
|
146
|
-
end
|
147
|
-
|
148
|
-
protected
|
149
|
-
|
150
|
-
def args_for_lookup(name, prefixes, partial, keys, details_options) #:nodoc:
|
151
|
-
name, prefixes = normalize_name(name, prefixes)
|
152
|
-
details, details_key = detail_args_for(details_options)
|
153
|
-
[name, prefixes, partial || false, details, details_key, keys]
|
154
|
-
end
|
155
|
-
|
156
|
-
# Compute details hash and key according to user options (e.g. passed from #render).
|
157
|
-
def detail_args_for(options)
|
158
|
-
return @details, details_key if options.empty? # most common path.
|
159
|
-
user_details = @details.merge(options)
|
160
|
-
[user_details, DetailsKey.get(user_details)]
|
161
|
-
end
|
162
|
-
|
163
|
-
# Support legacy foo.erb names even though we now ignore .erb
|
164
|
-
# as well as incorrectly putting part of the path in the template
|
165
|
-
# name instead of the prefix.
|
166
|
-
def normalize_name(name, prefixes) #:nodoc:
|
167
|
-
name = name.to_s.sub(handlers_regexp) do |match|
|
168
|
-
ActiveSupport::Deprecation.warn "Passing a template handler in the template name is deprecated. " \
|
169
|
-
"You can simply remove the handler name or pass render :handlers => [:#{match[1..-1]}] instead.", caller
|
170
|
-
""
|
171
|
-
end
|
172
|
-
|
173
|
-
prefixes = nil if prefixes.blank?
|
174
|
-
parts = name.split('/')
|
175
|
-
name = parts.pop
|
176
|
-
|
177
|
-
return name, prefixes || [""] if parts.empty?
|
178
|
-
|
179
|
-
parts = parts.join('/')
|
180
|
-
prefixes = prefixes ? prefixes.map { |p| "#{p}/#{parts}" } : [parts]
|
181
|
-
|
182
|
-
return name, prefixes
|
183
|
-
end
|
184
|
-
|
185
|
-
def handlers_regexp #:nodoc:
|
186
|
-
@@handlers_regexp ||= /\.(?:#{default_handlers.join('|')})$/
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
include Accessors
|
191
|
-
include DetailsCache
|
192
|
-
include ViewPaths
|
193
|
-
|
194
|
-
def initialize(view_paths, details = {}, prefixes = [])
|
195
|
-
@details, @details_key = {}, nil
|
196
|
-
@skip_default_locale = false
|
197
|
-
@cache = true
|
198
|
-
@prefixes = prefixes
|
199
|
-
@rendered_format = nil
|
200
|
-
|
201
|
-
self.view_paths = view_paths
|
202
|
-
initialize_details(details)
|
203
|
-
end
|
204
|
-
|
205
|
-
# Override formats= to expand ["*/*"] values and automatically
|
206
|
-
# add :html as fallback to :js.
|
207
|
-
def formats=(values)
|
208
|
-
if values
|
209
|
-
values.concat(default_formats) if values.delete "*/*"
|
210
|
-
values << :html if values == [:js]
|
211
|
-
end
|
212
|
-
super(values)
|
213
|
-
end
|
214
|
-
|
215
|
-
# Do not use the default locale on template lookup.
|
216
|
-
def skip_default_locale!
|
217
|
-
@skip_default_locale = true
|
218
|
-
self.locale = nil
|
219
|
-
end
|
220
|
-
|
221
|
-
# Override locale to return a symbol instead of array.
|
222
|
-
def locale
|
223
|
-
@details[:locale].first
|
224
|
-
end
|
225
|
-
|
226
|
-
# Overload locale= to also set the I18n.locale. If the current I18n.config object responds
|
227
|
-
# to original_config, it means that it's has a copy of the original I18n configuration and it's
|
228
|
-
# acting as proxy, which we need to skip.
|
229
|
-
def locale=(value)
|
230
|
-
if value
|
231
|
-
config = I18n.config.respond_to?(:original_config) ? I18n.config.original_config : I18n.config
|
232
|
-
config.locale = value
|
233
|
-
end
|
234
|
-
|
235
|
-
super(@skip_default_locale ? I18n.locale : default_locale)
|
236
|
-
end
|
237
|
-
|
238
|
-
# A method which only uses the first format in the formats array for layout lookup.
|
239
|
-
def with_layout_format
|
240
|
-
if formats.size == 1
|
241
|
-
yield
|
242
|
-
else
|
243
|
-
old_formats = formats
|
244
|
-
_set_detail(:formats, formats[0,1])
|
245
|
-
|
246
|
-
begin
|
247
|
-
yield
|
248
|
-
ensure
|
249
|
-
_set_detail(:formats, old_formats)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
data/lib/action_view/path_set.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
module ActionView #:nodoc:
|
2
|
-
# = Action View PathSet
|
3
|
-
class PathSet #:nodoc:
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
attr_reader :paths
|
7
|
-
|
8
|
-
def initialize(paths = [])
|
9
|
-
@paths = typecast paths
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize_copy(other)
|
13
|
-
@paths = other.paths.dup
|
14
|
-
self
|
15
|
-
end
|
16
|
-
|
17
|
-
def [](i)
|
18
|
-
paths[i]
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_ary
|
22
|
-
paths.dup
|
23
|
-
end
|
24
|
-
|
25
|
-
def include?(item)
|
26
|
-
paths.include? item
|
27
|
-
end
|
28
|
-
|
29
|
-
def pop
|
30
|
-
paths.pop
|
31
|
-
end
|
32
|
-
|
33
|
-
def size
|
34
|
-
paths.size
|
35
|
-
end
|
36
|
-
|
37
|
-
def each(&block)
|
38
|
-
paths.each(&block)
|
39
|
-
end
|
40
|
-
|
41
|
-
def compact
|
42
|
-
PathSet.new paths.compact
|
43
|
-
end
|
44
|
-
|
45
|
-
def +(array)
|
46
|
-
PathSet.new(paths + array)
|
47
|
-
end
|
48
|
-
|
49
|
-
%w(<< concat push insert unshift).each do |method|
|
50
|
-
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
51
|
-
def #{method}(*args)
|
52
|
-
paths.#{method}(*typecast(args))
|
53
|
-
end
|
54
|
-
METHOD
|
55
|
-
end
|
56
|
-
|
57
|
-
def find(*args)
|
58
|
-
find_all(*args).first || raise(MissingTemplate.new(self, *args))
|
59
|
-
end
|
60
|
-
|
61
|
-
def find_all(path, prefixes = [], *args)
|
62
|
-
prefixes = [prefixes] if String === prefixes
|
63
|
-
prefixes.each do |prefix|
|
64
|
-
paths.each do |resolver|
|
65
|
-
templates = resolver.find_all(path, prefix, *args)
|
66
|
-
return templates unless templates.empty?
|
67
|
-
end
|
68
|
-
end
|
69
|
-
[]
|
70
|
-
end
|
71
|
-
|
72
|
-
def exists?(path, prefixes, *args)
|
73
|
-
find_all(path, prefixes, *args).any?
|
74
|
-
end
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
def typecast(paths)
|
79
|
-
paths.map do |path|
|
80
|
-
case path
|
81
|
-
when Pathname, String
|
82
|
-
OptimizedFileSystemResolver.new path.to_s
|
83
|
-
else
|
84
|
-
path
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
data/lib/action_view/railtie.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require "action_view"
|
2
|
-
require "rails"
|
3
|
-
|
4
|
-
module ActionView
|
5
|
-
# = Action View Railtie
|
6
|
-
class Railtie < Rails::Railtie
|
7
|
-
config.action_view = ActiveSupport::OrderedOptions.new
|
8
|
-
config.action_view.stylesheet_expansions = {}
|
9
|
-
config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }
|
10
|
-
config.action_view.embed_authenticity_token_in_remote_forms = true
|
11
|
-
|
12
|
-
initializer "action_view.embed_authenticity_token_in_remote_forms" do |app|
|
13
|
-
ActiveSupport.on_load(:action_view) do
|
14
|
-
ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms =
|
15
|
-
app.config.action_view.delete(:embed_authenticity_token_in_remote_forms)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
initializer "action_view.cache_asset_ids" do |app|
|
20
|
-
unless app.config.cache_classes
|
21
|
-
ActiveSupport.on_load(:action_view) do
|
22
|
-
ActionView::Helpers::AssetTagHelper::AssetPaths.cache_asset_ids = false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
initializer "action_view.javascript_expansions" do |app|
|
28
|
-
ActiveSupport.on_load(:action_view) do
|
29
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion(
|
30
|
-
app.config.action_view.delete(:javascript_expansions)
|
31
|
-
)
|
32
|
-
|
33
|
-
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion(
|
34
|
-
app.config.action_view.delete(:stylesheet_expansions)
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
initializer "action_view.set_configs" do |app|
|
40
|
-
ActiveSupport.on_load(:action_view) do
|
41
|
-
app.config.action_view.each do |k,v|
|
42
|
-
send "#{k}=", v
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
initializer "action_view.caching" do |app|
|
48
|
-
ActiveSupport.on_load(:action_view) do
|
49
|
-
if app.config.action_view.cache_template_loading.nil?
|
50
|
-
ActionView::Resolver.caching = app.config.cache_classes
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module ActionView
|
2
|
-
class AbstractRenderer #:nodoc:
|
3
|
-
delegate :find_template, :template_exists?, :with_fallbacks, :update_details,
|
4
|
-
:with_layout_format, :formats, :to => :@lookup_context
|
5
|
-
|
6
|
-
def initialize(lookup_context)
|
7
|
-
@lookup_context = lookup_context
|
8
|
-
end
|
9
|
-
|
10
|
-
def render
|
11
|
-
raise NotImplementedError
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
|
16
|
-
def extract_details(options)
|
17
|
-
details = {}
|
18
|
-
@lookup_context.registered_details.each do |key|
|
19
|
-
next unless value = options[key]
|
20
|
-
details[key] = Array.wrap(value)
|
21
|
-
end
|
22
|
-
details
|
23
|
-
end
|
24
|
-
|
25
|
-
def extract_format(value, details)
|
26
|
-
if value.is_a?(String) && value.sub!(formats_regexp, "")
|
27
|
-
ActiveSupport::Deprecation.warn "Passing the format in the template name is deprecated. " \
|
28
|
-
"Please pass render with :formats => [:#{$1}] instead.", caller
|
29
|
-
details[:formats] ||= [$1.to_sym]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def formats_regexp
|
34
|
-
@@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
|
35
|
-
end
|
36
|
-
|
37
|
-
def instrument(name, options={})
|
38
|
-
ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|