onestep 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/onestep.rb +1 -1
- data/lib/onestep/version.rb +1 -1
- data/vendor/assets/javascripts/onestep/onestep.js +13 -9
- metadata +2 -2
data/lib/onestep.rb
CHANGED
data/lib/onestep/version.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
(function(exports) {
|
2
|
-
|
2
|
+
exports.Onestep = {};
|
3
|
+
|
4
|
+
Onestep.disabler = {
|
3
5
|
// Disable an <a/> tag.
|
4
6
|
disableLink: function(e) {
|
5
7
|
return this.each(function() {
|
@@ -28,26 +30,28 @@
|
|
28
30
|
|
29
31
|
jQuery.fn.onestep = function() {
|
30
32
|
return this.each(function() {
|
31
|
-
var $this,
|
32
|
-
|
33
|
-
|
33
|
+
var $this = $(this),
|
34
|
+
_this = this;
|
35
|
+
|
34
36
|
if ($this.is('a')) {
|
35
37
|
$this.on('ajax:complete', function() {
|
36
|
-
return disabler.enableLink.apply($this);
|
38
|
+
return Onestep.disabler.enableLink.apply($this);
|
37
39
|
});
|
40
|
+
|
38
41
|
if ($this.hasClass('disabled')) {
|
39
|
-
return disabler.disableLink.apply($this);
|
42
|
+
return Onestep.disabler.disableLink.apply($this);
|
40
43
|
} else {
|
41
44
|
return $this.on('ajax:beforeSend', function() {
|
42
|
-
return disabler.disableLink.apply($this);
|
45
|
+
return Onestep.disabler.disableLink.apply($this);
|
43
46
|
});
|
44
47
|
}
|
48
|
+
|
45
49
|
} else if ($this.is('form')) {
|
46
50
|
$this.on('ajax:complete', function() {
|
47
|
-
return disabler.enableForm.apply($this);
|
51
|
+
return Onestep.disabler.enableForm.apply($this);
|
48
52
|
});
|
49
53
|
return $this.submit(function() {
|
50
|
-
return disabler.disableForm.apply($this);
|
54
|
+
return Onestep.disabler.disableForm.apply($this);
|
51
55
|
});
|
52
56
|
}
|
53
57
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onestep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Prevent users sending duplicate requests by rapidly clicking links and
|
15
15
|
buttons.
|