caboose-cms 0.9.21 → 0.9.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/model/bound_checkbox.js +1 -1
- data/app/assets/javascripts/caboose/model/bound_date_time.js +1 -1
- data/app/assets/javascripts/caboose/model/bound_select.js +11 -8
- data/app/controllers/caboose/variants_controller.rb +12 -2
- data/app/models/caboose/shipping_calculator.rb +2 -1
- data/app/views/caboose/variants/admin_edit.html.erb +40 -40
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59202d3071c2856775cffaf63b2e216e4de66f75
|
4
|
+
data.tar.gz: 67d7e83ee8a41b641b3bf92e7f24b75983b0fbbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd94d54fd68ac9ed397c7526cf0df7cb920562fe38cc0601254426abe5517835b6742f527f9e2e11545395ce46bc1636247893c8a13a00cc43098e7851533c34
|
7
|
+
data.tar.gz: 8d43606f498ac336f8f108ea2f363803a46c950f44e6dd03956b8fada850aebacc53ddb0bb4c02dc7cece663e194b5d6b99078a864b5a2ecf7a6ac665d853815
|
@@ -43,7 +43,7 @@ BoundCheckbox = BoundControl.extend({
|
|
43
43
|
$('#'+this.el+'_container').append(cb);
|
44
44
|
|
45
45
|
if (this.attribute.align == 'right')
|
46
|
-
$('#'+this.el).css('left', this.attribute.width -
|
46
|
+
$('#'+this.el).css('left', this.attribute.width - 24)
|
47
47
|
else if (this.attribute.align == 'center')
|
48
48
|
$('#'+this.el).css('left', Math.floor($('#'+this.el+'_container').outerWidth()/2))
|
49
49
|
else // left
|
@@ -35,7 +35,7 @@ BoundDateTime = BoundControl.extend({
|
|
35
35
|
if (this.attribute.fixed_placeholder)
|
36
36
|
{
|
37
37
|
var w = $('#'+this.el+'_placeholder').outerWidth();
|
38
|
-
|
38
|
+
//$('#'+this.el).attr('placeholder', 'empty').css('padding-left', '+=' + w).css('width', '-=' + w);
|
39
39
|
}
|
40
40
|
|
41
41
|
var this2 = this;
|
@@ -33,17 +33,18 @@ BoundSelect = BoundControl.extend({
|
|
33
33
|
)
|
34
34
|
);
|
35
35
|
}
|
36
|
-
var this2 = this;
|
37
|
-
$('
|
36
|
+
var this2 = this;
|
37
|
+
var input = $('<input/>')
|
38
38
|
.attr('type', 'text')
|
39
39
|
.attr('id', this.el)
|
40
40
|
.addClass('mb_fake_option')
|
41
41
|
.attr('placeholder', this.attribute.empty_text)
|
42
42
|
.click(function() { this2.edit(); })
|
43
|
-
.val(this.attribute.text && this.attribute.text.length > 0 ? this.attribute.text : this.attribute.empty_text)
|
44
|
-
)
|
45
|
-
|
46
|
-
|
43
|
+
.val(this.attribute.text && this.attribute.text.length > 0 ? this.attribute.text : this.attribute.empty_text);
|
44
|
+
if (this2.attribute.align == 'right')
|
45
|
+
input.css('text-align', 'right');
|
46
|
+
$('#'+this.el+'_container').append(input);
|
47
|
+
if (this.attribute.width) $('#'+this.el).css('width', this.attribute.width);
|
47
48
|
|
48
49
|
if (this.attribute.fixed_placeholder)
|
49
50
|
{
|
@@ -76,6 +77,8 @@ BoundSelect = BoundControl.extend({
|
|
76
77
|
select2.empty();
|
77
78
|
if (this2.attribute.show_empty_option) select.append($('<option/>').val('').html(this2.attribute.empty_text ? this2.attribute.empty_text : '-- Empty --'));
|
78
79
|
if (this2.attribute.quick_add_url) select.append($('<option/>').val('quickadd').html('-- ' + this2.attribute.quick_add_text + ' --'));
|
80
|
+
//if (this2.attribute.align == 'right') select.attr('dir', 'rtl').css('text-align', 'right');
|
81
|
+
|
79
82
|
$.each(this2.attribute.options, function(i, option) {
|
80
83
|
var opt = $('<option/>').val(option.value).html(option.text);
|
81
84
|
if (option.value == new_id)
|
@@ -118,8 +121,8 @@ BoundSelect = BoundControl.extend({
|
|
118
121
|
});
|
119
122
|
}
|
120
123
|
if (this2.attribute.show_empty_option) select.append($('<option/>').val('').html(this2.attribute.empty_text ? this2.attribute.empty_text : '-- Empty --'));
|
121
|
-
if (this2.attribute.quick_add_url)
|
122
|
-
|
124
|
+
if (this2.attribute.quick_add_url) select.append($('<option/>').val('quickadd').html('-- ' + this2.attribute.quick_add_text + ' --'));
|
125
|
+
//if (this2.attribute.align == 'right') select.attr('dir', 'rtl').css('text-align', 'right');
|
123
126
|
$.each(this2.attribute.options, function(i, option) {
|
124
127
|
var opt = $('<option/>')
|
125
128
|
.val(option.value)
|
@@ -275,9 +275,19 @@ module Caboose
|
|
275
275
|
when 'option1_media_id' then variants.each { |v| v.option1_media_id = value }
|
276
276
|
when 'option2_media_id' then variants.each { |v| v.option2_media_id = value }
|
277
277
|
when 'option3_media_id' then variants.each { |v| v.option3_media_id = value }
|
278
|
-
when 'requires_shipping' then variants.each { |v| v.requires_shipping = value }
|
279
278
|
when 'taxable' then variants.each { |v| v.taxable = value }
|
280
|
-
when '
|
279
|
+
when 'requires_shipping' then
|
280
|
+
value = value == true || value == 1 || value == '1' ? true : false
|
281
|
+
variants.each { |v|
|
282
|
+
v.requires_shipping = value
|
283
|
+
v.downloadable = !value
|
284
|
+
}
|
285
|
+
when 'downloadable' then
|
286
|
+
value = value == true || value == 1 || value == '1' ? true : false
|
287
|
+
variants.each { |v|
|
288
|
+
v.downloadable = value
|
289
|
+
v.requires_shipping = !value
|
290
|
+
}
|
281
291
|
when 'download_path' then variants.each { |v| v.download_path = value }
|
282
292
|
when 'is_subscription' then variants.each { |v| v.is_subscription = value }
|
283
293
|
when 'subscription_interval' then variants.each { |v| v.subscription_interval = value }
|
@@ -61,7 +61,7 @@ module Caboose
|
|
61
61
|
carriers.each do |name, carrier|
|
62
62
|
if sp.uses_carrier(name)
|
63
63
|
resp = carrier.find_rates(origin, destination, package)
|
64
|
-
resp.rates.sort_by(&:price).each do |rate|
|
64
|
+
resp.rates.sort_by(&:price).each do |rate|
|
65
65
|
sm = ShippingMethod.where( :carrier => name, :service_code => rate.service_code, :service_name => rate.service_name).first
|
66
66
|
sm = ShippingMethod.create(:carrier => name, :service_code => rate.service_code, :service_name => rate.service_name) if sm.nil?
|
67
67
|
next if !sp.uses_shipping_method(sm)
|
@@ -94,6 +94,7 @@ module Caboose
|
|
94
94
|
#Caboose.log(op.shipping_method.inspect)
|
95
95
|
|
96
96
|
sm = op.shipping_method
|
97
|
+
Caboose.log(sm.inspect)
|
97
98
|
package = op.activemerchant_package
|
98
99
|
resp = carrier.find_rates(origin, destination, package)
|
99
100
|
resp.rates.sort_by(&:price).each do |rate|
|
@@ -100,40 +100,40 @@ $(document).ready(function() {
|
|
100
100
|
update_url: '/admin/products/<%= v.product_id %>/variants/<%= v.id %>',
|
101
101
|
authenticity_token: '<%= form_authenticity_token %>',
|
102
102
|
attributes: [
|
103
|
-
<% if p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'text' , align: 'right' , width:
|
104
|
-
<% if p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'text' , align: 'right' , width:
|
105
|
-
<% if p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'text' , align: 'right' , width:
|
106
|
-
{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , width:
|
107
|
-
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , width:
|
108
|
-
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , width:
|
109
|
-
{ name: 'cost' , nice_name: 'Cost of Goods' , type: 'text' , align: 'right' , width:
|
110
|
-
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , width:
|
111
|
-
{ name: 'sale_price' , nice_name: 'Sale price' , type: 'text' , align: 'right' , width:
|
112
|
-
{ name: 'date_sale_starts' , nice_name: 'Sale starts' , type: 'datetime' , align: 'right' , width:
|
113
|
-
{ name: 'date_sale_ends' , nice_name: 'Sale ends' , type: 'datetime' , align: 'right' , width:
|
114
|
-
{ name: 'clearance' , nice_name: 'On Clearance' , type: 'checkbox' , align: 'right' , width:
|
115
|
-
{ name: 'clearance_price' , nice_name: 'Clearance price' , type: 'text' , align: 'right' , width:
|
116
|
-
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , width:
|
117
|
-
{ name: 'ignore_quantity' , nice_name: 'Ignore Quantity' , type: 'checkbox' , align: 'right' , width:
|
118
|
-
{ name: 'weight' , nice_name: 'Weight (<%= sc.weight_unit %>)' , type: 'text' , align: 'right' , width:
|
119
|
-
{ name: 'length' , nice_name: 'Length (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width:
|
120
|
-
{ name: 'width' , nice_name: 'Width (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width:
|
121
|
-
{ name: 'height' , nice_name: 'Height (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width:
|
122
|
-
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'right' , width:
|
123
|
-
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'right' , width:
|
124
|
-
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'right' , width:
|
125
|
-
{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'right' , width:
|
126
|
-
{ name: 'status' , nice_name: 'Status' , type: 'select' , align: 'right' , width:
|
127
|
-
{ name: 'downloadable' , nice_name: 'Downloadable' , type: 'checkbox' , align: 'right' , width:
|
128
|
-
{ name: 'download_path' , nice_name: 'Download path' , type: 'text' , align: 'right' , width:
|
129
|
-
{ name: 'flat_rate_shipping' , nice_name: 'Use flat rate shipping' , type: 'checkbox' , align: 'right' , width:
|
130
|
-
{ name: 'flat_rate_shipping_single' , nice_name: 'Amount (single)' , type: 'text' , align: 'right' , width:
|
131
|
-
{ name: 'flat_rate_shipping_combined' , nice_name: 'Amount (combined)' , type: 'text' , align: 'right' , width:
|
132
|
-
{ name: 'flat_rate_shipping_package_method_id' , nice_name: 'Package method' , type: 'select' , align: 'right' , width:
|
103
|
+
<% if p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.option1 ) %> },<% end %>
|
104
|
+
<% if p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.option2 ) %> },<% end %>
|
105
|
+
<% if p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.option3 ) %> },<% end %>
|
106
|
+
{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.alternate_id ) %> },
|
107
|
+
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.sku ) %> },
|
108
|
+
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.barcode ) %> },
|
109
|
+
{ name: 'cost' , nice_name: 'Cost of Goods' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(sprintf("%.2f", v.cost) ) %> },
|
110
|
+
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(sprintf("%.2f", v.price) ) %> },
|
111
|
+
{ name: 'sale_price' , nice_name: 'Sale price' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.sale_price ) %> },
|
112
|
+
{ name: 'date_sale_starts' , nice_name: 'Sale starts' , type: 'datetime' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.date_sale_starts ? v.date_sale_starts.in_time_zone(@logged_in_user.timezone).strftime('%m/%d/%Y %I:%M %P') : '') %> },
|
113
|
+
{ name: 'date_sale_ends' , nice_name: 'Sale ends' , type: 'datetime' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.date_sale_ends ? v.date_sale_ends.in_time_zone(@logged_in_user.timezone).strftime('%m/%d/%Y %I:%M %P') : '') %> },
|
114
|
+
{ name: 'clearance' , nice_name: 'On Clearance' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.clearance ) %> },
|
115
|
+
{ name: 'clearance_price' , nice_name: 'Clearance price' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.clearance_price ) %> },
|
116
|
+
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.quantity_in_stock ) %> },
|
117
|
+
{ name: 'ignore_quantity' , nice_name: 'Ignore Quantity' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.ignore_quantity ) %> },
|
118
|
+
{ name: 'weight' , nice_name: 'Weight (<%= sc.weight_unit %>)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.weight ) %> },
|
119
|
+
{ name: 'length' , nice_name: 'Length (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.length ) %> },
|
120
|
+
{ name: 'width' , nice_name: 'Width (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.width ) %> },
|
121
|
+
{ name: 'height' , nice_name: 'Height (<%= sc.length_unit %>)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.height ) %> },
|
122
|
+
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.cylinder ) %> },
|
123
|
+
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.requires_shipping ) %> },
|
124
|
+
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.taxable ) %> },
|
125
|
+
{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.allow_backorder ) %> },
|
126
|
+
{ name: 'status' , nice_name: 'Status' , type: 'select' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.status ) %>, options_url: '/admin/variants/status-options' },
|
127
|
+
{ name: 'downloadable' , nice_name: 'Downloadable' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.downloadable ) %> },
|
128
|
+
{ name: 'download_path' , nice_name: 'Download path' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.download_path ) %> },
|
129
|
+
{ name: 'flat_rate_shipping' , nice_name: 'Use flat rate shipping' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.flat_rate_shipping ) %> },
|
130
|
+
{ name: 'flat_rate_shipping_single' , nice_name: 'Amount (single)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.flat_rate_shipping_single ) %> },
|
131
|
+
{ name: 'flat_rate_shipping_combined' , nice_name: 'Amount (combined)' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.flat_rate_shipping_combined ) %> },
|
132
|
+
{ name: 'flat_rate_shipping_package_method_id' , nice_name: 'Package method' , type: 'select' , align: 'right' , width: 500, options_url: '/admin/shipping-packages/package-method-options',
|
133
133
|
value: <%= raw Caboose.json("#{v.flat_rate_shipping_package_id}_#{v.flat_rate_shipping_method_id}") %>,
|
134
134
|
text: <%= raw Caboose.json(v.flat_rate_shipping_package && v.flat_rate_shipping_method ? "#{v.flat_rate_shipping_package.name} - #{v.flat_rate_shipping_method.service_name}" : '') %>
|
135
135
|
},
|
136
|
-
{ name: 'is_bundle' , nice_name: 'Is Bundle' , type: 'checkbox' , align: 'right' , width:
|
136
|
+
{ name: 'is_bundle' , nice_name: 'Is Bundle' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.is_bundle ? 1 : 0 ) %> ,
|
137
137
|
after_update: function() {
|
138
138
|
if ($('#variant_<%= v.id %>_is_bundle').is(':checked'))
|
139
139
|
vcc.print();
|
@@ -141,15 +141,15 @@ $(document).ready(function() {
|
|
141
141
|
vcc.hide();
|
142
142
|
}
|
143
143
|
},
|
144
|
-
{ name: 'is_subscription' , nice_name: 'Is Subscription' , type: 'checkbox' , align: 'right' , width:
|
145
|
-
{ name: 'subscription_interval' , nice_name: 'Interval' , type: 'select' , align: 'right' , width:
|
146
|
-
{ name: 'subscription_prorate' , nice_name: 'Prorate' , type: 'checkbox' , align: 'right' , width:
|
147
|
-
{ name: 'subscription_prorate_method' , nice_name: 'Prorate method' , type: 'select' , align: 'right' , width:
|
148
|
-
{ name: 'subscription_prorate_flat_amount' , nice_name: 'Prorate flat amount' , type: 'text' , align: 'right' , width:
|
149
|
-
{ name: 'subscription_prorate_function' , nice_name: 'Custom Prorate Function' , type: 'textarea' , align: 'right' , width:
|
150
|
-
{ name: 'subscription_start_on_day' , nice_name: 'Start on day' , type: 'checkbox' , align: 'right' , width:
|
151
|
-
{ name: 'subscription_start_day' , nice_name: 'Start day' , type: 'select' , align: 'right' , width:
|
152
|
-
{ name: 'subscription_start_month' , nice_name: 'Start month' , type: 'select' , align: 'right' , width:
|
144
|
+
{ name: 'is_subscription' , nice_name: 'Is Subscription' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.is_subscription ? 1 : 0 ) %> },
|
145
|
+
{ name: 'subscription_interval' , nice_name: 'Interval' , type: 'select' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_interval ) %> , options_url: '/admin/variants/subscription-interval-options' },
|
146
|
+
{ name: 'subscription_prorate' , nice_name: 'Prorate' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_prorate ) %> },
|
147
|
+
{ name: 'subscription_prorate_method' , nice_name: 'Prorate method' , type: 'select' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_prorate_method ) %> , options_url: '/admin/variants/subscription-prorate-method-options' },
|
148
|
+
{ name: 'subscription_prorate_flat_amount' , nice_name: 'Prorate flat amount' , type: 'text' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_prorate_flat_amount ) %> },
|
149
|
+
{ name: 'subscription_prorate_function' , nice_name: 'Custom Prorate Function' , type: 'textarea' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_prorate_function ) %> , height: 100 },
|
150
|
+
{ name: 'subscription_start_on_day' , nice_name: 'Start on day' , type: 'checkbox' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_start_on_day ) %> },
|
151
|
+
{ name: 'subscription_start_day' , nice_name: 'Start day' , type: 'select' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_start_day ) %> , options_url: '/admin/variants/subscription-start-day-options' },
|
152
|
+
{ name: 'subscription_start_month' , nice_name: 'Start month' , type: 'select' , align: 'right' , width: 500, value: <%= raw Caboose.json(v.subscription_start_month ) %> , options_url: '/admin/variants/subscription-start-month-options' }
|
153
153
|
]
|
154
154
|
});
|
155
155
|
vcc = new VariantChildrenController({
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|