piggybak_coupons 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
1
  $(function() {
2
+ $('#coupon_code').change(function() {
3
+ $(this).data('changed', true);
4
+ });
2
5
  $('#shipping select').change(function() {
3
6
  piggybak_coupons.apply_coupon(false);
4
7
  return false;
@@ -13,6 +16,7 @@ $(function() {
13
16
  });
14
17
  setTimeout(function() {
15
18
  if($('#coupon_code').val() != '') {
19
+ $('#coupon_code').data('changed', true);
16
20
  piggybak_coupons.apply_coupon(false);
17
21
  }
18
22
  }, 500);
@@ -20,6 +24,13 @@ $(function() {
20
24
 
21
25
  var piggybak_coupons = {
22
26
  apply_coupon: function(on_submit) {
27
+ if(!$('#coupon_code').data('changed')) {
28
+ if(on_submit) {
29
+ $('#new_piggybak_order').submit();
30
+ }
31
+ return;
32
+ }
33
+ $('#coupon_code').data('changed', false);
23
34
  $('#coupon input[type=hidden]').remove();
24
35
  $('#coupon_response').hide();
25
36
  $.ajax({
@@ -1,3 +1,3 @@
1
1
  module PiggybakCoupons
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak_coupons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2012-10-17 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  segments:
98
98
  - 0
99
- hash: 2574058668804604376
99
+ hash: 2945546694500503241
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  segments:
107
107
  - 0
108
- hash: 2574058668804604376
108
+ hash: 2945546694500503241
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 1.8.23