piggybak 0.6.12 → 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,4 +6,5 @@
6
6
  //
7
7
  //= require piggybak/piggybak
8
8
  //= require piggybak/jquery.ajaxq
9
+ //= require piggybak/jquery.validate
9
10
  //= require piggybak/piggybak.states
@@ -4,23 +4,21 @@ var page_load = 1;
4
4
  var shipping_field;
5
5
 
6
6
  $(function() {
7
- piggybak.prevent_double_click();
8
7
  shipping_field = $('#piggybak_order_line_items_attributes_0_shipment_attributes_shipping_method_id');
9
8
  piggybak.initialize_listeners();
10
9
  piggybak.update_shipping_options($('#piggybak_order_shipping_address_attributes_state_id'), function() {
11
10
  $('#piggybak_order_shipments_attributes_0_shipping_method_id').val(previous_shipping);
12
11
  });
13
12
  piggybak.update_tax();
13
+ $('#new_piggybak_order').validate({
14
+ submitHandler: function(form) {
15
+ form.submit()
16
+ }
17
+ });
14
18
  });
15
19
 
16
20
  var piggybak = {
17
21
  shipping_els: $('#piggybak_order_shipping_address_attributes_state_id,#piggybak_order_shipping_address_attributes_country_id,#piggybak_order_shipping_address_attributes_zip'),
18
- prevent_double_click: function() {
19
- $('#new_piggybak_order').find('input:submit').removeAttr('disabled');
20
- $('#new_piggybak_order').submit(function() {
21
- $(this).find('input:submit').attr('disabled', 'disabled');
22
- });
23
- },
24
22
  initialize_listeners: function() {
25
23
  piggybak.shipping_els.live('change', function() {
26
24
  piggybak.update_shipping_options($(this));
@@ -49,6 +47,7 @@ var piggybak = {
49
47
  var state = $('#piggybak_order_billing_address_attributes_state_id').val();
50
48
  $('#piggybak_order_shipping_address_attributes_state_id').val(state);
51
49
  });
50
+ $('#shipping_address input').valid();
52
51
  },
53
52
  valid_shipping_address: function() {
54
53
  var empty = 0;
@@ -116,7 +115,7 @@ var piggybak = {
116
115
  });
117
116
  },
118
117
  update_totals: function() {
119
- var subtotal = $('#subtotal_total').data('total');
118
+ var subtotal = parseFloat($('#subtotal_total').data('total'));
120
119
  $('#tax_total').html('$' + tax_total.toFixed(2));
121
120
  var shipping_total = 0;
122
121
  if($('#shipping select option:selected').length) {
@@ -16,17 +16,17 @@
16
16
  <div class="item">
17
17
  <% if current_user -%>
18
18
  <%= f.label :email %>
19
- <%= f.text_field :email, { :readonly => true, :class => "readonly" } %><br />
19
+ <%= f.text_field :email, { :readonly => true, :class => "readonly required" } %>
20
20
  <span>or <%= link_to 'LOGOUT', destroy_user_session_path, :method => :delete, :class => "last" %></span>
21
21
  <% else -%>
22
22
  <%= f.label :email %>
23
- <%= f.text_field :email %><br />
23
+ <%= f.text_field :email, :class =-> "required" %><br />
24
24
  <span>or <%= link_to 'LOG IN', new_user_session_path %></span>
25
25
  <% end -%>
26
26
  </div>
27
27
  <div class="item">
28
28
  <%= f.label :phone %>
29
- <%= f.text_field :phone %>
29
+ <%= f.text_field :phone, :class => "required" %>
30
30
  </div>
31
31
  </div>
32
32
 
@@ -78,10 +78,10 @@
78
78
  <%= payment.label :number %>
79
79
  <% if @order.errors.keys.include?("payments.number".to_sym) %>
80
80
  <span class="field_with_errors">
81
- <%= payment.text_field :number %>
81
+ <%= payment.text_field :number, :class => "required" %>
82
82
  </span>
83
83
  <% else -%>
84
- <%= payment.text_field :number %>
84
+ <%= payment.text_field :number, :class => "required" %>
85
85
  <% end -%>
86
86
  </div>
87
87
 
@@ -89,10 +89,10 @@
89
89
  <%= payment.label :verification_value %>
90
90
  <% if @order.errors.keys.include?("payments.verification_value".to_sym) %>
91
91
  <span class="field_with_errors">
92
- <%= payment.text_field :verification_value %>
92
+ <%= payment.text_field :verification_value, :class => "required" %>
93
93
  </span>
94
94
  <% else -%>
95
- <%= payment.text_field :verification_value %>
95
+ <%= payment.text_field :verification_value, :class => "required" %>
96
96
  <% end -%>
97
97
  </div>
98
98
 
@@ -1,3 +1,3 @@
1
1
  module Piggybak
2
- VERSION = "0.6.12"
2
+ VERSION = "0.6.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-11-01 00:00:00.000000000 Z
14
+ date: 2012-11-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -106,6 +106,7 @@ files:
106
106
  - app/assets/javascripts/piggybak/piggybak.js
107
107
  - app/assets/javascripts/piggybak/piggybak.states.js
108
108
  - app/assets/javascripts/piggybak/piggybak-application.js
109
+ - app/assets/javascripts/piggybak/jquery.validate.js
109
110
  - app/assets/javascripts/piggybak/jquery.ajaxq.js
110
111
  - app/assets/images/ajax-loader.gif
111
112
  - app/models/piggybak/payment_calculator/fake.rb
@@ -212,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
213
  version: '0'
213
214
  segments:
214
215
  - 0
215
- hash: -1733522364764140920
216
+ hash: 1341771261448397345
216
217
  required_rubygems_version: !ruby/object:Gem::Requirement
217
218
  none: false
218
219
  requirements:
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
222
  version: '0'
222
223
  segments:
223
224
  - 0
224
- hash: -1733522364764140920
225
+ hash: 1341771261448397345
225
226
  requirements: []
226
227
  rubyforge_project:
227
228
  rubygems_version: 1.8.23