piggybak 0.6.34 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -14
- data/Gemfile.lock +18 -149
- data/README.md +6 -0
- data/app/assets/javascripts/piggybak/piggybak.js +18 -15
- data/app/assets/javascripts/piggybak/piggybak.states.js +7 -4
- data/app/assets/javascripts/rails_admin/custom/ui.js.erb +33 -28
- data/app/controllers/piggybak/orders_controller.rb +15 -3
- data/app/models/piggybak/address.rb +8 -11
- data/app/models/piggybak/country.rb +3 -4
- data/app/models/piggybak/line_item.rb +3 -3
- data/app/models/piggybak/order.rb +11 -6
- data/app/models/piggybak/order_note.rb +2 -3
- data/app/models/piggybak/payment.rb +4 -7
- data/app/models/piggybak/payment_method.rb +2 -4
- data/app/models/piggybak/payment_method_value.rb +2 -4
- data/app/models/piggybak/sellable.rb +4 -7
- data/app/models/piggybak/shipment.rb +2 -4
- data/app/models/piggybak/shipping_calculator/flat_rate.rb +1 -1
- data/app/models/piggybak/shipping_calculator/range.rb +1 -1
- data/app/models/piggybak/shipping_method +0 -0
- data/app/models/piggybak/shipping_method.rb +3 -6
- data/app/models/piggybak/shipping_method_value.rb +2 -3
- data/app/models/piggybak/state.rb +0 -1
- data/app/models/piggybak/tax_calculator/percent.rb +6 -10
- data/app/models/piggybak/tax_method.rb +5 -6
- data/app/models/piggybak/tax_method_value.rb +2 -3
- data/app/views/piggybak/orders/_user_details.html.erb +2 -2
- data/app/views/rails_admin/main/{_copy_from_billing.html.haml → _copy_from_billing.html.erb} +0 -0
- data/app/views/rails_admin/main/_location_select.html.haml +2 -4
- data/app/views/rails_admin/main/_polymorphic_nested.html.haml +1 -25
- data/config/routes.rb +17 -19
- data/db/migrate/20140325133841_upgrade_piggybak_tables.rb +19 -0
- data/lib/piggybak.rb +1 -477
- data/lib/piggybak/config.rb +2 -0
- data/lib/piggybak/engine.rb +481 -0
- data/lib/piggybak/version.rb +1 -1
- metadata +6 -46
- data/lib/currency.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cdf2d5cc0e37659ae8f4feced76d5962cc06951
|
4
|
+
data.tar.gz: 4588a015c22ef9592f318cfe73eed056e408661f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0922ce19a2e5ee163b94d88b832b8cc859a28d1dbb1fade281a2884ef05a447a786d0878c1e7b974a7b8c41b448ea367f6db4ce324f0c2070e9bd91b876f76ab
|
7
|
+
data.tar.gz: 12962e94a387f5153892f27a3ab72acbde68ad548ae4c4d90750557345b6e5ad4baeba6030295db95a7f549e2d2a50c1541f3672a109a4415d4bf6016598a2c8
|
data/Gemfile
CHANGED
@@ -4,17 +4,3 @@ source "http://rubygems.org"
|
|
4
4
|
# Bundler will treat runtime dependencies like base dependencies, and
|
5
5
|
# development dependencies will be added by default to the :development group.
|
6
6
|
gemspec
|
7
|
-
|
8
|
-
# jquery-rails is used by the dummy application
|
9
|
-
gem "jquery-rails"
|
10
|
-
|
11
|
-
# Declare any dependencies that are still in development here instead of in
|
12
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
13
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
14
|
-
# your gem to rubygems.org.
|
15
|
-
|
16
|
-
# To use debugger
|
17
|
-
# gem 'debugger'
|
18
|
-
|
19
|
-
gem "countries"
|
20
|
-
gem "rack-ssl-enforcer"
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
piggybak (0.
|
4
|
+
piggybak (0.7.0)
|
5
5
|
activemerchant
|
6
6
|
countries
|
7
|
-
devise
|
8
7
|
rack-ssl-enforcer
|
9
|
-
rails (~> 3.2.8)
|
10
|
-
rails_admin (~> 0.4.5)
|
11
8
|
|
12
9
|
GEM
|
13
10
|
remote: http://rubygems.org/
|
14
11
|
specs:
|
15
|
-
|
16
|
-
actionpack (= 3.2.16)
|
17
|
-
mail (~> 2.5.4)
|
18
|
-
actionpack (3.2.16)
|
19
|
-
activemodel (= 3.2.16)
|
20
|
-
activesupport (= 3.2.16)
|
21
|
-
builder (~> 3.0.0)
|
22
|
-
erubis (~> 2.7.0)
|
23
|
-
journey (~> 1.0.4)
|
24
|
-
rack (~> 1.4.5)
|
25
|
-
rack-cache (~> 1.2)
|
26
|
-
rack-test (~> 0.6.1)
|
27
|
-
sprockets (~> 2.2.1)
|
28
|
-
active_utils (2.0.1)
|
12
|
+
active_utils (2.0.2)
|
29
13
|
activesupport (>= 2.3.11)
|
30
14
|
i18n
|
31
|
-
activemerchant (1.42.
|
15
|
+
activemerchant (1.42.7)
|
32
16
|
active_utils (~> 2.0, >= 2.0.1)
|
33
17
|
activesupport (>= 2.3.14, < 5.0.0)
|
34
18
|
builder (>= 2.1.2, < 4.0.0)
|
@@ -36,148 +20,33 @@ GEM
|
|
36
20
|
json (~> 1.7)
|
37
21
|
money (< 7.0.0)
|
38
22
|
nokogiri (~> 1.4)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
activeresource (3.2.16)
|
48
|
-
activemodel (= 3.2.16)
|
49
|
-
activesupport (= 3.2.16)
|
50
|
-
activesupport (3.2.16)
|
51
|
-
i18n (~> 0.6, >= 0.6.4)
|
52
|
-
multi_json (~> 1.0)
|
53
|
-
arel (3.0.3)
|
54
|
-
atomic (1.1.14)
|
55
|
-
bcrypt-ruby (3.1.2)
|
56
|
-
bootstrap-sass (2.3.2.2)
|
57
|
-
sass (~> 3.2)
|
58
|
-
builder (3.0.4)
|
59
|
-
coffee-rails (3.2.2)
|
60
|
-
coffee-script (>= 2.2.0)
|
61
|
-
railties (~> 3.2.0)
|
62
|
-
coffee-script (2.2.0)
|
63
|
-
coffee-script-source
|
64
|
-
execjs
|
65
|
-
coffee-script-source (1.6.3)
|
23
|
+
activesupport (4.0.4)
|
24
|
+
i18n (~> 0.6, >= 0.6.9)
|
25
|
+
minitest (~> 4.2)
|
26
|
+
multi_json (~> 1.3)
|
27
|
+
thread_safe (~> 0.1)
|
28
|
+
tzinfo (~> 0.3.37)
|
29
|
+
atomic (1.1.16)
|
30
|
+
builder (3.2.2)
|
66
31
|
countries (0.9.3)
|
67
32
|
currencies (~> 0.4.2)
|
68
33
|
currencies (0.4.2)
|
69
|
-
devise (3.2.2)
|
70
|
-
bcrypt-ruby (~> 3.0)
|
71
|
-
orm_adapter (~> 0.1)
|
72
|
-
railties (>= 3.2.6, < 5)
|
73
|
-
thread_safe (~> 0.1)
|
74
|
-
warden (~> 1.2.3)
|
75
|
-
erubis (2.7.0)
|
76
|
-
execjs (2.0.2)
|
77
|
-
font-awesome-rails (3.2.1.3)
|
78
|
-
railties (>= 3.2, < 5.0)
|
79
|
-
haml (4.0.5)
|
80
|
-
tilt
|
81
|
-
hike (1.2.3)
|
82
34
|
i18n (0.6.9)
|
83
|
-
journey (1.0.4)
|
84
|
-
jquery-rails (3.0.4)
|
85
|
-
railties (>= 3.0, < 5.0)
|
86
|
-
thor (>= 0.14, < 2.0)
|
87
|
-
jquery-ui-rails (3.0.1)
|
88
|
-
jquery-rails
|
89
|
-
railties (>= 3.1.0)
|
90
35
|
json (1.8.1)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
mail (2.5.4)
|
95
|
-
mime-types (~> 1.16)
|
96
|
-
treetop (~> 1.4.8)
|
97
|
-
mime-types (1.25.1)
|
98
|
-
mini_portile (0.5.2)
|
99
|
-
monetize (0.1.3)
|
100
|
-
money (6.0.1)
|
36
|
+
mini_portile (0.5.3)
|
37
|
+
minitest (4.7.5)
|
38
|
+
money (6.1.1)
|
101
39
|
i18n (~> 0.6.4)
|
102
|
-
|
103
|
-
multi_json (1.8.4)
|
104
|
-
nested_form (0.3.2)
|
40
|
+
multi_json (1.9.2)
|
105
41
|
nokogiri (1.6.1)
|
106
42
|
mini_portile (~> 0.5.0)
|
107
|
-
orm_adapter (0.5.0)
|
108
|
-
polyglot (0.3.3)
|
109
|
-
rack (1.4.5)
|
110
|
-
rack-cache (1.2)
|
111
|
-
rack (>= 0.4)
|
112
|
-
rack-pjax (0.7.0)
|
113
|
-
nokogiri (~> 1.5)
|
114
|
-
rack (~> 1.3)
|
115
|
-
rack-ssl (1.3.3)
|
116
|
-
rack
|
117
43
|
rack-ssl-enforcer (0.2.6)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
actionmailer (= 3.2.16)
|
122
|
-
actionpack (= 3.2.16)
|
123
|
-
activerecord (= 3.2.16)
|
124
|
-
activeresource (= 3.2.16)
|
125
|
-
activesupport (= 3.2.16)
|
126
|
-
bundler (~> 1.0)
|
127
|
-
railties (= 3.2.16)
|
128
|
-
rails_admin (0.4.9)
|
129
|
-
bootstrap-sass (~> 2.2)
|
130
|
-
builder (~> 3.0)
|
131
|
-
coffee-rails (>= 3.1, < 5)
|
132
|
-
font-awesome-rails (~> 3.0)
|
133
|
-
haml (~> 4.0)
|
134
|
-
jquery-rails (>= 2.1, < 4)
|
135
|
-
jquery-ui-rails (~> 3.0)
|
136
|
-
kaminari (~> 0.14)
|
137
|
-
nested_form (~> 0.3)
|
138
|
-
rack-pjax (~> 0.6)
|
139
|
-
rails (~> 3.1)
|
140
|
-
remotipart (~> 1.0)
|
141
|
-
safe_yaml (~> 0.6)
|
142
|
-
sass-rails (~> 3.1)
|
143
|
-
railties (3.2.16)
|
144
|
-
actionpack (= 3.2.16)
|
145
|
-
activesupport (= 3.2.16)
|
146
|
-
rack-ssl (~> 1.3.2)
|
147
|
-
rake (>= 0.8.7)
|
148
|
-
rdoc (~> 3.4)
|
149
|
-
thor (>= 0.14.6, < 2.0)
|
150
|
-
rake (10.1.1)
|
151
|
-
rdoc (3.12.2)
|
152
|
-
json (~> 1.4)
|
153
|
-
remotipart (1.2.1)
|
154
|
-
safe_yaml (0.9.7)
|
155
|
-
sass (3.2.13)
|
156
|
-
sass-rails (3.2.6)
|
157
|
-
railties (~> 3.2.0)
|
158
|
-
sass (>= 3.1.10)
|
159
|
-
tilt (~> 1.3)
|
160
|
-
sprockets (2.2.2)
|
161
|
-
hike (~> 1.2)
|
162
|
-
multi_json (~> 1.0)
|
163
|
-
rack (~> 1.0)
|
164
|
-
tilt (~> 1.1, != 1.3.0)
|
165
|
-
thor (0.18.1)
|
166
|
-
thread_safe (0.1.3)
|
167
|
-
atomic
|
168
|
-
tilt (1.4.1)
|
169
|
-
treetop (1.4.15)
|
170
|
-
polyglot
|
171
|
-
polyglot (>= 0.3.1)
|
172
|
-
tzinfo (0.3.38)
|
173
|
-
warden (1.2.3)
|
174
|
-
rack (>= 1.0)
|
44
|
+
thread_safe (0.3.1)
|
45
|
+
atomic (>= 1.1.7, < 2)
|
46
|
+
tzinfo (0.3.39)
|
175
47
|
|
176
48
|
PLATFORMS
|
177
49
|
ruby
|
178
50
|
|
179
51
|
DEPENDENCIES
|
180
|
-
countries
|
181
|
-
jquery-rails
|
182
52
|
piggybak!
|
183
|
-
rack-ssl-enforcer
|
data/README.md
CHANGED
@@ -11,6 +11,8 @@ Modular / mountable ecommerce gem. Features:
|
|
11
11
|
|
12
12
|
* Fully defined backend RailsAdmin interface for adding orders on the backend
|
13
13
|
|
14
|
+
* Piggybak 0.7.0 is compatible with Rails 4, and earlier versions compatible with Rails 3.
|
15
|
+
|
14
16
|
|
15
17
|
Announcements
|
16
18
|
========
|
@@ -42,6 +44,10 @@ Installation
|
|
42
44
|
|
43
45
|
piggybak install
|
44
46
|
|
47
|
+
* Add piggybak/piggybak-application to your main application.js:
|
48
|
+
|
49
|
+
//= require piggybak/piggybak-application
|
50
|
+
|
45
51
|
(NOTE: If you run into an error saying that piggybak gem is missing, use bundle exec piggybak install)
|
46
52
|
|
47
53
|
* Follow the instructions [here][documentation] to read more about the integration points and product configuration in Piggybak.
|
@@ -4,15 +4,18 @@ var page_load = 1;
|
|
4
4
|
var shipping_field;
|
5
5
|
|
6
6
|
$(function() {
|
7
|
-
|
7
|
+
if($('form#new_order').size() == 0) {
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
shipping_field = $('#order_line_items_attributes_0_shipment_attributes_shipping_method_id');
|
8
11
|
piggybak.initialize_listeners();
|
9
|
-
piggybak.update_shipping_options($('#
|
10
|
-
$('#
|
12
|
+
piggybak.update_shipping_options($('#order_shipping_address_attributes_state_id'), function() {
|
13
|
+
$('#order_shipments_attributes_0_shipping_method_id').val(previous_shipping);
|
11
14
|
});
|
12
15
|
piggybak.update_tax();
|
13
|
-
$('#
|
16
|
+
$('#new_order').validate({
|
14
17
|
submitHandler: function(form) {
|
15
|
-
var submit = $($('#
|
18
|
+
var submit = $($('#new_order input[type=submit]'));
|
16
19
|
submit.prop('disabled',true);
|
17
20
|
submit.attr('value','Processing...');
|
18
21
|
form.submit()
|
@@ -21,20 +24,20 @@ $(function() {
|
|
21
24
|
});
|
22
25
|
|
23
26
|
var piggybak = {
|
24
|
-
shipping_els: '#
|
27
|
+
shipping_els: '#order_shipping_address_attributes_state_id,#order_shipping_address_attributes_country_id,#order_shipping_address_attributes_zip',
|
25
28
|
initialize_listeners: function() {
|
26
29
|
$(document).on('change', piggybak.shipping_els, function() {
|
27
30
|
piggybak.update_shipping_options($(this));
|
28
31
|
});
|
29
|
-
$(document).on('change', '#
|
32
|
+
$(document).on('change', '#order_billing_address_attributes_state_id', function() {
|
30
33
|
piggybak.update_tax();
|
31
34
|
});
|
32
35
|
$('#shipping select').change(function() {
|
33
36
|
piggybak.update_totals();
|
34
37
|
});
|
35
|
-
$('#shipping_address #copy').click
|
38
|
+
$('#shipping_address #copy').on('click', function() {
|
36
39
|
piggybak.copy_from_billing();
|
37
|
-
piggybak.update_shipping_options($('#
|
40
|
+
piggybak.update_shipping_options($('#order_shipping_address_attributes_state_id'));
|
38
41
|
return false;
|
39
42
|
});
|
40
43
|
return;
|
@@ -44,11 +47,11 @@ var piggybak = {
|
|
44
47
|
var id = $(j).attr('id').replace(/billing_address/, 'shipping_address');
|
45
48
|
$('#' + id).val($(j).val());
|
46
49
|
});
|
47
|
-
var country = $('#
|
48
|
-
$('#
|
50
|
+
var country = $('#order_billing_address_attributes_country_id').val();
|
51
|
+
$('#order_shipping_address_attributes_country_id').val(country);
|
49
52
|
piggybak_states.update_state_option('shipping', function() {
|
50
|
-
var state = $('#
|
51
|
-
$('#
|
53
|
+
var state = $('#order_billing_address_attributes_state_id').val();
|
54
|
+
$('#order_shipping_address_attributes_state_id').val(state);
|
52
55
|
});
|
53
56
|
$('#shipping_address input').valid();
|
54
57
|
},
|
@@ -107,7 +110,7 @@ var piggybak = {
|
|
107
110
|
});
|
108
111
|
$('#billing_address input, #billing_address select').each(function(i, j) {
|
109
112
|
var id = $(j).attr('id');
|
110
|
-
id = id.replace("
|
113
|
+
id = id.replace("order_billing_address_attributes_", '');
|
111
114
|
billing_data[id] = $(j).val();
|
112
115
|
});
|
113
116
|
$.ajax({
|
@@ -141,7 +144,7 @@ var piggybak = {
|
|
141
144
|
$('#shipping_address input, #shipping_address select').each(function(i, j) {
|
142
145
|
var id = $(j).attr('id');
|
143
146
|
if(typeof(id) !== 'undefined') {
|
144
|
-
id = id.replace("
|
147
|
+
id = id.replace("order_shipping_address_attributes_", '');
|
145
148
|
if($(j).is(':checkbox')) {
|
146
149
|
shipping_data[id] = $(j).is(':checked');
|
147
150
|
} else {
|
@@ -2,10 +2,10 @@ var geodata;
|
|
2
2
|
|
3
3
|
var piggybak_states = {
|
4
4
|
initialize_listeners: function() {
|
5
|
-
$('#
|
5
|
+
$('#order_shipping_address_attributes_country_id').change(function() {
|
6
6
|
piggybak_states.update_state_option('shipping');
|
7
7
|
});
|
8
|
-
$('#
|
8
|
+
$('#order_billing_address_attributes_country_id').change(function() {
|
9
9
|
piggybak_states.update_state_option('billing');
|
10
10
|
});
|
11
11
|
return;
|
@@ -23,7 +23,7 @@ var piggybak_states = {
|
|
23
23
|
});
|
24
24
|
},
|
25
25
|
update_state_option: function(type, block) {
|
26
|
-
var country_field = $('#
|
26
|
+
var country_field = $('#order_' + type + '_address_attributes_country_id');
|
27
27
|
var country_id = country_field.val();
|
28
28
|
var new_field;
|
29
29
|
|
@@ -35,7 +35,7 @@ var piggybak_states = {
|
|
35
35
|
} else {
|
36
36
|
new_field = $('<input>');
|
37
37
|
}
|
38
|
-
var old_field = $('#
|
38
|
+
var old_field = $('#order_' + type + '_address_attributes_state_id');
|
39
39
|
new_field.attr('name', old_field.attr('name')).attr('id', old_field.attr('id'));
|
40
40
|
if(old_field.prop('tagName') == new_field.prop('tagName')) {
|
41
41
|
new_field.val(old_field.val());
|
@@ -50,6 +50,9 @@ var piggybak_states = {
|
|
50
50
|
};
|
51
51
|
|
52
52
|
$(function() {
|
53
|
+
if($('form#new_order').size() == 0) {
|
54
|
+
return;
|
55
|
+
}
|
53
56
|
piggybak_states.populate_geodata();
|
54
57
|
piggybak_states.initialize_listeners();
|
55
58
|
});
|
@@ -38,17 +38,17 @@ var piggybak_rails_admin = {
|
|
38
38
|
|
39
39
|
if(country_id == '') {
|
40
40
|
country_id = "<%= ::Piggybak::Country.where(abbr: Piggybak.config.default_country).first.id %>";
|
41
|
-
}
|
41
|
+
}
|
42
42
|
if(geodata.countries["country_" + country_id].length > 0) {
|
43
43
|
new_field = $('<select>');
|
44
44
|
$.each(geodata.countries["country_" + country_id], function(i, j) {
|
45
45
|
new_field.append($('<option>').val(j.id).html(j.name));
|
46
|
-
});
|
46
|
+
});
|
47
47
|
} else {
|
48
48
|
new_field = $('<input>');
|
49
49
|
}
|
50
50
|
|
51
|
-
var old_field = $('#
|
51
|
+
var old_field = $('#' + type + '_state_id');
|
52
52
|
new_field.attr('name', old_field.attr('name')).attr('id', old_field.attr('id'));
|
53
53
|
if(old_field.prop('tagName') == new_field.prop('tagName')) {
|
54
54
|
new_field.val(old_field.val());
|
@@ -64,12 +64,12 @@ var piggybak_rails_admin = {
|
|
64
64
|
toggle_line_item: function(el) {
|
65
65
|
var line_item = el.parent().parent().parent();
|
66
66
|
line_item.find('> div.control-group').not('.line_item_type_field').hide();
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
71
|
}
|
72
|
-
|
72
|
+
}
|
73
73
|
};
|
74
74
|
|
75
75
|
$(function() {
|
@@ -80,30 +80,35 @@ $(function() {
|
|
80
80
|
piggybak_rails_admin.populate_geodata();
|
81
81
|
piggybak_rails_admin.initialize_listeners();
|
82
82
|
|
83
|
-
|
83
|
+
$('#copy_from_billing').click(function(e) {
|
84
84
|
e.preventDefault();
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
$('#piggybak_order_shipping_address_attributes_country_id').
|
93
|
-
|
94
|
-
|
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 option:last').remove();
|
93
|
+
$('<option>').val($('#piggybak_order_billing_address_attributes_country_id').val()).html($('#piggybak_order_billing_address_attributes_country_id_field input').val()).appendTo($('#piggybak_order_shipping_address_attributes_country_id'));
|
94
|
+
$('#piggybak_order_shipping_address_attributes_country_id').val($('#piggybak_order_billing_address_attributes_country_id').val());
|
95
|
+
$('#piggybak_order_shipping_address_attributes_country_id_field input').val($('#piggybak_order_billing_address_attributes_country_id_field input').val());
|
96
|
+
piggybak_rails_admin.update_state_option('shipping', function() {
|
97
|
+
$('#shipping_state_id').val($('#billing_state_id').val());
|
98
|
+
$('#piggybak_order_shipping_address_attributes_state_id').val($('#shipping_state_id').val());
|
95
99
|
});
|
96
|
-
|
100
|
+
return false;
|
101
|
+
});
|
97
102
|
|
98
103
|
//From polymorphic
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
$.each($('.line_item_type_field select,.line_item_type_field input'), function(i, el) {
|
105
|
+
piggybak_rails_admin.toggle_line_item($(el));
|
106
|
+
});
|
107
|
+
//Removing delete-ability of line_item_types that can't be destroyed
|
108
|
+
$.each($('.line_item_type_field input'), function(i, el) {
|
109
|
+
if(!piggybak_rails_admin.line_item_types[$(el).val()].allow_destroy) {
|
110
|
+
$(el).parentsUntil('fieldset').parent().parent().find('.remove_nested_fields').remove();
|
111
|
+
}
|
112
|
+
});
|
108
113
|
});
|
109
114
|
|