actionview 5.0.7.2 → 5.1.0.beta1
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 +5 -5
- data/CHANGELOG.md +92 -384
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/action_view.rb +5 -5
- 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 +6 -7
- data/lib/action_view/flows.rb +5 -6
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers.rb +1 -1
- 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 +34 -20
- data/lib/action_view/helpers/capture_helper.rb +2 -2
- data/lib/action_view/helpers/controller_helper.rb +3 -11
- data/lib/action_view/helpers/csrf_helper.rb +3 -3
- data/lib/action_view/helpers/date_helper.rb +109 -107
- data/lib/action_view/helpers/debug_helper.rb +2 -3
- data/lib/action_view/helpers/form_helper.rb +406 -31
- data/lib/action_view/helpers/form_options_helper.rb +12 -12
- data/lib/action_view/helpers/form_tag_helper.rb +19 -18
- 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/rendering_helper.rb +2 -2
- data/lib/action_view/helpers/sanitize_helper.rb +6 -8
- 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 +8 -8
- data/lib/action_view/helpers/tags/collection_helpers.rb +60 -60
- data/lib/action_view/helpers/tags/collection_radio_buttons.rb +2 -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 +42 -38
- data/lib/action_view/layouts.rb +51 -47
- data/lib/action_view/log_subscriber.rb +24 -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 +3 -3
- 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.rb +188 -187
- data/lib/action_view/renderer/partial_renderer/collection_caching.rb +7 -1
- 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.rb +26 -27
- data/lib/action_view/template/error.rb +5 -15
- data/lib/action_view/template/handlers.rb +4 -4
- data/lib/action_view/template/handlers/builder.rb +7 -7
- data/lib/action_view/template/handlers/erb.rb +9 -76
- 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/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/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/assets/compiled/rails-ujs.js +648 -0
- metadata +19 -14
@@ -4,19 +4,16 @@ module ActionView #:nodoc:
|
|
4
4
|
class Text #:nodoc:
|
5
5
|
attr_accessor :type
|
6
6
|
|
7
|
-
def initialize(string
|
7
|
+
def initialize(string)
|
8
8
|
@string = string.to_s
|
9
|
-
@type
|
10
|
-
@type ||= Types[:text]
|
9
|
+
@type = Types[:text]
|
11
10
|
end
|
12
11
|
|
13
12
|
def identifier
|
14
|
-
|
13
|
+
"text template"
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
|
-
'text template'
|
19
|
-
end
|
16
|
+
alias_method :inspect, :identifier
|
20
17
|
|
21
18
|
def to_str
|
22
19
|
@string
|
@@ -27,7 +24,7 @@ module ActionView #:nodoc:
|
|
27
24
|
end
|
28
25
|
|
29
26
|
def formats
|
30
|
-
[@type.
|
27
|
+
[@type.ref]
|
31
28
|
end
|
32
29
|
end
|
33
30
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "active_support/core_ext/module/remove_method"
|
2
|
+
require "action_controller"
|
3
|
+
require "action_controller/test_case"
|
4
|
+
require "action_view"
|
5
5
|
|
6
|
-
require
|
6
|
+
require "rails-dom-testing"
|
7
7
|
|
8
8
|
module ActionView
|
9
9
|
# = Action View Test Case
|
@@ -18,16 +18,16 @@ module ActionView
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def controller_path=(path)
|
21
|
-
self.class.controller_path=(path)
|
21
|
+
self.class.controller_path = (path)
|
22
22
|
end
|
23
23
|
|
24
24
|
def initialize
|
25
25
|
super
|
26
26
|
self.class.controller_path = ""
|
27
|
-
@request = ActionController::TestRequest.create
|
27
|
+
@request = ActionController::TestRequest.create(self.class)
|
28
28
|
@response = ActionDispatch::TestResponse.new
|
29
29
|
|
30
|
-
@request.env.delete(
|
30
|
+
@request.env.delete("PATH_INFO")
|
31
31
|
@params = ActionController::Parameters.new
|
32
32
|
end
|
33
33
|
end
|
@@ -49,7 +49,7 @@ module ActionView
|
|
49
49
|
|
50
50
|
include ActiveSupport::Testing::ConstantLookup
|
51
51
|
|
52
|
-
delegate :lookup_context, :
|
52
|
+
delegate :lookup_context, to: :controller
|
53
53
|
attr_accessor :controller, :output_buffer, :rendered
|
54
54
|
|
55
55
|
module ClassMethods
|
@@ -96,7 +96,6 @@ module ActionView
|
|
96
96
|
helper(helper_class) if helper_class
|
97
97
|
include _helpers
|
98
98
|
end
|
99
|
-
|
100
99
|
end
|
101
100
|
|
102
101
|
def setup_with_controller
|
@@ -104,8 +103,8 @@ module ActionView
|
|
104
103
|
@request = @controller.request
|
105
104
|
# empty string ensures buffer has UTF-8 encoding as
|
106
105
|
# new without arguments returns ASCII-8BIT encoded buffer like String#new
|
107
|
-
@output_buffer = ActiveSupport::SafeBuffer.new
|
108
|
-
@rendered =
|
106
|
+
@output_buffer = ActiveSupport::SafeBuffer.new ""
|
107
|
+
@rendered = ""
|
109
108
|
|
110
109
|
make_test_case_available_to_view!
|
111
110
|
say_no_to_protect_against_forgery!
|
@@ -125,6 +124,10 @@ module ActionView
|
|
125
124
|
@_rendered_views ||= RenderedViewsCollection.new
|
126
125
|
end
|
127
126
|
|
127
|
+
def _routes
|
128
|
+
@controller._routes if @controller.respond_to?(:_routes)
|
129
|
+
end
|
130
|
+
|
128
131
|
# Need to experiment if this priority is the best one: rendered => output_buffer
|
129
132
|
class RenderedViewsCollection
|
130
133
|
def initialize
|
@@ -146,7 +149,7 @@ module ActionView
|
|
146
149
|
|
147
150
|
def view_rendered?(view, expected_locals)
|
148
151
|
locals_for(view).any? do |actual_locals|
|
149
|
-
expected_locals.all? {|key, value| value == actual_locals[key] }
|
152
|
+
expected_locals.all? { |key, value| value == actual_locals[key] }
|
150
153
|
end
|
151
154
|
end
|
152
155
|
end
|
@@ -207,8 +210,8 @@ module ActionView
|
|
207
210
|
view = @controller.view_context
|
208
211
|
view.singleton_class.include(_helpers)
|
209
212
|
view.extend(Locals)
|
210
|
-
view.rendered_views =
|
211
|
-
view.output_buffer =
|
213
|
+
view.rendered_views = rendered_views
|
214
|
+
view.output_buffer = output_buffer
|
212
215
|
view
|
213
216
|
end
|
214
217
|
end
|
@@ -259,10 +262,6 @@ module ActionView
|
|
259
262
|
end]
|
260
263
|
end
|
261
264
|
|
262
|
-
def _routes
|
263
|
-
@controller._routes if @controller.respond_to?(:_routes)
|
264
|
-
end
|
265
|
-
|
266
265
|
def method_missing(selector, *args)
|
267
266
|
begin
|
268
267
|
routes = @controller.respond_to?(:_routes) && @controller._routes
|
@@ -271,8 +270,8 @@ module ActionView
|
|
271
270
|
end
|
272
271
|
|
273
272
|
if routes &&
|
274
|
-
(
|
275
|
-
routes.mounted_helpers.method_defined?(selector)
|
273
|
+
(routes.named_routes.route_defined?(selector) ||
|
274
|
+
routes.mounted_helpers.method_defined?(selector))
|
276
275
|
@controller.__send__(selector, *args)
|
277
276
|
else
|
278
277
|
super
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "action_view/template/resolver"
|
2
2
|
|
3
3
|
module ActionView #:nodoc:
|
4
4
|
# Use FixtureResolver in your tests to simulate the presence of files on the
|
@@ -8,46 +8,45 @@ module ActionView #:nodoc:
|
|
8
8
|
class FixtureResolver < PathResolver
|
9
9
|
attr_reader :hash
|
10
10
|
|
11
|
-
def initialize(hash = {}, pattern=nil)
|
11
|
+
def initialize(hash = {}, pattern = nil)
|
12
12
|
super(pattern)
|
13
13
|
@hash = hash
|
14
14
|
end
|
15
15
|
|
16
16
|
def to_s
|
17
|
-
@hash.keys.join(
|
17
|
+
@hash.keys.join(", ")
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
20
|
+
private
|
21
|
+
|
22
|
+
def query(path, exts, _, _)
|
23
|
+
query = ""
|
24
|
+
EXTENSIONS.each_key do |ext|
|
25
|
+
query << "(" << exts[ext].map { |e| e && Regexp.escape(".#{e}") }.join("|") << "|)"
|
26
|
+
end
|
27
|
+
query = /^(#{Regexp.escape(path)})#{query}$/
|
28
|
+
|
29
|
+
templates = []
|
30
|
+
@hash.each do |_path, array|
|
31
|
+
source, updated_at = array
|
32
|
+
next unless query.match?(_path)
|
33
|
+
handler, format, variant = extract_handler_and_format_and_variant(_path)
|
34
|
+
templates << Template.new(source, _path, handler,
|
35
|
+
virtual_path: path.virtual,
|
36
|
+
format: format,
|
37
|
+
variant: variant,
|
38
|
+
updated_at: updated_at
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
templates.sort_by { |t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size }
|
40
43
|
end
|
41
|
-
|
42
|
-
templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size }
|
43
|
-
end
|
44
44
|
end
|
45
45
|
|
46
46
|
class NullResolver < PathResolver
|
47
|
-
def query(path, exts,
|
48
|
-
handler, format, variant = extract_handler_and_format_and_variant(path
|
49
|
-
[ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, :
|
47
|
+
def query(path, exts, _, _)
|
48
|
+
handler, format, variant = extract_handler_and_format_and_variant(path)
|
49
|
+
[ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant)]
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
data/lib/action_view/version.rb
CHANGED
@@ -5,11 +5,11 @@ module ActionView
|
|
5
5
|
included do
|
6
6
|
class_attribute :_view_paths
|
7
7
|
self._view_paths = ActionView::PathSet.new
|
8
|
-
|
8
|
+
_view_paths.freeze
|
9
9
|
end
|
10
10
|
|
11
11
|
delegate :template_exists?, :any_templates?, :view_paths, :formats, :formats=,
|
12
|
-
:locale, :locale=, :
|
12
|
+
:locale, :locale=, to: :lookup_context
|
13
13
|
|
14
14
|
module ClassMethods
|
15
15
|
def _prefixes # :nodoc:
|
@@ -22,11 +22,11 @@ module ActionView
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
# Override this method in your controller if you want to change paths prefixes for finding views.
|
26
|
+
# Prefixes defined here will still be added to parents' <tt>._prefixes</tt>.
|
27
|
+
def local_prefixes
|
28
|
+
[controller_path]
|
29
|
+
end
|
30
30
|
end
|
31
31
|
|
32
32
|
# The prefixes used in render "foo" shortcuts.
|
@@ -43,13 +43,25 @@ module ActionView
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def details_for_lookup
|
46
|
-
{
|
46
|
+
{}
|
47
47
|
end
|
48
48
|
|
49
|
+
# Append a path to the list of view paths for the current <tt>LookupContext</tt>.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# * <tt>path</tt> - If a String is provided, it gets converted into
|
53
|
+
# the default view path. You may also provide a custom view path
|
54
|
+
# (see ActionView::PathSet for more information)
|
49
55
|
def append_view_path(path)
|
50
56
|
lookup_context.view_paths.push(*path)
|
51
57
|
end
|
52
58
|
|
59
|
+
# Prepend a path to the list of view paths for the current <tt>LookupContext</tt>.
|
60
|
+
#
|
61
|
+
# ==== Parameters
|
62
|
+
# * <tt>path</tt> - If a String is provided, it gets converted into
|
63
|
+
# the default view path. You may also provide a custom view path
|
64
|
+
# (see ActionView::PathSet for more information)
|
53
65
|
def prepend_view_path(path)
|
54
66
|
lookup_context.view_paths.unshift(*path)
|
55
67
|
end
|
@@ -0,0 +1,648 @@
|
|
1
|
+
(function() {
|
2
|
+
this.Rails = {
|
3
|
+
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
|
4
|
+
buttonClickSelector: {
|
5
|
+
selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
|
6
|
+
exclude: 'form button'
|
7
|
+
},
|
8
|
+
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
9
|
+
formSubmitSelector: 'form',
|
10
|
+
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
|
11
|
+
formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
|
12
|
+
formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
|
13
|
+
fileInputSelector: 'input[name][type=file]:not([disabled])',
|
14
|
+
linkDisableSelector: 'a[data-disable-with], a[data-disable]',
|
15
|
+
buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
|
16
|
+
};
|
17
|
+
|
18
|
+
}).call(this);
|
19
|
+
(function() {
|
20
|
+
var expando, m;
|
21
|
+
|
22
|
+
m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
|
23
|
+
|
24
|
+
Rails.matches = function(element, selector) {
|
25
|
+
if (selector.exclude != null) {
|
26
|
+
return m.call(element, selector.selector) && !m.call(element, selector.exclude);
|
27
|
+
} else {
|
28
|
+
return m.call(element, selector);
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
expando = '_ujsData';
|
33
|
+
|
34
|
+
Rails.getData = function(element, key) {
|
35
|
+
var ref;
|
36
|
+
return (ref = element[expando]) != null ? ref[key] : void 0;
|
37
|
+
};
|
38
|
+
|
39
|
+
Rails.setData = function(element, key, value) {
|
40
|
+
if (element[expando] == null) {
|
41
|
+
element[expando] = {};
|
42
|
+
}
|
43
|
+
return element[expando][key] = value;
|
44
|
+
};
|
45
|
+
|
46
|
+
Rails.$ = function(selector) {
|
47
|
+
return Array.prototype.slice.call(document.querySelectorAll(selector));
|
48
|
+
};
|
49
|
+
|
50
|
+
}).call(this);
|
51
|
+
(function() {
|
52
|
+
var $, csrfParam, csrfToken;
|
53
|
+
|
54
|
+
$ = Rails.$;
|
55
|
+
|
56
|
+
csrfToken = Rails.csrfToken = function() {
|
57
|
+
var meta;
|
58
|
+
meta = document.querySelector('meta[name=csrf-token]');
|
59
|
+
return meta && meta.content;
|
60
|
+
};
|
61
|
+
|
62
|
+
csrfParam = Rails.csrfParam = function() {
|
63
|
+
var meta;
|
64
|
+
meta = document.querySelector('meta[name=csrf-param]');
|
65
|
+
return meta && meta.content;
|
66
|
+
};
|
67
|
+
|
68
|
+
Rails.CSRFProtection = function(xhr) {
|
69
|
+
var token;
|
70
|
+
token = csrfToken();
|
71
|
+
if (token != null) {
|
72
|
+
return xhr.setRequestHeader('X-CSRF-Token', token);
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
Rails.refreshCSRFTokens = function() {
|
77
|
+
var param, token;
|
78
|
+
token = csrfToken();
|
79
|
+
param = csrfParam();
|
80
|
+
if ((token != null) && (param != null)) {
|
81
|
+
return $('form input[name="' + param + '"]').forEach(function(input) {
|
82
|
+
return input.value = token;
|
83
|
+
});
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
}).call(this);
|
88
|
+
(function() {
|
89
|
+
var CustomEvent, fire, matches;
|
90
|
+
|
91
|
+
matches = Rails.matches;
|
92
|
+
|
93
|
+
CustomEvent = window.CustomEvent;
|
94
|
+
|
95
|
+
if (typeof CustomEvent !== 'function') {
|
96
|
+
CustomEvent = function(event, params) {
|
97
|
+
var evt;
|
98
|
+
evt = document.createEvent('CustomEvent');
|
99
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
100
|
+
return evt;
|
101
|
+
};
|
102
|
+
CustomEvent.prototype = window.Event.prototype;
|
103
|
+
}
|
104
|
+
|
105
|
+
fire = Rails.fire = function(obj, name, data) {
|
106
|
+
var event;
|
107
|
+
event = new CustomEvent(name, {
|
108
|
+
bubbles: true,
|
109
|
+
cancelable: true,
|
110
|
+
detail: data
|
111
|
+
});
|
112
|
+
obj.dispatchEvent(event);
|
113
|
+
return !event.defaultPrevented;
|
114
|
+
};
|
115
|
+
|
116
|
+
Rails.stopEverything = function(e) {
|
117
|
+
fire(e.target, 'ujs:everythingStopped');
|
118
|
+
e.preventDefault();
|
119
|
+
e.stopPropagation();
|
120
|
+
return e.stopImmediatePropagation();
|
121
|
+
};
|
122
|
+
|
123
|
+
Rails.delegate = function(element, selector, eventType, handler) {
|
124
|
+
return element.addEventListener(eventType, function(e) {
|
125
|
+
var target;
|
126
|
+
target = e.target;
|
127
|
+
while (!(!(target instanceof Element) || matches(target, selector))) {
|
128
|
+
target = target.parentNode;
|
129
|
+
}
|
130
|
+
if (target instanceof Element && handler.call(target, e) === false) {
|
131
|
+
e.preventDefault();
|
132
|
+
return e.stopPropagation();
|
133
|
+
}
|
134
|
+
});
|
135
|
+
};
|
136
|
+
|
137
|
+
}).call(this);
|
138
|
+
(function() {
|
139
|
+
var AcceptHeaders, CSRFProtection, createXHR, fire, prepareOptions, processResponse;
|
140
|
+
|
141
|
+
CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
|
142
|
+
|
143
|
+
AcceptHeaders = {
|
144
|
+
'*': '*/*',
|
145
|
+
text: 'text/plain',
|
146
|
+
html: 'text/html',
|
147
|
+
xml: 'application/xml, text/xml',
|
148
|
+
json: 'application/json, text/javascript',
|
149
|
+
script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
|
150
|
+
};
|
151
|
+
|
152
|
+
Rails.ajax = function(options) {
|
153
|
+
var xhr;
|
154
|
+
options = prepareOptions(options);
|
155
|
+
xhr = createXHR(options, function() {
|
156
|
+
var response;
|
157
|
+
response = processResponse(xhr.response, xhr.getResponseHeader('Content-Type'));
|
158
|
+
if (Math.floor(xhr.status / 100) === 2) {
|
159
|
+
if (typeof options.success === "function") {
|
160
|
+
options.success(response, xhr.statusText, xhr);
|
161
|
+
}
|
162
|
+
} else {
|
163
|
+
if (typeof options.error === "function") {
|
164
|
+
options.error(response, xhr.statusText, xhr);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
|
168
|
+
});
|
169
|
+
if (typeof options.beforeSend === "function") {
|
170
|
+
options.beforeSend(xhr, options);
|
171
|
+
}
|
172
|
+
if (xhr.readyState === XMLHttpRequest.OPENED) {
|
173
|
+
return xhr.send(options.data);
|
174
|
+
} else {
|
175
|
+
return fire(document, 'ajaxStop');
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
179
|
+
prepareOptions = function(options) {
|
180
|
+
options.type = options.type.toUpperCase();
|
181
|
+
if (options.type === 'GET' && options.data) {
|
182
|
+
if (options.url.indexOf('?') < 0) {
|
183
|
+
options.url += '?' + options.data;
|
184
|
+
} else {
|
185
|
+
options.url += '&' + options.data;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
if (AcceptHeaders[options.dataType] == null) {
|
189
|
+
options.dataType = '*';
|
190
|
+
}
|
191
|
+
options.accept = AcceptHeaders[options.dataType];
|
192
|
+
if (options.dataType !== '*') {
|
193
|
+
options.accept += ', */*; q=0.01';
|
194
|
+
}
|
195
|
+
return options;
|
196
|
+
};
|
197
|
+
|
198
|
+
createXHR = function(options, done) {
|
199
|
+
var xhr;
|
200
|
+
xhr = new XMLHttpRequest();
|
201
|
+
xhr.open(options.type, options.url, true);
|
202
|
+
xhr.setRequestHeader('Accept', options.accept);
|
203
|
+
if (typeof options.data === 'string') {
|
204
|
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
205
|
+
}
|
206
|
+
if (!options.crossDomain) {
|
207
|
+
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
208
|
+
}
|
209
|
+
CSRFProtection(xhr);
|
210
|
+
xhr.withCredentials = !!options.withCredentials;
|
211
|
+
xhr.onreadystatechange = function() {
|
212
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
213
|
+
return done(xhr);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
return xhr;
|
217
|
+
};
|
218
|
+
|
219
|
+
processResponse = function(response, type) {
|
220
|
+
var parser, script;
|
221
|
+
if (typeof response === 'string' && typeof type === 'string') {
|
222
|
+
if (type.match(/\bjson\b/)) {
|
223
|
+
try {
|
224
|
+
response = JSON.parse(response);
|
225
|
+
} catch (error) {}
|
226
|
+
} else if (type.match(/\bjavascript\b/)) {
|
227
|
+
script = document.createElement('script');
|
228
|
+
script.innerHTML = response;
|
229
|
+
document.body.appendChild(script);
|
230
|
+
} else if (type.match(/\b(xml|html|svg)\b/)) {
|
231
|
+
parser = new DOMParser();
|
232
|
+
type = type.replace(/;.+/, '');
|
233
|
+
try {
|
234
|
+
response = parser.parseFromString(response, type);
|
235
|
+
} catch (error) {}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
return response;
|
239
|
+
};
|
240
|
+
|
241
|
+
Rails.href = function(element) {
|
242
|
+
return element.href;
|
243
|
+
};
|
244
|
+
|
245
|
+
Rails.isCrossDomain = function(url) {
|
246
|
+
var e, originAnchor, urlAnchor;
|
247
|
+
originAnchor = document.createElement('a');
|
248
|
+
originAnchor.href = location.href;
|
249
|
+
urlAnchor = document.createElement('a');
|
250
|
+
try {
|
251
|
+
urlAnchor.href = url;
|
252
|
+
return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
|
253
|
+
} catch (error) {
|
254
|
+
e = error;
|
255
|
+
return true;
|
256
|
+
}
|
257
|
+
};
|
258
|
+
|
259
|
+
}).call(this);
|
260
|
+
(function() {
|
261
|
+
var matches, toArray;
|
262
|
+
|
263
|
+
matches = Rails.matches;
|
264
|
+
|
265
|
+
toArray = function(e) {
|
266
|
+
return Array.prototype.slice.call(e);
|
267
|
+
};
|
268
|
+
|
269
|
+
Rails.serializeElement = function(element, additionalParam) {
|
270
|
+
var inputs, params;
|
271
|
+
inputs = [element];
|
272
|
+
if (matches(element, 'form')) {
|
273
|
+
inputs = toArray(element.elements);
|
274
|
+
}
|
275
|
+
params = [];
|
276
|
+
inputs.forEach(function(input) {
|
277
|
+
if (!input.name) {
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
if (matches(input, 'select')) {
|
281
|
+
return toArray(input.options).forEach(function(option) {
|
282
|
+
if (option.selected) {
|
283
|
+
return params.push({
|
284
|
+
name: input.name,
|
285
|
+
value: option.value
|
286
|
+
});
|
287
|
+
}
|
288
|
+
});
|
289
|
+
} else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {
|
290
|
+
return params.push({
|
291
|
+
name: input.name,
|
292
|
+
value: input.value
|
293
|
+
});
|
294
|
+
}
|
295
|
+
});
|
296
|
+
if (additionalParam) {
|
297
|
+
params.push(additionalParam);
|
298
|
+
}
|
299
|
+
return params.map(function(param) {
|
300
|
+
if (param.name != null) {
|
301
|
+
return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
|
302
|
+
} else {
|
303
|
+
return param;
|
304
|
+
}
|
305
|
+
}).join('&');
|
306
|
+
};
|
307
|
+
|
308
|
+
Rails.formElements = function(form, selector) {
|
309
|
+
if (matches(form, 'form')) {
|
310
|
+
return toArray(form.elements).filter(function(el) {
|
311
|
+
return matches(el, selector);
|
312
|
+
});
|
313
|
+
} else {
|
314
|
+
return toArray(form.querySelectorAll(selector));
|
315
|
+
}
|
316
|
+
};
|
317
|
+
|
318
|
+
}).call(this);
|
319
|
+
(function() {
|
320
|
+
var allowAction, fire, stopEverything;
|
321
|
+
|
322
|
+
fire = Rails.fire, stopEverything = Rails.stopEverything;
|
323
|
+
|
324
|
+
Rails.handleConfirm = function(e) {
|
325
|
+
if (!allowAction(this)) {
|
326
|
+
return stopEverything(e);
|
327
|
+
}
|
328
|
+
};
|
329
|
+
|
330
|
+
allowAction = function(element) {
|
331
|
+
var answer, callback, message;
|
332
|
+
message = element.getAttribute('data-confirm');
|
333
|
+
if (!message) {
|
334
|
+
return true;
|
335
|
+
}
|
336
|
+
answer = false;
|
337
|
+
if (fire(element, 'confirm')) {
|
338
|
+
try {
|
339
|
+
answer = confirm(message);
|
340
|
+
} catch (error) {}
|
341
|
+
callback = fire(element, 'confirm:complete', [answer]);
|
342
|
+
}
|
343
|
+
return answer && callback;
|
344
|
+
};
|
345
|
+
|
346
|
+
}).call(this);
|
347
|
+
(function() {
|
348
|
+
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;
|
349
|
+
|
350
|
+
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
|
351
|
+
|
352
|
+
Rails.enableElement = function(e) {
|
353
|
+
var element;
|
354
|
+
element = e instanceof Event ? e.target : e;
|
355
|
+
if (matches(element, Rails.linkDisableSelector)) {
|
356
|
+
return enableLinkElement(element);
|
357
|
+
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
|
358
|
+
return enableFormElement(element);
|
359
|
+
} else if (matches(element, Rails.formSubmitSelector)) {
|
360
|
+
return enableFormElements(element);
|
361
|
+
}
|
362
|
+
};
|
363
|
+
|
364
|
+
Rails.disableElement = function(e) {
|
365
|
+
var element;
|
366
|
+
element = e instanceof Event ? e.target : e;
|
367
|
+
if (matches(element, Rails.linkDisableSelector)) {
|
368
|
+
return disableLinkElement(element);
|
369
|
+
} else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
|
370
|
+
return disableFormElement(element);
|
371
|
+
} else if (matches(element, Rails.formSubmitSelector)) {
|
372
|
+
return disableFormElements(element);
|
373
|
+
}
|
374
|
+
};
|
375
|
+
|
376
|
+
disableLinkElement = function(element) {
|
377
|
+
var replacement;
|
378
|
+
replacement = element.getAttribute('data-disable-with');
|
379
|
+
if (replacement != null) {
|
380
|
+
setData(element, 'ujs:enable-with', element.innerHTML);
|
381
|
+
element.innerHTML = replacement;
|
382
|
+
}
|
383
|
+
element.addEventListener('click', stopEverything);
|
384
|
+
return setData(element, 'ujs:disabled', true);
|
385
|
+
};
|
386
|
+
|
387
|
+
enableLinkElement = function(element) {
|
388
|
+
var originalText;
|
389
|
+
originalText = getData(element, 'ujs:enable-with');
|
390
|
+
if (originalText != null) {
|
391
|
+
element.innerHTML = originalText;
|
392
|
+
setData(element, 'ujs:enable-with', null);
|
393
|
+
}
|
394
|
+
element.removeEventListener('click', stopEverything);
|
395
|
+
return setData(element, 'ujs:disabled', null);
|
396
|
+
};
|
397
|
+
|
398
|
+
disableFormElements = function(form) {
|
399
|
+
return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
|
400
|
+
};
|
401
|
+
|
402
|
+
disableFormElement = function(element) {
|
403
|
+
var replacement;
|
404
|
+
replacement = element.getAttribute('data-disable-with');
|
405
|
+
if (replacement != null) {
|
406
|
+
if (matches(element, 'button')) {
|
407
|
+
setData(element, 'ujs:enable-with', element.innerHTML);
|
408
|
+
element.innerHTML = replacement;
|
409
|
+
} else {
|
410
|
+
setData(element, 'ujs:enable-with', element.value);
|
411
|
+
element.value = replacement;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
element.disabled = true;
|
415
|
+
return setData(element, 'ujs:disabled', true);
|
416
|
+
};
|
417
|
+
|
418
|
+
enableFormElements = function(form) {
|
419
|
+
return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
|
420
|
+
};
|
421
|
+
|
422
|
+
enableFormElement = function(element) {
|
423
|
+
var originalText;
|
424
|
+
originalText = getData(element, 'ujs:enable-with');
|
425
|
+
if (originalText != null) {
|
426
|
+
if (matches(element, 'button')) {
|
427
|
+
element.innerHTML = originalText;
|
428
|
+
} else {
|
429
|
+
element.value = originalText;
|
430
|
+
}
|
431
|
+
setData(element, 'ujs:enable-with', null);
|
432
|
+
}
|
433
|
+
element.disabled = false;
|
434
|
+
return setData(element, 'ujs:disabled', null);
|
435
|
+
};
|
436
|
+
|
437
|
+
}).call(this);
|
438
|
+
(function() {
|
439
|
+
var stopEverything;
|
440
|
+
|
441
|
+
stopEverything = Rails.stopEverything;
|
442
|
+
|
443
|
+
Rails.handleMethod = function(e) {
|
444
|
+
var csrfParam, csrfToken, form, formContent, href, link, method;
|
445
|
+
link = this;
|
446
|
+
method = link.getAttribute('data-method');
|
447
|
+
if (!method) {
|
448
|
+
return;
|
449
|
+
}
|
450
|
+
href = Rails.href(link);
|
451
|
+
csrfToken = Rails.csrfToken();
|
452
|
+
csrfParam = Rails.csrfParam();
|
453
|
+
form = document.createElement('form');
|
454
|
+
formContent = "<input name='_method' value='" + method + "' type='hidden' />";
|
455
|
+
if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
|
456
|
+
formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
|
457
|
+
}
|
458
|
+
formContent += '<input type="submit" />';
|
459
|
+
form.method = 'post';
|
460
|
+
form.action = href;
|
461
|
+
form.target = link.target;
|
462
|
+
form.innerHTML = formContent;
|
463
|
+
form.style.display = 'none';
|
464
|
+
document.body.appendChild(form);
|
465
|
+
form.querySelector('[type="submit"]').click();
|
466
|
+
return stopEverything(e);
|
467
|
+
};
|
468
|
+
|
469
|
+
}).call(this);
|
470
|
+
(function() {
|
471
|
+
var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
|
472
|
+
slice = [].slice;
|
473
|
+
|
474
|
+
matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;
|
475
|
+
|
476
|
+
isRemote = function(element) {
|
477
|
+
var value;
|
478
|
+
value = element.getAttribute('data-remote');
|
479
|
+
return (value != null) && value !== 'false';
|
480
|
+
};
|
481
|
+
|
482
|
+
Rails.handleRemote = function(e) {
|
483
|
+
var button, data, dataType, element, method, url, withCredentials;
|
484
|
+
element = this;
|
485
|
+
if (!isRemote(element)) {
|
486
|
+
return true;
|
487
|
+
}
|
488
|
+
if (!fire(element, 'ajax:before')) {
|
489
|
+
fire(element, 'ajax:stopped');
|
490
|
+
return false;
|
491
|
+
}
|
492
|
+
withCredentials = element.getAttribute('data-with-credentials');
|
493
|
+
dataType = element.getAttribute('data-type') || 'script';
|
494
|
+
if (matches(element, Rails.formSubmitSelector)) {
|
495
|
+
button = getData(element, 'ujs:submit-button');
|
496
|
+
method = getData(element, 'ujs:submit-button-formmethod') || element.method;
|
497
|
+
url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
|
498
|
+
if (method.toUpperCase() === 'GET') {
|
499
|
+
url = url.replace(/\?.*$/, '');
|
500
|
+
}
|
501
|
+
if (element.enctype === 'multipart/form-data') {
|
502
|
+
data = new FormData(element);
|
503
|
+
if (button != null) {
|
504
|
+
data.append(button.name, button.value);
|
505
|
+
}
|
506
|
+
} else {
|
507
|
+
data = serializeElement(element, button);
|
508
|
+
}
|
509
|
+
setData(element, 'ujs:submit-button', null);
|
510
|
+
setData(element, 'ujs:submit-button-formmethod', null);
|
511
|
+
setData(element, 'ujs:submit-button-formaction', null);
|
512
|
+
} else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
|
513
|
+
method = element.getAttribute('data-method');
|
514
|
+
url = element.getAttribute('data-url');
|
515
|
+
data = serializeElement(element, element.getAttribute('data-params'));
|
516
|
+
} else {
|
517
|
+
method = element.getAttribute('data-method');
|
518
|
+
url = Rails.href(element);
|
519
|
+
data = element.getAttribute('data-params');
|
520
|
+
}
|
521
|
+
ajax({
|
522
|
+
type: method || 'GET',
|
523
|
+
url: url,
|
524
|
+
data: data,
|
525
|
+
dataType: dataType,
|
526
|
+
beforeSend: function(xhr, options) {
|
527
|
+
if (fire(element, 'ajax:beforeSend', [xhr, options])) {
|
528
|
+
return fire(element, 'ajax:send', [xhr]);
|
529
|
+
} else {
|
530
|
+
fire(element, 'ajax:stopped');
|
531
|
+
return xhr.abort();
|
532
|
+
}
|
533
|
+
},
|
534
|
+
success: function() {
|
535
|
+
var args;
|
536
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
537
|
+
return fire(element, 'ajax:success', args);
|
538
|
+
},
|
539
|
+
error: function() {
|
540
|
+
var args;
|
541
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
542
|
+
return fire(element, 'ajax:error', args);
|
543
|
+
},
|
544
|
+
complete: function() {
|
545
|
+
var args;
|
546
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
547
|
+
return fire(element, 'ajax:complete', args);
|
548
|
+
},
|
549
|
+
crossDomain: isCrossDomain(url),
|
550
|
+
withCredentials: (withCredentials != null) && withCredentials !== 'false'
|
551
|
+
});
|
552
|
+
return stopEverything(e);
|
553
|
+
};
|
554
|
+
|
555
|
+
Rails.formSubmitButtonClick = function(e) {
|
556
|
+
var button, form;
|
557
|
+
button = this;
|
558
|
+
form = button.form;
|
559
|
+
if (!form) {
|
560
|
+
return;
|
561
|
+
}
|
562
|
+
if (button.name) {
|
563
|
+
setData(form, 'ujs:submit-button', {
|
564
|
+
name: button.name,
|
565
|
+
value: button.value
|
566
|
+
});
|
567
|
+
}
|
568
|
+
setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
|
569
|
+
setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
|
570
|
+
return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
|
571
|
+
};
|
572
|
+
|
573
|
+
Rails.handleMetaClick = function(e) {
|
574
|
+
var data, link, metaClick, method;
|
575
|
+
link = this;
|
576
|
+
method = (link.getAttribute('data-method') || 'GET').toUpperCase();
|
577
|
+
data = link.getAttribute('data-params');
|
578
|
+
metaClick = e.metaKey || e.ctrlKey;
|
579
|
+
if (metaClick && method === 'GET' && !data) {
|
580
|
+
return e.stopImmediatePropagation();
|
581
|
+
}
|
582
|
+
};
|
583
|
+
|
584
|
+
}).call(this);
|
585
|
+
(function() {
|
586
|
+
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleMetaClick, handleMethod, handleRemote, refreshCSRFTokens;
|
587
|
+
|
588
|
+
fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
|
589
|
+
|
590
|
+
if ((typeof jQuery !== "undefined" && jQuery !== null) && !jQuery.rails) {
|
591
|
+
jQuery.rails = Rails;
|
592
|
+
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
593
|
+
if (!options.crossDomain) {
|
594
|
+
return CSRFProtection(xhr);
|
595
|
+
}
|
596
|
+
});
|
597
|
+
}
|
598
|
+
|
599
|
+
Rails.start = function() {
|
600
|
+
if (window._rails_loaded) {
|
601
|
+
throw new Error('rails-ujs has already been loaded!');
|
602
|
+
}
|
603
|
+
window.addEventListener('pageshow', function() {
|
604
|
+
$(Rails.formEnableSelector).forEach(function(el) {
|
605
|
+
if (getData(el, 'ujs:disabled')) {
|
606
|
+
return enableElement(el);
|
607
|
+
}
|
608
|
+
});
|
609
|
+
return $(Rails.linkDisableSelector).forEach(function(el) {
|
610
|
+
if (getData(el, 'ujs:disabled')) {
|
611
|
+
return enableElement(el);
|
612
|
+
}
|
613
|
+
});
|
614
|
+
});
|
615
|
+
delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
|
616
|
+
delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
|
617
|
+
delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
|
618
|
+
delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
|
619
|
+
delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
|
620
|
+
delegate(document, Rails.linkClickSelector, 'click', handleMetaClick);
|
621
|
+
delegate(document, Rails.linkClickSelector, 'click', disableElement);
|
622
|
+
delegate(document, Rails.linkClickSelector, 'click', handleRemote);
|
623
|
+
delegate(document, Rails.linkClickSelector, 'click', handleMethod);
|
624
|
+
delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
|
625
|
+
delegate(document, Rails.buttonClickSelector, 'click', disableElement);
|
626
|
+
delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
|
627
|
+
delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
|
628
|
+
delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
|
629
|
+
delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
|
630
|
+
delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
|
631
|
+
delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
|
632
|
+
return setTimeout((function() {
|
633
|
+
return disableElement(e);
|
634
|
+
}), 13);
|
635
|
+
});
|
636
|
+
delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
|
637
|
+
delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
|
638
|
+
delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
|
639
|
+
delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
|
640
|
+
document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
|
641
|
+
return window._rails_loaded = true;
|
642
|
+
};
|
643
|
+
|
644
|
+
if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
|
645
|
+
Rails.start();
|
646
|
+
}
|
647
|
+
|
648
|
+
}).call(this);
|