piggybak 0.6.33 → 0.6.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjljN2ExZTUxNTAzOTNkYjYwZmM5MzU0MjIzMGRmOWJiOTMwNTRhNg==
5
- data.tar.gz: !binary |-
6
- YjZhZTUwNWY3ZDIwNjI3Mjk0Nzk4NWQ0YTVkOGNlYzA4M2MwYzIxMQ==
2
+ SHA1:
3
+ metadata.gz: 94b5a0a0fd89dc240c03223177459facec423547
4
+ data.tar.gz: 753d6351fa7aaf93d47ab9c5fa400349c1e39439
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- M2JlNGU4N2U2MDFkYmM5OTYzNGI2OTJmYjNiOWQ0OTg2MmY1MmFkNTM0MWI1
10
- OWMzN2I0YzcwM2QwN2FkMmVkMTNjNTcwYTQxYmNkMDJmNWQwMjk2YjMxNTMy
11
- YzMzZTZiZDRjZTU5MWFjOWQ5M2Q4YTljNjU0ZTgwMjNhZGEzOTA=
12
- data.tar.gz: !binary |-
13
- MzE3Nzk3NzQ0M2Y5NTM2YmVhMWI4ODliNzIzOGM4YTZkNGRhM2ZjYWZkNzQ3
14
- ZmRlNDFiNDY0NmY0OGQ5YTE1ZWEyMTJlOGE0NzNjOGUxNTU4MDBmZWEyZjQ4
15
- NzM0ODdkNThmN2Q5ZjlmZTk4NjdjMWZlZTdkYTVhZDk5ZjMwOGY=
6
+ metadata.gz: fdf32c2d395715e618a7a33454aa1c5b8f1c1585c24b4d18b90903404c8e885a71e83bee78f38c20bb688a2e9b91e6501c1f2914918a3c18640ceabb0902f8aa
7
+ data.tar.gz: be61bb408522ff2db2c09f30d320cb1416db0f313393b17322413aca61cf3f6e5abdff905ad44ec9b7b4d31db08ae5322e1c67a66baa38a329705e0b7a903c58
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- piggybak (0.6.33)
4
+ piggybak (0.6.34)
5
5
  activemerchant
6
6
  countries
7
7
  devise
@@ -0,0 +1,109 @@
1
+ var geodata;
2
+
3
+ var piggybak_rails_admin = {
4
+ line_item_types: <%= Piggybak.config.line_item_types.to_json %>,
5
+ initialize_listeners: function() {
6
+ $('#piggybak_order_shipping_address_attributes_country_id').change(function() {
7
+ piggybak_rails_admin.update_state_option('shipping');
8
+ });
9
+ $('#piggybak_order_billing_address_attributes_country_id').change(function() {
10
+ piggybak_rails_admin.update_state_option('billing');
11
+ });
12
+ $.each(['billing', 'shipping'], function(i, type) {
13
+ $(document).on('change', '#' + type + '_state_id', function() {
14
+ $('#piggybak_order_' + type + '_address_attributes_state_id').val($('#' + type + '_state_id').val());
15
+ });
16
+ });
17
+ return;
18
+ },
19
+ populate_geodata: function() {
20
+ $.ajax({
21
+ url: geodata_lookup,
22
+ cached: false,
23
+ dataType: "JSON",
24
+ success: function(data) {
25
+ geodata = data;
26
+ piggybak_rails_admin.update_state_option('shipping');
27
+ piggybak_rails_admin.update_state_option('billing');
28
+ $.each(['billing', 'shipping'], function(i, type) {
29
+ $('#' + type + '_state_id').val($('#piggybak_order_' + type + '_address_attributes_state_id').val());
30
+ });
31
+ }
32
+ });
33
+ },
34
+ update_state_option: function(type, block) {
35
+ var country_field = $('#piggybak_order_' + type + '_address_attributes_country_id');
36
+ var country_id = country_field.val();
37
+ var new_field;
38
+
39
+ if(country_id == '') {
40
+ country_id = "<%= ::Piggybak::Country.where(abbr: Piggybak.config.default_country).first.id %>";
41
+ }
42
+ if(geodata.countries["country_" + country_id].length > 0) {
43
+ new_field = $('<select>');
44
+ $.each(geodata.countries["country_" + country_id], function(i, j) {
45
+ new_field.append($('<option>').val(j.id).html(j.name));
46
+ });
47
+ } else {
48
+ new_field = $('<input>');
49
+ }
50
+
51
+ var old_field = $('#piggybak_order_' + type + '_address_attributes_state_id');
52
+ new_field.attr('name', old_field.attr('name')).attr('id', old_field.attr('id'));
53
+ if(old_field.prop('tagName') == new_field.prop('tagName')) {
54
+ new_field.val(old_field.val());
55
+ }
56
+ old_field.replaceWith(new_field);
57
+
58
+ if(block) {
59
+ block();
60
+ }
61
+
62
+ return;
63
+ },
64
+ toggle_line_item: function(el) {
65
+ var line_item = el.parent().parent().parent();
66
+ line_item.find('> div.control-group').not('.line_item_type_field').hide();
67
+ if(piggybak_rails_admin.line_item_types[el.val()].fields !== undefined) {
68
+ $.each(piggybak_rails_admin.line_item_types[el.val()].fields, function(a, b) {
69
+ line_item.find('> div.' + b + '_field').show();
70
+ });
71
+ }
72
+ }
73
+ };
74
+
75
+ $(function() {
76
+ if($('#edit_piggybak_order,#new_piggybak_order').size() == 0) {
77
+ return;
78
+ }
79
+
80
+ piggybak_rails_admin.populate_geodata();
81
+ piggybak_rails_admin.initialize_listeners();
82
+
83
+ $('#copy_from_billing').click(function(e) {
84
+ e.preventDefault();
85
+
86
+ $.each($('#piggybak_order_billing_address_attributes_field input'), function(i, el) {
87
+ if($(el).attr('id') !== undefined) {
88
+ var shipping_id = $(el).attr('id').replace('billing', 'shipping');
89
+ $('#' + shipping_id).val($(el).val());
90
+ }
91
+ });
92
+ $('#piggybak_order_shipping_address_attributes_country_id').val($('#piggybak_order_billing_address_attributes_country_id').val());
93
+ piggybak_rails_admin.update_state_option('shipping', function() {
94
+ $('#piggybak_order_shipping_address_attributes_state_id').val($('#piggybak_order_billing_address_attributes_state_id').val());
95
+ });
96
+ });
97
+
98
+ //From polymorphic
99
+ $.each($('.line_item_type_field select,.line_item_type_field input'), function(i, el) {
100
+ piggybak_rails_admin.toggle_line_item($(el));
101
+ });
102
+ //Removing delete-ability of line_item_types that can't be destroyed
103
+ $.each($('.line_item_type_field input'), function(i, el) {
104
+ if(!piggybak_rails_admin.line_item_types[$(el).val()].allow_destroy) {
105
+ $(el).parentsUntil('fieldset').parent().parent().find('.remove_nested_fields').remove();
106
+ }
107
+ });
108
+ });
109
+
@@ -1,15 +1 @@
1
1
  <a href="#" id="copy_from_billing">copy from billing</a>
