ratnikov-ajax_resource 0.03 → 0.04
Sign up to get free protection for your applications and to get access to all the features.
- data/src/form.js +27 -1
- metadata +2 -2
data/src/form.js
CHANGED
@@ -17,7 +17,33 @@ AjaxResource.Form = function(form, options) {
|
|
17
17
|
|
18
18
|
this._on_save = options.on_save;
|
19
19
|
|
20
|
-
this._semaphore = new AjaxResource.Semaphore()
|
20
|
+
this._semaphore = new AjaxResource.Semaphore(function() {
|
21
|
+
var old_submit_value = null;
|
22
|
+
return {
|
23
|
+
on_unavailable: function() {
|
24
|
+
if (old_submit_value === null) {
|
25
|
+
self.submit_button().attr("disabled", true);
|
26
|
+
|
27
|
+
old_submit_value = self.submit_button().val();
|
28
|
+
self.submit_button().val("Processing...");
|
29
|
+
} else {
|
30
|
+
// do nothing since it has been disabled
|
31
|
+
}
|
32
|
+
},
|
33
|
+
on_available: function() {
|
34
|
+
if (old_submit_value !== null) {
|
35
|
+
self.submit_button().val(old_submit_value);
|
36
|
+
self.submit_button().attr("disabled", false);
|
37
|
+
old_submit_value = null;
|
38
|
+
} else {
|
39
|
+
// do nothing since already available
|
40
|
+
}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
}());
|
44
|
+
|
45
|
+
// make sure the submit button is not disabled
|
46
|
+
this.submit_button().attr("disabled", false);
|
21
47
|
|
22
48
|
this.submit_button().bind("click", function(event) {
|
23
49
|
event.preventDefault();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratnikov-ajax_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.04"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Ratnikov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-04 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|