onestep 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  require "onestep/version"
2
- require "onestep/engine"
2
+ require "onestep/engine" if defined?(Rails)
3
3
 
4
4
  module Onestep
5
5
  # Your code goes here...
@@ -1,3 +1,3 @@
1
1
  module Onestep
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,5 +1,7 @@
1
1
  (function(exports) {
2
- var disabler = {
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
- _this = this;
33
- $this = $(this);
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.1
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-16 00:00:00.000000000 Z
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.