2
-
3
- %script
4
- $('#copy_from_billing').click(function() {
5
- $.each($('#piggybak_order_billing_address_attributes_field input'), function(i, el) {
6
- if($(el).attr('id') != 'piggybak_order_billing_address_attributes_id') {
7
- var shipping_id = $(el).attr('id').replace('billing', 'shipping');
8
- $('#' + shipping_id).val($(el).val());
9
- }
10
- });
11
- $('#piggybak_order_shipping_address_attributes_country_id').val($('#piggybak_order_billing_address_attributes_country_id').val());
12
- piggybak_states.update_state_option('shipping');
13
- $('#piggybak_order_shipping_address_attributes_state_id').val($('#piggybak_order_billing_address_attributes_state_id').val());
14
- return false;
15
- });
@@ -10,6 +10,3 @@
10
10
 
11
11
  :javascript
12
12
  var geodata_lookup = "#{piggybak.orders_geodata_url}";
13
-
14
- - if type == "billing"
15
- = javascript_include_tag "piggybak/piggybak.states"
@@ -1,3 +1,3 @@
1
1
  module Piggybak
2
- VERSION = "0.6.33"
2
+ VERSION = "0.6.34"
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.33
4
+ version: 0.6.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steph Skardal
@@ -10,90 +10,90 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-22 00:00:00.000000000 Z
13
+ date: 2014-09-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 3.2.8
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 3.2.8
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rails_admin
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: 0.4.5
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.4.5
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: countries
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ! '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ! '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: activemerchant
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ! '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ! '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: devise
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ! '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ! '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rack-ssl-enforcer
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ! '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ! '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  description: Mountable Ruby on Rails Ecommerce.
@@ -115,6 +115,7 @@ files:
115
115
  - app/assets/javascripts/piggybak/piggybak-application.js
116
116
  - app/assets/javascripts/piggybak/piggybak.js
117
117
  - app/assets/javascripts/piggybak/piggybak.states.js
118
+ - app/assets/javascripts/rails_admin/custom/ui.js.erb
118
119
  - app/controllers/piggybak/cart_controller.rb
119
120
  - app/controllers/piggybak/orders_controller.rb
120
121
  - app/helpers/piggybak_helper.rb
@@ -218,17 +219,17 @@ require_paths:
218
219
  - lib
219
220
  required_ruby_version: !ruby/object:Gem::Requirement
220
221
  requirements:
221
- - - ! '>='
222
+ - - ">="
222
223
  - !ruby/object:Gem::Version
223
224
  version: '0'
224
225
  required_rubygems_version: !ruby/object:Gem::Requirement
225
226
  requirements:
226
- - - ! '>='
227
+ - - ">="
227
228
  - !ruby/object:Gem::Version
228
229
  version: '0'
229
230
  requirements: []
230
231
  rubyforge_project:
231
- rubygems_version: 2.2.1
232
+ rubygems_version: 2.2.2
232
233
  signing_key:
233
234
  specification_version: 4
234
235
  summary: Mountable Ruby on Rails Ecommerce.