caboose-cms 0.5.135 → 0.5.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/controllers/caboose/store_controller.rb +29 -1
- data/app/views/caboose/store/_admin_footer.html.erb +2 -0
- data/app/views/caboose/store/_admin_header.html.erb +28 -0
- data/app/views/caboose/store/admin_edit_general.html.erb +54 -0
- data/app/views/caboose/store/admin_edit_packages.html.erb +44 -0
- data/app/views/caboose/store/admin_edit_payment.html.erb +36 -0
- data/app/views/caboose/store/admin_edit_shipping.html.erb +90 -0
- data/app/views/caboose/store/admin_edit_tax.html.erb +48 -0
- data/config/routes.rb +4 -2
- data/lib/caboose/version.rb +1 -1
- metadata +8 -2
- data/app/views/caboose/store/admin_edit.html.erb +0 -156
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGFkZTczZWFhYmQzMjA1N2EwMjA1MjM3ZWQ5YzQwZTQ3MDAwZTI2Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTRjZGQ0NGQ5ODY3ZWE0ZWUzZmNlMjg4YzUyMDhlNDBlNjU1MzFkNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2YzMmMzYzAyYzIwZThjYTA3ZjZlZTc4ZTAxMWIyNzQ3MDcyOTNkYzJhMGFh
|
10
|
+
MTZiZDU1YzczNzVhZGJhMGY1ZjJkZDNkMDExZTU3OGE4MTg0NmM3ZmZkZDc3
|
11
|
+
N2JhYWMyNGJlNDc4NmNjNzhmNzAxYzdjZWQyNWU0ZjZjZWIxNDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDYzZTNiMDVkNmY1MzY1MDJhZDNjMzkyOThhMDUzNjc4M2Y1NDhmZGFkNWU3
|
14
|
+
OGViNzczNjYyZjRlZWIzODVmNTI3NzQyOWZmNjdhMjA2YjQxNDAyZjQyZmRm
|
15
|
+
N2JkNDhhZjcxM2EzNzUwNzk1MzU4MGY4MGIxOWVlMTU0YmQzNWE=
|
@@ -5,7 +5,35 @@ module Caboose
|
|
5
5
|
layout 'caboose/admin'
|
6
6
|
|
7
7
|
# GET /admin/store
|
8
|
-
def
|
8
|
+
def admin_edit_general
|
9
|
+
return if !user_is_allowed('sites', 'edit')
|
10
|
+
@store_config = @site.store_config
|
11
|
+
@store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /admin/store/payment
|
15
|
+
def admin_edit_payment
|
16
|
+
return if !user_is_allowed('sites', 'edit')
|
17
|
+
@store_config = @site.store_config
|
18
|
+
@store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
# GET /admin/store/shipping
|
22
|
+
def admin_edit_shipping
|
23
|
+
return if !user_is_allowed('sites', 'edit')
|
24
|
+
@store_config = @site.store_config
|
25
|
+
@store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /admin/store/tax
|
29
|
+
def admin_edit_tax
|
30
|
+
return if !user_is_allowed('sites', 'edit')
|
31
|
+
@store_config = @site.store_config
|
32
|
+
@store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /admin/store/packages
|
36
|
+
def admin_edit_packages
|
9
37
|
return if !user_is_allowed('sites', 'edit')
|
10
38
|
@store_config = @site.store_config
|
11
39
|
@store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil?
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
<% content_for :caboose_css do %>
|
3
|
+
<style type='text/css'>
|
4
|
+
#content input[type=checkbox] { position: relative; }
|
5
|
+
</style>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% content_for :caboose_js do %>
|
9
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<h1 id='page_title'>Edit Store</h1>
|
13
|
+
<ul id='tabs'>
|
14
|
+
<%
|
15
|
+
tabs = {
|
16
|
+
'General' => "/admin/store",
|
17
|
+
'Payment Processor' => "/admin/store/payment",
|
18
|
+
'Tax' => "/admin/store/tax",
|
19
|
+
'Order Packages' => "/admin/store/packages",
|
20
|
+
'Shipping' => "/admin/store/shipping"
|
21
|
+
}
|
22
|
+
|
23
|
+
%>
|
24
|
+
<% tabs.each do |text, href| %>
|
25
|
+
<li<%= raw request.fullpath == href ? " class='selected'" : '' %>><a href='<%= href %>'><%= raw text %></a></li>
|
26
|
+
<% end %>
|
27
|
+
</ul>
|
28
|
+
<div id='content2'>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<%
|
2
|
+
sc = @store_config
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose/store/admin_header' %>
|
5
|
+
|
6
|
+
<p><div id='site_<%= @site.id %>_use_store' ></div></p>
|
7
|
+
<p><div id='storeconfig_<%= sc.id %>_fulfillment_email' ></div></p>
|
8
|
+
<p><div id='storeconfig_<%= sc.id %>_shipping_email' ></div></p>
|
9
|
+
<p><div id='storeconfig_<%= sc.id %>_handling_percentage' ></div></p>
|
10
|
+
<p><div id='storeconfig_<%= sc.id %>_download_url_expires_in' ></div></p>
|
11
|
+
<p><div id='storeconfig_<%= sc.id %>_starting_order_number' ></div></p>
|
12
|
+
|
13
|
+
<h2>Dimension Units</h2>
|
14
|
+
<p><div id='storeconfig_<%= sc.id %>_length_unit' ></div></p>
|
15
|
+
<p><div id='storeconfig_<%= sc.id %>_weight_unit' ></div></p>
|
16
|
+
|
17
|
+
<%= render :partial => 'caboose/store/admin_footer' %>
|
18
|
+
|
19
|
+
<% content_for :caboose_js do %>
|
20
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
21
|
+
<script type="text/javascript">
|
22
|
+
|
23
|
+
$(document).ready(function() {
|
24
|
+
|
25
|
+
new ModelBinder({
|
26
|
+
name: 'Site',
|
27
|
+
id: <%= @site.id %>,
|
28
|
+
update_url: '/admin/sites/<%= @site.id %>',
|
29
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
30
|
+
attributes: [
|
31
|
+
{ name: 'use_store', nice_name: 'Enable Store', type: 'checkbox', value: <%= raw Caboose.json(@site.use_store ? true : false) %>, width: 400 }
|
32
|
+
]
|
33
|
+
});
|
34
|
+
|
35
|
+
new ModelBinder({
|
36
|
+
name: 'StoreConfig',
|
37
|
+
id: <%= sc.id %>,
|
38
|
+
update_url: '/admin/store',
|
39
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
40
|
+
attributes: [
|
41
|
+
{ name: 'fulfillment_email' , nice_name: 'Fulfillment Email' , type: 'text' , value: <%= raw Caboose.json(sc.fulfillment_email ) %>, width: 400 },
|
42
|
+
{ name: 'shipping_email' , nice_name: 'Shipping Email' , type: 'text' , value: <%= raw Caboose.json(sc.shipping_email ) %>, width: 400 },
|
43
|
+
{ name: 'handling_percentage' , nice_name: 'Handling Percentage' , type: 'text' , value: <%= raw Caboose.json(sc.handling_percentage ) %>, width: 400 },
|
44
|
+
{ name: 'length_unit' , nice_name: 'Length' , type: 'select' , value: <%= raw Caboose.json(sc.length_unit ) %>, width: 400 , options_url: '/admin/store/length-unit-options' },
|
45
|
+
{ name: 'weight_unit' , nice_name: 'Weight' , type: 'select' , value: <%= raw Caboose.json(sc.weight_unit ) %>, width: 400 , options_url: '/admin/store/weight-unit-options' },
|
46
|
+
{ name: 'download_url_expires_in' , nice_name: 'Download URL Expires In (minutes)' , type: 'text' , value: <%= raw Caboose.json(sc.download_url_expires_in ) %>, width: 400 },
|
47
|
+
{ name: 'starting_order_number' , nice_name: 'Starting Order Number' , type: 'text' , value: <%= raw Caboose.json(sc.starting_order_number ) %>, width: 400 }
|
48
|
+
]
|
49
|
+
});
|
50
|
+
|
51
|
+
});
|
52
|
+
|
53
|
+
</script>
|
54
|
+
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<%
|
2
|
+
sc = @store_config
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose/store/admin_header' %>
|
5
|
+
|
6
|
+
<p>If calculating order packages automatically, all shippable variants must have dimensions and weights populated. Otherwise, a custom order packages function is required.</p>
|
7
|
+
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_packages' ></div></p>
|
8
|
+
<div id='custom_packages_container' <% if sc.auto_calculate_packages %>style='display: none;'<% end %>>
|
9
|
+
<h3>Custom Order Packages Function</h3>
|
10
|
+
<p><code>def custom_order_packages_function(order) {</code></p>
|
11
|
+
<p><div id='storeconfig_<%= sc.id %>_custom_packages_function' ></div></p>
|
12
|
+
<p><code># This function does not return anything, but creates the Caboose::OrderPackage objects for the given order<br />}</code></p>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<%= render :partial => 'caboose/store/admin_footer' %>
|
16
|
+
|
17
|
+
<% content_for :caboose_js do %>
|
18
|
+
<script type="text/javascript">
|
19
|
+
|
20
|
+
$(document).ready(function() {
|
21
|
+
|
22
|
+
new ModelBinder({
|
23
|
+
name: 'StoreConfig',
|
24
|
+
id: <%= sc.id %>,
|
25
|
+
update_url: '/admin/store',
|
26
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
27
|
+
attributes: [
|
28
|
+
{ name: 'auto_calculate_packages' , nice_name: 'Automatically Calculate Packages' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_packages ? 1 : 0 ) %>, width: 400 , after_update: function() { toggleCustomPackages(this.value); }},
|
29
|
+
{ name: 'custom_packages_function' , nice_name: 'Custom Packages Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_packages_function ) %>, width: 800, height: 200, fixed_placeholder: false }
|
30
|
+
]
|
31
|
+
});
|
32
|
+
|
33
|
+
});
|
34
|
+
|
35
|
+
function toggleCustomPackages(checked) {
|
36
|
+
var el = $('#custom_packages_container');
|
37
|
+
if (checked)
|
38
|
+
el.slideUp()
|
39
|
+
else
|
40
|
+
el.slideDown();
|
41
|
+
}
|
42
|
+
|
43
|
+
</script>
|
44
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%
|
2
|
+
sc = @store_config
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose/store/admin_header' %>
|
5
|
+
|
6
|
+
<p><div id='storeconfig_<%= sc.id %>_pp_name' ></div></p>
|
7
|
+
<p><div id='storeconfig_<%= sc.id %>_pp_username' ></div></p>
|
8
|
+
<p><div id='storeconfig_<%= sc.id %>_pp_password' ></div></p>
|
9
|
+
<p><div id='storeconfig_<%= sc.id %>_pp_relay_domain' ></div></p>
|
10
|
+
<p><div id='storeconfig_<%= sc.id %>_pp_testing' ></div></p>
|
11
|
+
|
12
|
+
<%= render :partial => 'caboose/store/admin_footer' %>
|
13
|
+
|
14
|
+
<% content_for :caboose_js do %>
|
15
|
+
<script type="text/javascript">
|
16
|
+
|
17
|
+
$(document).ready(function() {
|
18
|
+
|
19
|
+
new ModelBinder({
|
20
|
+
name: 'StoreConfig',
|
21
|
+
id: <%= sc.id %>,
|
22
|
+
update_url: '/admin/store',
|
23
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
24
|
+
attributes: [
|
25
|
+
{ name: 'pp_name' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(sc.pp_name ) %>, width: 400 , options_url: '/admin/store/payment-processor-options' },
|
26
|
+
{ name: 'pp_username' , nice_name: 'Username' , type: 'text' , value: <%= raw Caboose.json(sc.pp_username ) %>, width: 400 },
|
27
|
+
{ name: 'pp_password' , nice_name: 'Password' , type: 'text' , value: <%= raw Caboose.json(sc.pp_password ) %>, width: 400 },
|
28
|
+
{ name: 'pp_relay_domain' , nice_name: 'Relay Domain' , type: 'text' , value: <%= raw Caboose.json(sc.pp_relay_domain ) %>, width: 400 },
|
29
|
+
{ name: 'pp_testing' , nice_name: 'Test Mode' , type: 'checkbox' , value: <%= raw Caboose.json(sc.pp_testing ? 1 : 0 ) %>, width: 400 }
|
30
|
+
]
|
31
|
+
});
|
32
|
+
|
33
|
+
});
|
34
|
+
|
35
|
+
</script>
|
36
|
+
<% end %>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<%
|
2
|
+
sc = @store_config
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose/store/admin_header' %>
|
5
|
+
|
6
|
+
<p>If calculating shipping rates automatically, all shippable variants must have dimensions and weights populated. Otherwise, a custom shipping rates function is required.</p>
|
7
|
+
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_shipping' ></div></p>
|
8
|
+
<div id='custom_shipping_container' <% if sc.auto_calculate_shipping %>style='display: none;'<% end %>>
|
9
|
+
<h3>Custom Shipping Rates Function</h3>
|
10
|
+
<p><code>def custom_shipping_rates_function(order) {</code></p>
|
11
|
+
<p><div id='storeconfig_<%= sc.id %>_custom_shipping_function' ></div></p>
|
12
|
+
<p><code>
|
13
|
+
# Returns an empty array by default.<br />
|
14
|
+
# Return an array of order packages and their rates<br />
|
15
|
+
# return [{<br />
|
16
|
+
# :order_package => Caboose::OrderPackage.new,<br />
|
17
|
+
# :rates => [{ <br />
|
18
|
+
# :shipping_method => Caboose::ShippingMethod.new,<br />
|
19
|
+
# :total_price => 3.50 <br />
|
20
|
+
# }]<br />
|
21
|
+
# }]<br />
|
22
|
+
}</code></p>
|
23
|
+
</div>
|
24
|
+
<h3>Shipping Origin</h3>
|
25
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_address1' ></div></p>
|
26
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_address2' ></div></p>
|
27
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_city' ></div></p>
|
28
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_state' ></div></p>
|
29
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_zip' ></div></p>
|
30
|
+
<p><div id='storeconfig_<%= sc.id %>_origin_country' ></div></p>
|
31
|
+
<h3>Shipping Carriers</h3>
|
32
|
+
<p><div id='storeconfig_<%= sc.id %>_ups_username' ></div></p>
|
33
|
+
<p><div id='storeconfig_<%= sc.id %>_ups_password' ></div></p>
|
34
|
+
<p><div id='storeconfig_<%= sc.id %>_ups_key' ></div></p>
|
35
|
+
<p><div id='storeconfig_<%= sc.id %>_ups_origin_account' ></div></p>
|
36
|
+
<p><div id='storeconfig_<%= sc.id %>_usps_username' ></div></p>
|
37
|
+
<p><div id='storeconfig_<%= sc.id %>_usps_secret_key' ></div></p>
|
38
|
+
<p><div id='storeconfig_<%= sc.id %>_usps_publishable_key' ></div></p>
|
39
|
+
<p><div id='storeconfig_<%= sc.id %>_fedex_username' ></div></p>
|
40
|
+
<p><div id='storeconfig_<%= sc.id %>_fedex_password' ></div></p>
|
41
|
+
<p><div id='storeconfig_<%= sc.id %>_fedex_key' ></div></p>
|
42
|
+
<p><div id='storeconfig_<%= sc.id %>_fedex_account' ></div></p>
|
43
|
+
|
44
|
+
<%= render :partial => 'caboose/store/admin_footer' %>
|
45
|
+
|
46
|
+
<% content_for :caboose_js do %>
|
47
|
+
<script type="text/javascript">
|
48
|
+
|
49
|
+
$(document).ready(function() {
|
50
|
+
|
51
|
+
new ModelBinder({
|
52
|
+
name: 'StoreConfig',
|
53
|
+
id: <%= sc.id %>,
|
54
|
+
update_url: '/admin/store',
|
55
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
56
|
+
attributes: [
|
57
|
+
{ name: 'ups_username' , nice_name: 'UPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.ups_username ) %>, width: 400 },
|
58
|
+
{ name: 'ups_password' , nice_name: 'UPS Password' , type: 'text' , value: <%= raw Caboose.json(sc.ups_password ) %>, width: 400 },
|
59
|
+
{ name: 'ups_key' , nice_name: 'UPS Key' , type: 'text' , value: <%= raw Caboose.json(sc.ups_key ) %>, width: 400 },
|
60
|
+
{ name: 'ups_origin_account' , nice_name: 'UPS Origin Account' , type: 'text' , value: <%= raw Caboose.json(sc.ups_origin_account ) %>, width: 400 },
|
61
|
+
{ name: 'usps_username' , nice_name: 'USPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.usps_username ) %>, width: 400 },
|
62
|
+
{ name: 'usps_secret_key' , nice_name: 'USPS Secret Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_secret_key ) %>, width: 400 },
|
63
|
+
{ name: 'usps_publishable_key' , nice_name: 'USPS Publishable Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_publishable_key ) %>, width: 400 },
|
64
|
+
{ name: 'fedex_username' , nice_name: 'FedEx Username' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_username ) %>, width: 400 },
|
65
|
+
{ name: 'fedex_password' , nice_name: 'FedEx Password' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_password ) %>, width: 400 },
|
66
|
+
{ name: 'fedex_key' , nice_name: 'FedEx Key' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_key ) %>, width: 400 },
|
67
|
+
{ name: 'fedex_account' , nice_name: 'FedEx Account' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_account ) %>, width: 400 },
|
68
|
+
{ name: 'origin_address1' , nice_name: 'Address 1' , type: 'text' , value: <%= raw Caboose.json(sc.origin_address1 ) %>, width: 400 },
|
69
|
+
{ name: 'origin_address2' , nice_name: 'Address 2' , type: 'text' , value: <%= raw Caboose.json(sc.origin_address2 ) %>, width: 400 },
|
70
|
+
{ name: 'origin_city' , nice_name: 'City' , type: 'text' , value: <%= raw Caboose.json(sc.origin_city ) %>, width: 400 },
|
71
|
+
{ name: 'origin_state' , nice_name: 'State' , type: 'text' , value: <%= raw Caboose.json(sc.origin_state ) %>, width: 400 },
|
72
|
+
{ name: 'origin_zip' , nice_name: 'Zip' , type: 'text' , value: <%= raw Caboose.json(sc.origin_zip ) %>, width: 400 },
|
73
|
+
{ name: 'origin_country' , nice_name: 'Country' , type: 'text' , value: <%= raw Caboose.json(sc.origin_country ) %>, width: 400 },
|
74
|
+
{ name: 'auto_calculate_shipping' , nice_name: 'Calculate Shipping Automatically' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_shipping ? 1 : 0 ) %>, width: 400, after_update: function() { toggleCustomShipping(this.value); }},
|
75
|
+
{ name: 'custom_shipping_function' , nice_name: 'Custom Shipping Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_shipping_function ) %>, width: 800, height: 200, fixed_placeholder: false }
|
76
|
+
]
|
77
|
+
});
|
78
|
+
|
79
|
+
});
|
80
|
+
|
81
|
+
function toggleCustomShipping(checked) {
|
82
|
+
var el = $('#custom_shipping_container');
|
83
|
+
if (checked)
|
84
|
+
el.slideUp()
|
85
|
+
else
|
86
|
+
el.slideDown();
|
87
|
+
}
|
88
|
+
|
89
|
+
</script>
|
90
|
+
<% end %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%
|
2
|
+
sc = @store_config
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose/store/admin_header' %>
|
5
|
+
|
6
|
+
<p>If calculating tax automatically, a TaxCloud (<a href='http://taxcloud.net'>taxcloud.net</a>) account is required. Otherwise, a custom tax function is required.</p>
|
7
|
+
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_tax' ></div></p>
|
8
|
+
<p><div id='storeconfig_<%= sc.id %>_taxcloud_api_id' ></div></p>
|
9
|
+
<p><div id='storeconfig_<%= sc.id %>_taxcloud_api_key' ></div></p>
|
10
|
+
<div id='custom_tax_container' <% if sc.auto_calculate_tax %>style='display: none;'<% end %>>
|
11
|
+
<h3>Custom Tax Function</h3>
|
12
|
+
<p><code>def custom_tax_function(order) {</code></p>
|
13
|
+
<p><div id='storeconfig_<%= sc.id %>_custom_tax_function' ></div></p>
|
14
|
+
<p><code># return 0.00<br />}</code></p>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<%= render :partial => 'caboose/store/admin_footer' %>
|
18
|
+
|
19
|
+
<% content_for :caboose_js do %>
|
20
|
+
<script type="text/javascript">
|
21
|
+
|
22
|
+
$(document).ready(function() {
|
23
|
+
|
24
|
+
new ModelBinder({
|
25
|
+
name: 'StoreConfig',
|
26
|
+
id: <%= sc.id %>,
|
27
|
+
update_url: '/admin/store',
|
28
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
29
|
+
attributes: [
|
30
|
+
{ name: 'auto_calculate_tax' , nice_name: 'Automatically Calculate Tax' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_tax ? 1 : 0 ) %>, width: 400 , after_update: function() { toggleCustomTax(this.value); }},
|
31
|
+
{ name: 'taxcloud_api_id' , nice_name: 'TaxCloud API ID' , type: 'text' , value: <%= raw Caboose.json(sc.taxcloud_api_id ) %>, width: 400 },
|
32
|
+
{ name: 'taxcloud_api_key' , nice_name: 'TaxCloud API Key' , type: 'text' , value: <%= raw Caboose.json(sc.taxcloud_api_key ) %>, width: 600 },
|
33
|
+
{ name: 'custom_tax_function' , nice_name: 'Custom Tax Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_tax_function ) %>, width: 800, height: 200, fixed_placeholder: false }
|
34
|
+
]
|
35
|
+
});
|
36
|
+
|
37
|
+
});
|
38
|
+
|
39
|
+
function toggleCustomTax(checked) {
|
40
|
+
var el = $('#custom_tax_container');
|
41
|
+
if (checked)
|
42
|
+
el.slideUp()
|
43
|
+
else
|
44
|
+
el.slideDown();
|
45
|
+
}
|
46
|
+
|
47
|
+
</script>
|
48
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -68,9 +68,11 @@ Caboose::Engine.routes.draw do
|
|
68
68
|
get "admin/store/payment-processor-options" => "store#payment_processor_options"
|
69
69
|
get "admin/store/length-unit-options" => "store#length_unit_options"
|
70
70
|
get "admin/store/weight-unit-options" => "store#weight_unit_options"
|
71
|
-
get "admin/store/payment
|
71
|
+
get "admin/store/payment" => "store#admin_edit_payment"
|
72
72
|
get "admin/store/shipping" => "store#admin_edit_shipping"
|
73
|
-
get "admin/store"
|
73
|
+
get "admin/store/tax" => "store#admin_edit_tax"
|
74
|
+
get "admin/store/packages" => "store#admin_edit_packages"
|
75
|
+
get "admin/store" => "store#admin_edit_general"
|
74
76
|
put "admin/store" => "store#admin_update"
|
75
77
|
|
76
78
|
#=============================================================================
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.136
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -862,7 +862,13 @@ files:
|
|
862
862
|
- app/views/caboose/social/analytics.html.erb
|
863
863
|
- app/views/caboose/stackable_groups/admin_index.html.erb
|
864
864
|
- app/views/caboose/station/index.html.erb
|
865
|
-
- app/views/caboose/store/
|
865
|
+
- app/views/caboose/store/_admin_footer.html.erb
|
866
|
+
- app/views/caboose/store/_admin_header.html.erb
|
867
|
+
- app/views/caboose/store/admin_edit_general.html.erb
|
868
|
+
- app/views/caboose/store/admin_edit_packages.html.erb
|
869
|
+
- app/views/caboose/store/admin_edit_payment.html.erb
|
870
|
+
- app/views/caboose/store/admin_edit_shipping.html.erb
|
871
|
+
- app/views/caboose/store/admin_edit_tax.html.erb
|
866
872
|
- app/views/caboose/users/edit.html.erb
|
867
873
|
- app/views/caboose/users/edit_password.html.erb
|
868
874
|
- app/views/caboose/users/import_form.html.erb
|
@@ -1,156 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
sc = @store_config
|
3
|
-
%>
|
4
|
-
<h1>Edit Store</h1>
|
5
|
-
|
6
|
-
<p><div id='site_<%= @site.id %>_use_store' ></div></p>
|
7
|
-
|
8
|
-
<h2>Payment Processor</h2>
|
9
|
-
<p><div id='storeconfig_<%= sc.id %>_pp_name' ></div></p>
|
10
|
-
<p><div id='storeconfig_<%= sc.id %>_pp_username' ></div></p>
|
11
|
-
<p><div id='storeconfig_<%= sc.id %>_pp_password' ></div></p>
|
12
|
-
<p><div id='storeconfig_<%= sc.id %>_pp_relay_domain' ></div></p>
|
13
|
-
<p><div id='storeconfig_<%= sc.id %>_pp_testing' ></div></p>
|
14
|
-
<hr />
|
15
|
-
|
16
|
-
<h2>Fulfillment Contacts</h2>
|
17
|
-
<p><div id='storeconfig_<%= sc.id %>_fulfillment_email' ></div></p>
|
18
|
-
<p><div id='storeconfig_<%= sc.id %>_shipping_email' ></div></p>
|
19
|
-
<hr />
|
20
|
-
|
21
|
-
<h2>Dimension Units</h2>
|
22
|
-
<p><div id='storeconfig_<%= sc.id %>_length_unit' ></div></p>
|
23
|
-
<p><div id='storeconfig_<%= sc.id %>_weight_unit' ></div></p>
|
24
|
-
<hr />
|
25
|
-
|
26
|
-
<h2>Tax</h2>
|
27
|
-
<p>If calculating tax automatically, a TaxCloud (<a href='http://taxcloud.net'>taxcloud.net</a>) account is required. Otherwise, a custom tax function is required.</p>
|
28
|
-
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_tax' ></div></p>
|
29
|
-
<p><div id='storeconfig_<%= sc.id %>_taxcloud_api_id' ></div></p>
|
30
|
-
<p><div id='storeconfig_<%= sc.id %>_taxcloud_api_key' ></div></p>
|
31
|
-
<h3>Custom Tax Function</h3>
|
32
|
-
<p><code>def custom_tax_function(order) {</code></p>
|
33
|
-
<p><div id='storeconfig_<%= sc.id %>_custom_tax_function' ></div></p>
|
34
|
-
<p><code># return 0.00<br />}</code></p>
|
35
|
-
<hr />
|
36
|
-
|
37
|
-
<h2>Order Packages</h2>
|
38
|
-
<p>If calculating order packages automatically, all shippable variants must have dimensions and weights populated. Otherwise, a custom order packages function is required.</p>
|
39
|
-
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_packages' ></div></p>
|
40
|
-
<h3>Custom Order Packages Function</h3>
|
41
|
-
<p><code>def custom_order_packages_function(order) {</code></p>
|
42
|
-
<p><div id='storeconfig_<%= sc.id %>_custom_packages_function' ></div></p>
|
43
|
-
<p><code># This function does not return anything, but creates the Caboose::OrderPackage objects for the given order<br />}</code></p>
|
44
|
-
<hr />
|
45
|
-
|
46
|
-
<h2>Shipping</h2>
|
47
|
-
<p>If calculating shipping rates automatically, all shippable variants must have dimensions and weights populated. Otherwise, a custom shipping rates function is required.</p>
|
48
|
-
<p><div id='storeconfig_<%= sc.id %>_auto_calculate_shipping' ></div></p>
|
49
|
-
<h3>Custom Shipping Rates Function</h3>
|
50
|
-
<p><code>def custom_shipping_rates_function(order) {</code></p>
|
51
|
-
<p><div id='storeconfig_<%= sc.id %>_custom_shipping_function' ></div></p>
|
52
|
-
<p><code>
|
53
|
-
# Returns an empty array by default.<br />
|
54
|
-
# Return an array of order packages and their rates<br />
|
55
|
-
# return [{<br />
|
56
|
-
# :order_package => Caboose::OrderPackage.new,<br />
|
57
|
-
# :rates => [{ <br />
|
58
|
-
# :shipping_method => Caboose::ShippingMethod.new,<br />
|
59
|
-
# :total_price => 3.50 <br />
|
60
|
-
# }]<br />
|
61
|
-
# }]<br />
|
62
|
-
}</code></p>
|
63
|
-
<h3>Shipping Origin</h3>
|
64
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_address1' ></div></p>
|
65
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_address2' ></div></p>
|
66
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_city' ></div></p>
|
67
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_state' ></div></p>
|
68
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_zip' ></div></p>
|
69
|
-
<p><div id='storeconfig_<%= sc.id %>_origin_country' ></div></p>
|
70
|
-
<h3>Shipping Carriers</h3>
|
71
|
-
<p><div id='storeconfig_<%= sc.id %>_ups_username' ></div></p>
|
72
|
-
<p><div id='storeconfig_<%= sc.id %>_ups_password' ></div></p>
|
73
|
-
<p><div id='storeconfig_<%= sc.id %>_ups_key' ></div></p>
|
74
|
-
<p><div id='storeconfig_<%= sc.id %>_ups_origin_account' ></div></p>
|
75
|
-
<p><div id='storeconfig_<%= sc.id %>_usps_username' ></div></p>
|
76
|
-
<p><div id='storeconfig_<%= sc.id %>_usps_secret_key' ></div></p>
|
77
|
-
<p><div id='storeconfig_<%= sc.id %>_usps_publishable_key' ></div></p>
|
78
|
-
<p><div id='storeconfig_<%= sc.id %>_fedex_username' ></div></p>
|
79
|
-
<p><div id='storeconfig_<%= sc.id %>_fedex_password' ></div></p>
|
80
|
-
<p><div id='storeconfig_<%= sc.id %>_fedex_key' ></div></p>
|
81
|
-
<p><div id='storeconfig_<%= sc.id %>_fedex_account' ></div></p>
|
82
|
-
<hr />
|
83
|
-
|
84
|
-
<h2>Other</h2>
|
85
|
-
<p><div id='storeconfig_<%= sc.id %>_handling_percentage' ></div></p>
|
86
|
-
<p><div id='storeconfig_<%= sc.id %>_download_url_expires_in' ></div></p>
|
87
|
-
<p><div id='storeconfig_<%= sc.id %>_starting_order_number' ></div></p>
|
88
|
-
|
89
|
-
<div id='message'></div>
|
90
|
-
|
91
|
-
<% content_for :caboose_js do %>
|
92
|
-
<%= javascript_include_tag "caboose/model/all" %>
|
93
|
-
<script type="text/javascript">
|
94
|
-
|
95
|
-
$(document).ready(function() {
|
96
|
-
|
97
|
-
new ModelBinder({
|
98
|
-
name: 'Site',
|
99
|
-
id: <%= @site.id %>,
|
100
|
-
update_url: '/admin/sites/<%= @site.id %>',
|
101
|
-
authenticity_token: '<%= form_authenticity_token %>',
|
102
|
-
attributes: [
|
103
|
-
{ name: 'use_store', nice_name: 'Enable Store', type: 'checkbox', value: <%= raw Caboose.json(@site.use_store ? true : false) %>, width: 400 }
|
104
|
-
]
|
105
|
-
});
|
106
|
-
|
107
|
-
new ModelBinder({
|
108
|
-
name: 'StoreConfig',
|
109
|
-
id: <%= sc.id %>,
|
110
|
-
update_url: '/admin/store',
|
111
|
-
authenticity_token: '<%= form_authenticity_token %>',
|
112
|
-
attributes: [
|
113
|
-
{ name: 'pp_name' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(sc.pp_name ) %>, width: 400 , options_url: '/admin/store/payment-processor-options' },
|
114
|
-
{ name: 'pp_username' , nice_name: 'Username' , type: 'text' , value: <%= raw Caboose.json(sc.pp_username ) %>, width: 400 },
|
115
|
-
{ name: 'pp_password' , nice_name: 'Password' , type: 'text' , value: <%= raw Caboose.json(sc.pp_password ) %>, width: 400 },
|
116
|
-
{ name: 'pp_relay_domain' , nice_name: 'Relay Domain' , type: 'text' , value: <%= raw Caboose.json(sc.pp_relay_domain ) %>, width: 400 },
|
117
|
-
{ name: 'pp_testing' , nice_name: 'Test Mode' , type: 'checkbox' , value: <%= raw Caboose.json(sc.pp_testing ? 1 : 0 ) %>, width: 400 },
|
118
|
-
{ name: 'fulfillment_email' , nice_name: 'Fulfillment Email' , type: 'text' , value: <%= raw Caboose.json(sc.fulfillment_email ) %>, width: 400 },
|
119
|
-
{ name: 'shipping_email' , nice_name: 'Shipping Email' , type: 'text' , value: <%= raw Caboose.json(sc.shipping_email ) %>, width: 400 },
|
120
|
-
{ name: 'handling_percentage' , nice_name: 'Handling Percentage' , type: 'text' , value: <%= raw Caboose.json(sc.handling_percentage ) %>, width: 400 },
|
121
|
-
{ name: 'length_unit' , nice_name: 'Length' , type: 'select' , value: <%= raw Caboose.json(sc.length_unit ) %>, width: 400 , options_url: '/admin/store/length-unit-options' },
|
122
|
-
{ name: 'weight_unit' , nice_name: 'Weight' , type: 'select' , value: <%= raw Caboose.json(sc.weight_unit ) %>, width: 400 , options_url: '/admin/store/weight-unit-options' },
|
123
|
-
{ name: 'ups_username' , nice_name: 'UPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.ups_username ) %>, width: 400 },
|
124
|
-
{ name: 'ups_password' , nice_name: 'UPS Password' , type: 'text' , value: <%= raw Caboose.json(sc.ups_password ) %>, width: 400 },
|
125
|
-
{ name: 'ups_key' , nice_name: 'UPS Key' , type: 'text' , value: <%= raw Caboose.json(sc.ups_key ) %>, width: 400 },
|
126
|
-
{ name: 'ups_origin_account' , nice_name: 'UPS Origin Account' , type: 'text' , value: <%= raw Caboose.json(sc.ups_origin_account ) %>, width: 400 },
|
127
|
-
{ name: 'usps_username' , nice_name: 'USPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.usps_username ) %>, width: 400 },
|
128
|
-
{ name: 'usps_secret_key' , nice_name: 'USPS Secret Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_secret_key ) %>, width: 400 },
|
129
|
-
{ name: 'usps_publishable_key' , nice_name: 'USPS Publishable Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_publishable_key ) %>, width: 400 },
|
130
|
-
{ name: 'fedex_username' , nice_name: 'FedEx Username' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_username ) %>, width: 400 },
|
131
|
-
{ name: 'fedex_password' , nice_name: 'FedEx Password' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_password ) %>, width: 400 },
|
132
|
-
{ name: 'fedex_key' , nice_name: 'FedEx Key' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_key ) %>, width: 400 },
|
133
|
-
{ name: 'fedex_account' , nice_name: 'FedEx Account' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_account ) %>, width: 400 },
|
134
|
-
{ name: 'taxcloud_api_id' , nice_name: 'TaxCloud API ID' , type: 'text' , value: <%= raw Caboose.json(sc.taxcloud_api_id ) %>, width: 400 },
|
135
|
-
{ name: 'taxcloud_api_key' , nice_name: 'TaxCloud API Key' , type: 'text' , value: <%= raw Caboose.json(sc.taxcloud_api_key ) %>, width: 400 },
|
136
|
-
{ name: 'origin_address1' , nice_name: 'Address 1' , type: 'text' , value: <%= raw Caboose.json(sc.origin_address1 ) %>, width: 400 },
|
137
|
-
{ name: 'origin_address2' , nice_name: 'Address 2' , type: 'text' , value: <%= raw Caboose.json(sc.origin_address2 ) %>, width: 400 },
|
138
|
-
{ name: 'origin_city' , nice_name: 'City' , type: 'text' , value: <%= raw Caboose.json(sc.origin_city ) %>, width: 400 },
|
139
|
-
{ name: 'origin_state' , nice_name: 'State' , type: 'text' , value: <%= raw Caboose.json(sc.origin_state ) %>, width: 400 },
|
140
|
-
{ name: 'origin_zip' , nice_name: 'Zip' , type: 'text' , value: <%= raw Caboose.json(sc.origin_zip ) %>, width: 400 },
|
141
|
-
{ name: 'origin_country' , nice_name: 'Country' , type: 'text' , value: <%= raw Caboose.json(sc.origin_country ) %>, width: 400 },
|
142
|
-
{ name: 'download_url_expires_in' , nice_name: 'Download URL Expires In (minutes)' , type: 'text' , value: <%= raw Caboose.json(sc.download_url_expires_in ) %>, width: 400 },
|
143
|
-
{ name: 'starting_order_number' , nice_name: 'Starting Order Number' , type: 'text' , value: <%= raw Caboose.json(sc.starting_order_number ) %>, width: 400 },
|
144
|
-
{ name: 'auto_calculate_packages' , nice_name: 'Automatically Calculate Packages' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_packages ? 1 : 0 ) %>, width: 400 },
|
145
|
-
{ name: 'auto_calculate_shipping' , nice_name: 'Calculate Shipping Automatically' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_shipping ? 1 : 0 ) %>, width: 400 },
|
146
|
-
{ name: 'auto_calculate_tax' , nice_name: 'Automatically Calculate Tax' , type: 'checkbox' , value: <%= raw Caboose.json(sc.auto_calculate_tax ? 1 : 0 ) %>, width: 400 },
|
147
|
-
{ name: 'custom_packages_function' , nice_name: 'Custom Packages Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_packages_function ) %>, width: 800, height: 200, fixed_placeholder: false },
|
148
|
-
{ name: 'custom_shipping_function' , nice_name: 'Custom Shipping Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_shipping_function ) %>, width: 800, height: 200, fixed_placeholder: false },
|
149
|
-
{ name: 'custom_tax_function' , nice_name: 'Custom Tax Function' , type: 'textarea' , value: <%= raw Caboose.json(sc.custom_tax_function ) %>, width: 800, height: 200, fixed_placeholder: false },
|
150
|
-
]
|
151
|
-
});
|
152
|
-
|
153
|
-
});
|
154
|
-
|
155
|
-
</script>
|
156
|
-
<% end %>
|