jquery-rails_vho 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jquery-rails/engine.rb +1 -1
- data/lib/jquery-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery_ujs.js +14 -15
- metadata +10 -3
data/lib/jquery-rails/engine.rb
CHANGED
data/lib/jquery-rails/version.rb
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
fire: function(obj, name, data) {
|
80
80
|
var event = $.Event(name);
|
81
81
|
obj.trigger(event, data);
|
82
|
-
return event
|
82
|
+
return event;
|
83
83
|
},
|
84
84
|
|
85
85
|
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
@@ -94,13 +94,13 @@
|
|
94
94
|
|
95
95
|
// Submits "remote" forms and links with ajax
|
96
96
|
handleRemote: function(element) {
|
97
|
-
var method, url, data,
|
98
|
-
|
99
|
-
|
100
|
-
if (
|
101
|
-
|
97
|
+
var method, url, data, dataType;
|
98
|
+
|
99
|
+
var event = rails.fire(element, 'ajax:before');
|
100
|
+
if (event.result !== false) {
|
101
|
+
dataType = event.data_type || element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
102
|
+
method = event.data_method || element.attr('method') || element.attr('data-method') || 'GET'
|
102
103
|
if (element.is('form')) {
|
103
|
-
method = event.data_method || element.attr('method') || element.attr('data-method');
|
104
104
|
url = event.data_url || element.attr('action');
|
105
105
|
data = element.serializeArray();
|
106
106
|
// memoized value from clicked submit button
|
@@ -110,8 +110,7 @@
|
|
110
110
|
element.data('ujs:submit-button', null);
|
111
111
|
}
|
112
112
|
} else {
|
113
|
-
|
114
|
-
url = element.attr('href');
|
113
|
+
url = event.data_url || element.attr('href');
|
115
114
|
data = element.data('params') || null;
|
116
115
|
}
|
117
116
|
|
@@ -119,10 +118,10 @@
|
|
119
118
|
url: url, type: method || 'GET', data: data, dataType: dataType,
|
120
119
|
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
121
120
|
beforeSend: function(xhr, settings) {
|
122
|
-
if (settings.dataType === undefined) {
|
121
|
+
if (settings.dataType === undefined || settings.dataType === 'text') {
|
123
122
|
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
124
123
|
}
|
125
|
-
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
124
|
+
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]).result !== false;
|
126
125
|
},
|
127
126
|
success: function(data, status, xhr) {
|
128
127
|
element.trigger('ajax:success', [data, status, xhr]);
|
@@ -196,9 +195,9 @@
|
|
196
195
|
answer = false, callback;
|
197
196
|
if (!message) { return true; }
|
198
197
|
|
199
|
-
if (rails.fire(element, 'confirm')) {
|
198
|
+
if (rails.fire(element, 'confirm').result !== false) {
|
200
199
|
answer = rails.confirm(message);
|
201
|
-
callback = rails.fire(element, 'confirm:complete', [answer]);
|
200
|
+
callback = rails.fire(element, 'confirm:complete', [answer]).result !== false;
|
202
201
|
}
|
203
202
|
return answer && callback;
|
204
203
|
},
|
@@ -271,13 +270,13 @@
|
|
271
270
|
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
272
271
|
|
273
272
|
// skip other logic when required values are missing or file upload is present
|
274
|
-
if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
273
|
+
if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs]).result !== false) {
|
275
274
|
return rails.stopEverything(e);
|
276
275
|
}
|
277
276
|
|
278
277
|
if (remote) {
|
279
278
|
if (nonBlankFileInputs) {
|
280
|
-
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
279
|
+
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]).result !== false;
|
281
280
|
}
|
282
281
|
|
283
282
|
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-rails_vho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- "Andr\xC3\xA9 Arko"
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-11-05 00:00:00 +01:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,6 +27,7 @@ dependencies:
|
|
26
27
|
requirements:
|
27
28
|
- - ~>
|
28
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 7
|
29
31
|
segments:
|
30
32
|
- 3
|
31
33
|
- 0
|
@@ -40,6 +42,7 @@ dependencies:
|
|
40
42
|
requirements:
|
41
43
|
- - ~>
|
42
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
43
46
|
segments:
|
44
47
|
- 0
|
45
48
|
- 14
|
@@ -54,6 +57,7 @@ dependencies:
|
|
54
57
|
requirements:
|
55
58
|
- - ~>
|
56
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 23
|
57
61
|
segments:
|
58
62
|
- 1
|
59
63
|
- 0
|
@@ -69,6 +73,7 @@ dependencies:
|
|
69
73
|
requirements:
|
70
74
|
- - ~>
|
71
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 5
|
72
77
|
segments:
|
73
78
|
- 3
|
74
79
|
- 1
|
@@ -121,6 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
126
|
requirements:
|
122
127
|
- - ">="
|
123
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
124
130
|
segments:
|
125
131
|
- 0
|
126
132
|
version: "0"
|
@@ -129,6 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
135
|
requirements:
|
130
136
|
- - ">="
|
131
137
|
- !ruby/object:Gem::Version
|
138
|
+
hash: 23
|
132
139
|
segments:
|
133
140
|
- 1
|
134
141
|
- 3
|