caboose-cms 0.5.63 → 0.5.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/controllers/caboose/application_controller.rb +1 -1
- data/app/controllers/caboose/login_controller.rb +1 -1
- data/app/controllers/caboose/shipping_packages_controller.rb +182 -0
- data/app/models/caboose/authenticator.rb +27 -5
- data/app/models/caboose/schema.rb +21 -23
- data/app/models/caboose/shipping_method.rb +11 -0
- data/app/models/caboose/shipping_method_loader.rb +123 -0
- data/app/models/caboose/shipping_package.rb +12 -1
- data/app/models/caboose/shipping_package_method.rb +12 -0
- data/app/views/caboose/shipping_packages/admin_edit.html.erb +164 -0
- data/app/views/caboose/shipping_packages/admin_index.html.erb +42 -0
- data/app/views/caboose/shipping_packages/admin_new.html.erb +33 -0
- data/config/routes.rb +14 -0
- data/lib/caboose/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmQwMGY4YWE5MTAzMjFjZGMzMzk5ZDM4ODFmNWJkYTA2ZDdlMTQ3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODM4ZGYyNmEyZjU1OGEwMjJjMjZmYTRhZTcwMThiNGEwM2Q0Nzk5Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDc2NGUwMmZjZDcxNWU4NjZlYzMzOTY0NjZhYjRiZjgxMDljOWI2NzgwN2Rj
|
10
|
+
N2I5ZGI2ZWZhMDdiZWQ4NzIwYjFmYzZmZjlkMDAyNzM5ZTBmYjA2NDNiMDQ0
|
11
|
+
ZGM5Y2M1M2JjZGZkZmRmNzlhMzg1NjY3ZjI2NzU1NjUxYWZiNTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGYzNTg5NjAxNjNjZWRkM2RlMGY3ODFhNzhhMDhhOWEzZDZjOGU1MTZhOGQ2
|
14
|
+
NjcxYWQyNDcwMTM1NmRhODhjYTQzMDU0MDY5MDMxZGU2ZjNiZjdmMDI4ZjFj
|
15
|
+
ZjBiZDgxMzU3ZTYxMjk5NTJiMDQ4ZWRkM2YwN2I0MmZkZGYwZjE=
|
@@ -65,7 +65,7 @@ module Caboose
|
|
65
65
|
|
66
66
|
if create_new_order # Create an order to associate with the session
|
67
67
|
@order = Caboose::Order.create(
|
68
|
-
:site_id => @site.id,
|
68
|
+
:site_id => @site ? @site.id : nil,
|
69
69
|
:status => Caboose::Order::STATUS_CART,
|
70
70
|
:financial_status => Caboose::Order::STATUS_PENDING,
|
71
71
|
:date_created => DateTime.now,
|
@@ -31,7 +31,7 @@ module Caboose
|
|
31
31
|
else
|
32
32
|
bouncer_class = Caboose::authenticator_class.constantize
|
33
33
|
bouncer = bouncer_class.new
|
34
|
-
login_resp = bouncer.authenticate(username, password)
|
34
|
+
login_resp = bouncer.authenticate(username, password, @site)
|
35
35
|
|
36
36
|
if login_resp.error
|
37
37
|
resp.error = login_resp.error
|
@@ -0,0 +1,182 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Caboose
|
4
|
+
class ShippingPackagesController < ApplicationController
|
5
|
+
layout 'caboose/admin'
|
6
|
+
|
7
|
+
def before_action
|
8
|
+
@page = Page.page_with_uri(request.host_with_port, '/admin')
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /admin/sites/:site_id/shipping-packages
|
12
|
+
def admin_index
|
13
|
+
return if !user_is_allowed('sites', 'view')
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /admin/sites/:site_id/shipping-packages/json
|
17
|
+
def admin_json
|
18
|
+
return if !user_is_allowed('sites', 'view')
|
19
|
+
|
20
|
+
pager = PageBarGenerator.new(params, {
|
21
|
+
'site_id' => @site.id,
|
22
|
+
},{
|
23
|
+
'model' => 'Caboose::ShippingPackage',
|
24
|
+
'sort' => 'shipping_method_id',
|
25
|
+
'desc' => false,
|
26
|
+
'base_url' => "/admin/sites/#{@site.id}/shipping-packages",
|
27
|
+
'use_url_params' => false
|
28
|
+
})
|
29
|
+
render :json => {
|
30
|
+
:pages => pager,
|
31
|
+
:models => pager.items
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /admin/sites/:site_id/shipping-packages/new
|
36
|
+
def admin_new
|
37
|
+
return if !user_is_allowed('sites', 'add')
|
38
|
+
@shipping_package = ShippingPackage.new
|
39
|
+
end
|
40
|
+
|
41
|
+
# GET /admin/sites/:site_id/shipping-packages/:id
|
42
|
+
def admin_edit
|
43
|
+
return if !user_is_allowed('sites', 'edit')
|
44
|
+
@shipping_package = ShippingPackage.find(params[:id])
|
45
|
+
end
|
46
|
+
|
47
|
+
# GET /admin/sites/:site_id/shipping-packages/:id/json
|
48
|
+
def admin_json_single
|
49
|
+
return if !user_is_allowed('sites', 'edit')
|
50
|
+
sp = ShippingPackage.find(params[:id])
|
51
|
+
render :json => sp
|
52
|
+
end
|
53
|
+
|
54
|
+
# GET /admin/sites/:site_id/shipping-packages/:id/delete
|
55
|
+
def admin_delete_form
|
56
|
+
return if !user_is_allowed('sites', 'edit')
|
57
|
+
@shipping_package = ShippingPackage.find(params[:id])
|
58
|
+
end
|
59
|
+
|
60
|
+
# POST /admin/sites/:site_id/shipping-packages
|
61
|
+
def admin_add
|
62
|
+
return if !user_is_allowed('sites', 'add')
|
63
|
+
|
64
|
+
resp = StdClass.new
|
65
|
+
|
66
|
+
if params[:shipping_method_id].strip.length == 0 then resp.error = "Please select a shipping method."
|
67
|
+
elsif params[:length].strip.length == 0 then resp.error = "Please enter a valid length."
|
68
|
+
elsif params[:width ].strip.length == 0 then resp.error = "Please enter a valid width."
|
69
|
+
elsif params[:height].strip.length == 0 then resp.error = "Please enter a valid height."
|
70
|
+
else
|
71
|
+
|
72
|
+
sp = ShippingPackage.new(
|
73
|
+
:site_id => @site.id,
|
74
|
+
:shipping_method_id => params[:shipping_method_id],
|
75
|
+
:length => params[:length].to_f,
|
76
|
+
:width => params[:width ].to_f,
|
77
|
+
:height => params[:height].to_f
|
78
|
+
)
|
79
|
+
sp.volume = sp.length * sp.width * sp.height
|
80
|
+
sp.save
|
81
|
+
resp.redirect = "/admin/sites/#{@site.id}/shipping-packages/#{sp.id}"
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
render :json => resp
|
86
|
+
end
|
87
|
+
|
88
|
+
# POST /admin/products/:product_id/variants/bulk
|
89
|
+
def admin_bulk_add
|
90
|
+
return if !user_is_allowed('sites', 'add')
|
91
|
+
|
92
|
+
resp = Caboose::StdClass.new
|
93
|
+
|
94
|
+
i = 0
|
95
|
+
CSV.parse(params[:csv_data].strip).each do |row|
|
96
|
+
if row[0].nil? || row[0].strip.length == 0 then resp.error = "Shipping method not defined on row #{i+1}."
|
97
|
+
elsif row[3].nil? || row[1].strip.length == 0 then resp.error = "Length not defined on row #{i+1}."
|
98
|
+
elsif row[4].nil? || row[2].strip.length == 0 then resp.error = "Width not defined on row #{i+1}."
|
99
|
+
elsif row[5].nil? || row[3].strip.length == 0 then resp.error = "Height not defined on row #{i+1}."
|
100
|
+
end
|
101
|
+
i = i + 1
|
102
|
+
end
|
103
|
+
|
104
|
+
if resp.error.nil?
|
105
|
+
CSV.parse(params[:csv_data]).each do |row|
|
106
|
+
sp = Caboose::Variant.new(
|
107
|
+
:site_id => @site.id,
|
108
|
+
:shipping_method_id => row[0],
|
109
|
+
:length => row[1].to_f,
|
110
|
+
:width => row[2].to_f,
|
111
|
+
:height => row[3].to_f
|
112
|
+
)
|
113
|
+
sp.save
|
114
|
+
end
|
115
|
+
resp.success = true
|
116
|
+
end
|
117
|
+
|
118
|
+
render :json => resp
|
119
|
+
end
|
120
|
+
|
121
|
+
# PUT /admin/sites/:site_id/shipping-packages/:id
|
122
|
+
def admin_update
|
123
|
+
return if !user_is_allowed('sites', 'edit')
|
124
|
+
|
125
|
+
resp = StdClass.new
|
126
|
+
sp = ShippingPackage.find(params[:id])
|
127
|
+
|
128
|
+
save = true
|
129
|
+
params.each do |name,value|
|
130
|
+
case name
|
131
|
+
when 'site_id' then sp.site_id = value
|
132
|
+
when 'shipping_method_id' then sp.shipping_method_id = value
|
133
|
+
when 'length' then sp.length = value.to_f
|
134
|
+
when 'width' then sp.width = value.to_f
|
135
|
+
when 'height' then sp.height = value.to_f
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
resp.success = save && sp.save
|
140
|
+
render :json => resp
|
141
|
+
end
|
142
|
+
|
143
|
+
# DELETE /admin/sites/:site_id/shipping-packages/:id
|
144
|
+
def admin_delete
|
145
|
+
return if !user_is_allowed('sites', 'delete')
|
146
|
+
sp = ShippingPackage.find(params[:id])
|
147
|
+
sp.destroy
|
148
|
+
|
149
|
+
resp = StdClass.new({
|
150
|
+
'redirect' => "/admin/sites/#{@site.id}/shipping-packages"
|
151
|
+
})
|
152
|
+
render :json => resp
|
153
|
+
end
|
154
|
+
|
155
|
+
# DELETE /admin/sites/:site_id/shipping-packages/:id/bulk
|
156
|
+
def admin_bulk_delete
|
157
|
+
return if !user_is_allowed('sites', 'delete')
|
158
|
+
|
159
|
+
resp = Caboose::StdClass.new
|
160
|
+
params[:model_ids].each do |sp_id|
|
161
|
+
sp = ShippingPackage.find(sp_id)
|
162
|
+
sp.destroy
|
163
|
+
end
|
164
|
+
resp.success = true
|
165
|
+
render :json => resp
|
166
|
+
end
|
167
|
+
|
168
|
+
# GET /admin/sites/:site_id/shipping-packages/options
|
169
|
+
def options
|
170
|
+
return if !user_is_allowed('sites', 'view')
|
171
|
+
options = ShippingPackage.where(:site_id => @site.id).reorder('service_name').all.collect { |sp| { 'value' => sp.id, 'text' => sp.service_name }}
|
172
|
+
render :json => options
|
173
|
+
end
|
174
|
+
|
175
|
+
# GET /admin/sites/:site_id/shipping-packages/shipping-method-options
|
176
|
+
def admin_shipping_method_options
|
177
|
+
options = ShippingMethod.reorder(:carrier, :service_name).all.collect { |sm| { :value => sm.id, :text => sm.service_name }}
|
178
|
+
render :json => options
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
end
|
@@ -1,17 +1,39 @@
|
|
1
1
|
|
2
2
|
class Caboose::Authenticator
|
3
3
|
|
4
|
-
def authenticate(username, password)
|
4
|
+
def authenticate(username, password, site = nil)
|
5
5
|
resp = Caboose::StdClass.new(
|
6
6
|
'error' => nil,
|
7
7
|
'user' => nil
|
8
8
|
)
|
9
9
|
pass = Digest::SHA1.hexdigest(Caboose::salt + password)
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
|
11
|
+
user = Caboose::User.where(:username => username).first
|
12
|
+
user = Caboose::User.where(:email => username).first if user.nil?
|
13
|
+
|
14
|
+
valid_credentials = false
|
15
|
+
if user && user.password == pass
|
16
|
+
valid_credentials = true
|
17
|
+
elsif site
|
18
|
+
mp = Caboose::Setting.where(:site_id => site.id, :name => 'master_password').first
|
19
|
+
mp = mp ? mp.value : nil
|
20
|
+
if mp && mp.strip.length > 0 && mp == pass
|
21
|
+
valid_credentials = true
|
22
|
+
end
|
13
23
|
end
|
14
|
-
|
24
|
+
|
25
|
+
if valid_credentials
|
26
|
+
resp.user = user
|
27
|
+
else
|
28
|
+
resp.error = "Invalid credentials"
|
29
|
+
end
|
30
|
+
|
31
|
+
#resp.user = Caboose::User.where(:username => username, :password => pass).first
|
32
|
+
#if (resp.user.nil?)
|
33
|
+
# resp.user = Caboose::User.where(:email => username, :password => pass).first
|
34
|
+
#end
|
35
|
+
#resp.error = "Invalid credentials" if resp.user.nil?
|
36
|
+
|
15
37
|
return resp
|
16
38
|
end
|
17
39
|
|
@@ -56,6 +56,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
56
56
|
],
|
57
57
|
Caboose::Order => [:shipping_method, :shipping_method_code],
|
58
58
|
#Caboose::PageCache => [:block],
|
59
|
+
Caboose::ShippingPackage => [:price, :carrier, :service_code, :service_name, :shipping_method_id],
|
59
60
|
Caboose::Site => [:shipping_cost_function],
|
60
61
|
Caboose::Variant => [:quantity],
|
61
62
|
Caboose::Vendor => [:vendor, :vendor_id]
|
@@ -476,16 +477,24 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
476
477
|
[ :name , :string ],
|
477
478
|
[ :value , :text ]
|
478
479
|
],
|
480
|
+
Caboose::ShippingMethod => [
|
481
|
+
[ :carrier , :string ],
|
482
|
+
[ :service_code , :string ],
|
483
|
+
[ :service_name , :string ]
|
484
|
+
],
|
479
485
|
Caboose::ShippingPackage => [
|
480
|
-
[ :site_id
|
481
|
-
[ :
|
482
|
-
[ :
|
483
|
-
[ :
|
484
|
-
[ :
|
485
|
-
[ :
|
486
|
-
[ :
|
487
|
-
[ :
|
488
|
-
|
486
|
+
[ :site_id , :integer ],
|
487
|
+
[ :name , :string ],
|
488
|
+
[ :length , :decimal ],
|
489
|
+
[ :width , :decimal ],
|
490
|
+
[ :height , :decimal ],
|
491
|
+
[ :volume , :decimal ],
|
492
|
+
[ :priority , :integer , { :default => 1 }],
|
493
|
+
[ :flat_rate_price , :decimal ]
|
494
|
+
],
|
495
|
+
Caboose::ShippingPackageMethod => [
|
496
|
+
[ :shipping_package_id , :integer ],
|
497
|
+
[ :shipping_method_id , :integer ]
|
489
498
|
],
|
490
499
|
Caboose::Site => [
|
491
500
|
[ :name , :string ],
|
@@ -761,20 +770,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
761
770
|
:slug => 'products'
|
762
771
|
})
|
763
772
|
end
|
764
|
-
|
765
|
-
if
|
766
|
-
Caboose::
|
767
|
-
end
|
768
|
-
if !Caboose::ShippingPackage.where(:carrier => 'USPS', :service_code => "28").exists?
|
769
|
-
Caboose::ShippingPackage.create(:carrier => 'USPS', :service_code => "28", :service_name => "USPS Priority Mail 1-Day Small Flat Rate Box" , :price=>595 , :length => 8.625 , :width => 5.375 , :height => 1.625 , :volume => 75.334)
|
770
|
-
end
|
771
|
-
if !Caboose::ShippingPackage.where(:carrier => 'USPS', :service_code => "17").exists?
|
772
|
-
Caboose::ShippingPackage.create(:carrier => 'USPS', :service_code => "17", :service_name => "USPS Priority Mail 1-Day Medium Flat Rate Box" , :price=>1265 , :length => 11 , :width => 8.5 , :height => 5.5 , :volume => 514.25)
|
773
|
-
Caboose::ShippingPackage.create(:carrier => 'USPS', :service_code => "17", :service_name => "USPS Priority Mail 1-Day Medium Flat Rate Box" , :price=>1265 , :length => 13.625 , :width => 11.875 , :height => 3.375 , :volume => 546.06)
|
774
|
-
end
|
775
|
-
if !Caboose::ShippingPackage.where(:carrier => 'USPS', :service_code => "22").exists?
|
776
|
-
Caboose::ShippingPackage.create(:carrier => 'USPS', :service_code => "22", :service_name => "USPS Priority Mail 1-Day Large Flat Rate Box" , :price=>1790 , :length => 12 , :width => 12 , :height => 5.5 , :volume => 792 )
|
777
|
-
Caboose::ShippingPackage.create(:carrier => 'USPS', :service_code => "22", :service_name => "USPS Priority Mail 1-Day Large Flat Rate Box" , :price=>1790 , :length => 23.6875 , :width => 11.75 , :height => 3 , :volume => 834.98)
|
773
|
+
|
774
|
+
if Caboose::ShippingMethod.all.count == 0
|
775
|
+
Caboose::ShippingMethodLoader.load_shipping_methods
|
778
776
|
end
|
779
777
|
|
780
778
|
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
|
2
|
+
module Caboose
|
3
|
+
class ShippingMethodLoader
|
4
|
+
|
5
|
+
def self.load_shipping_methods
|
6
|
+
|
7
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '1DM' , :service_name => 'UPS Next Day Air Early AM' )
|
8
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '1DA' , :service_name => 'UPS Next Day Air' )
|
9
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '1DP' , :service_name => 'UPS Next Day Air Saver' )
|
10
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '2DM' , :service_name => 'UPS 2nd Day Air AM' )
|
11
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '2DA' , :service_name => 'UPS 2nd Day Air' )
|
12
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => '3DS' , :service_name => 'UPS 3 Day Select GND Ground' )
|
13
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => 'EP' , :service_name => 'UPS Worldwide Express Plus' )
|
14
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => 'ES' , :service_name => 'UPS Worldwide Express' )
|
15
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => 'SV' , :service_name => 'UPS Worldwide Saver (Express)' )
|
16
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => 'EX' , :service_name => 'UPS Worldwide Expedited' )
|
17
|
+
ShippingMethod.create(:carrier => 'UPS' , :service_code => 'ST' , :service_name => 'UPS Standard' )
|
18
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEXGROUND' , :service_name => 'FedEx Ground® (Business addresses only)' )
|
19
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'GROUNDHOMEDELIVERY' , :service_name => 'FedEx Home Delivery® (Residential addresses only)' )
|
20
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEXEXPRESSSAVER' , :service_name => 'FedEx Express Saver®' )
|
21
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEX2DAY' , :service_name => 'FedEx 2Day®' )
|
22
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'STANDARDOVERNIGHT' , :service_name => 'FedEx Standard Overnight®' )
|
23
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'PRIORITYOVERNIGHT' , :service_name => 'FedEx Priority Overnight®' )
|
24
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FIRSTOVERNIGHT' , :service_name => 'FedEx First Overnight®' )
|
25
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEXGROUND' , :service_name => 'FedEx International Ground®' )
|
26
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'INTERNATIONALECONOMY' , :service_name => 'FedEx International Economy®' )
|
27
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'INTERNATIONALPRIORITY' , :service_name => 'FedEx International Priority®' )
|
28
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'INTERNATIONALFIRST' , :service_name => 'FedEx International First®' )
|
29
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEX1DAYFREIGHT' , :service_name => 'FedEx 1Day® Freight' )
|
30
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEX2DAYFREIGHT' , :service_name => 'FedEx 2Day® Freight' )
|
31
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'FEDEX3DAYFREIGHT' , :service_name => 'FedEx 3Day® Freight' )
|
32
|
+
ShippingMethod.create(:carrier => 'FedEx' , :service_code => 'INTERNATIONALPRIORITYFREIGHT' , :service_name => 'FedEx International Priority® Freight' )
|
33
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Library Mail Parcel' , :service_name => 'USPS Library' )
|
34
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Media Mail Parcel' , :service_name => 'USPS Media Mail' )
|
35
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Bound Printed Matter' , :service_name => 'USPS BPM (Bound Printed Matter)' )
|
36
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Standard Post<sup>®</sup>' , :service_name => 'USPS Standard' )
|
37
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail<sup>®</sup>' , :service_name => 'USPS Priority Mail' )
|
38
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 1-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail 1-Day' )
|
39
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 2-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail 2-Day' )
|
40
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 3-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail 3-Day' )
|
41
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail DPO<sup>™</sup>' , :service_name => 'USPS Priority Mail DPO' )
|
42
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Military<sup>™</sup>' , :service_name => 'USPS Priority Mail Military' )
|
43
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Flat Rate Envelope' )
|
44
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 1-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail 1-Day Flat Rate Envelope' )
|
45
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 2-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail 2-Day Flat Rate Envelope' )
|
46
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 3-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail 3-Day Flat Rate Envelope' )
|
47
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail DPO<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail DPO Flat Rate Envelope' )
|
48
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Military<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Military Flat Rate Envelope' )
|
49
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail Small Flat Rate Box' )
|
50
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 1-Day<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail 1-Day Small Flat Rate Box' )
|
51
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 2-Day<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail 2-Day Small Flat Rate Box' )
|
52
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 3-Day<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail 3-Day Small Flat Rate Box' )
|
53
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail DPO<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail DPO Small Flat Rate Box' )
|
54
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Military<sup>™</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail Military Small Flat Rate Box' )
|
55
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail Medium Flat Rate Box' )
|
56
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 1-Day<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail 1-Day Medium Flat Rate Box' )
|
57
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 2-Day<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail 2-Day Medium Flat Rate Box' )
|
58
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 3-Day<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail 3-Day Medium Flat Rate Box' )
|
59
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail DPO<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail DPO Medium Flat Rate Box' )
|
60
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Military<sup>™</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail Military Medium Flat Rate Box' )
|
61
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail<sup>™</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail Large Flat Rate Box' )
|
62
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 1-Day<sup>™</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail 1-Day Large Flat Rate Box' )
|
63
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 2-Day<sup>™</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail 2-Day Large Flat Rate Box' )
|
64
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail 3-Day<sup>™</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail 3-Day Large Flat Rate Box' )
|
65
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail DPO<sup>™</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail DPO Large Flat Rate Box' )
|
66
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Military<sup>™</sup> Large Flat Rate Box APO/FPO/DPO' , :service_name => 'USPS Priority Mail Military Large Flat Rate Box' )
|
67
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail International<sup>®</sup>' , :service_name => 'USPS Priority Mail International' )
|
68
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail International<sup>®</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail International Flat Rate Envelope' )
|
69
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail International<sup>®</sup> Small Flat Rate Box' , :service_name => 'USPS Priority Mail International Small Flat Rate Box' )
|
70
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail International<sup>®</sup> Medium Flat Rate Box' , :service_name => 'USPS Priority Mail International Medium Flat Rate Box' )
|
71
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail International<sup>®</sup> Large Flat Rate Box' , :service_name => 'USPS Priority Mail International Large Flat Rate Box' )
|
72
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Mail<sup>®</sup> Parcel' , :service_name => 'USPS First-Class Mail Package' )
|
73
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Mail<sup>®</sup> Large Envelope' , :service_name => 'USPS First-Class Mail Large Envelope' )
|
74
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Mail<sup>®</sup> Letter' , :service_name => 'USPS First-Class Mail Letter' )
|
75
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Mail<sup>®</sup> International Letter' , :service_name => 'USPS First-Class Mail International Letter' )
|
76
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Mail<sup>®</sup> International Large Envelope' , :service_name => 'USPS First-Class Mail International Large Envelope' )
|
77
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'First-Class Package International Service<sup>™</sup>' , :service_name => 'USPS First-Class Package International Service' )
|
78
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup>' , :service_name => 'USPS Priority Mail Express' )
|
79
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail Express 1-Day' )
|
80
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail Express 2-Day' )
|
81
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup>' , :service_name => 'USPS Priority Mail Express 3-Day' )
|
82
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup>' , :service_name => 'USPS Priority Mail Express DPO' )
|
83
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup>' , :service_name => 'USPS Priority Mail Express Military' )
|
84
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express Flat Rate Envelope' )
|
85
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 1-Day Flat Rate Envelope' )
|
86
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 2-Day Flat Rate Envelope' )
|
87
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 3-Day Flat Rate Envelope' )
|
88
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express DPO Flat Rate Envelope' )
|
89
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express Military Flat Rate Envelope' )
|
90
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express Hold for Pickup' )
|
91
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express 1-Day Hold for Pickup' )
|
92
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express 2-Day Hold for Pickup' )
|
93
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express 3-Day Hold for Pickup' )
|
94
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express DPO Hold for Pickup' )
|
95
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup> Hold For Pickup' , :service_name => 'USPS Priority Mail Express Military Hold for Pickup' )
|
96
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express Flat Rate Envelope Hold for Pickup' )
|
97
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express 1-Day Flat Rate Envelope Hold for Pickup' )
|
98
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express 2-Day Flat Rate Envelope Hold for Pickup' )
|
99
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express 3-Day Flat Rate Envelope Hold for Pickup' )
|
100
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express DPO Flat Rate Envelope Hold for Pickup' )
|
101
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup> Flat Rate Envelope Hold For Pickup' , :service_name => 'USPS Priority Mail Express Military Flat Rate Envelope Hold for Pickup' )
|
102
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express Sunday/Holiday Guarantee' )
|
103
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express 1-Day Sunday/Holiday Guarantee' )
|
104
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express 2-Day Sunday/Holiday Guarantee' )
|
105
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express 3-Day Sunday/Holiday Guarantee' )
|
106
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express DPO Sunday/Holiday Guarantee' )
|
107
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup> Sunday/Holiday Delivery' , :service_name => 'USPS Priority Mail Express Military Sunday/Holiday Guarantee' )
|
108
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
109
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 1-Day<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 1-Day Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
110
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 2-Day<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 2-Day Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
111
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express 3-Day<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express 3-Day Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
112
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express DPO<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express DPO Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
113
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express Military<sup>™</sup> Sunday/Holiday Delivery Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express Military Flat-Rate Envelope Sunday/Holiday Guarantee' )
|
114
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express International<sup>™</sup>' , :service_name => 'USPS Priority Mail Express International' )
|
115
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Priority Mail Express International<sup>™</sup> Flat Rate Envelope' , :service_name => 'USPS Priority Mail Express International Flat Rate Envelope' )
|
116
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Global Express Guaranteed<sup>®</sup> (GXG)' , :service_name => 'USPS Global Express Guaranteed (GXG)' )
|
117
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Global Express Guaranteed<sup>®</sup> Non-Document Rectangular' , :service_name => 'USPS Global Express Guaranteed Non-Document Rectangular' )
|
118
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'Global Express Guaranteed<sup>®</sup> Non-Document Non-Rectangular' , :service_name => 'USPS Global Express Guaranteed Non-Document Non-Rectangular' )
|
119
|
+
ShippingMethod.create(:carrier => 'USPS' , :service_code => 'USPS GXG<sup>™</sup> Envelopes' , :service_name => 'USPS GXG Envelopes' )
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
@@ -3,7 +3,18 @@ require 'box_packer'
|
|
3
3
|
module Caboose
|
4
4
|
class ShippingPackage < ActiveRecord::Base
|
5
5
|
self.table_name = 'store_shipping_packages'
|
6
|
-
|
6
|
+
|
7
|
+
has_many :shipping_package_methods
|
8
|
+
has_many :shipping_methods, :through => :shipping_package_methods
|
9
|
+
attr_accessible :id,
|
10
|
+
:site_id,
|
11
|
+
:name,
|
12
|
+
:length,
|
13
|
+
:width,
|
14
|
+
:height,
|
15
|
+
:volume,
|
16
|
+
:priority,
|
17
|
+
:flat_rate_price
|
7
18
|
|
8
19
|
def fits(variants)
|
9
20
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Caboose
|
2
|
+
class ShippingPackageMethod < ActiveRecord::Base
|
3
|
+
self.table_name = 'store_shipping_package_methods'
|
4
|
+
|
5
|
+
belongs_to :shipping_package
|
6
|
+
belongs_to :shipping_method
|
7
|
+
attr_accessible :id,
|
8
|
+
:shipping_package_id,
|
9
|
+
:shipping_method_id
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
<%
|
2
|
+
s = @site
|
3
|
+
admin_ids = Caboose::SiteMembership.where(:site_id => s.id, :role => Caboose::SiteMembership::ROLE_ADMIN).pluck(:user_id)
|
4
|
+
user_ids = Caboose::SiteMembership.where(:site_id => s.id, :role => Caboose::SiteMembership::ROLE_USER ).pluck(:user_id)
|
5
|
+
admin_ids = [] if admin_ids.nil?
|
6
|
+
user_ids = [] if user_ids.nil?
|
7
|
+
%>
|
8
|
+
<%= render :partial => 'caboose/sites/admin_header' %>
|
9
|
+
|
10
|
+
<p><div id='site_<%= @site.id %>_name' ></div></p>
|
11
|
+
<p><div id='site_<%= @site.id %>_description' ></div></p>
|
12
|
+
<p><div id='site_<%= @site.id %>_under_construction_html' ></div></p>
|
13
|
+
|
14
|
+
<h2>Domains</h2>
|
15
|
+
<p><a href='#' onclick="add_domain(<%= @site.id %>);">New Domain</a></p>
|
16
|
+
<div id='new_domain_container'></div>
|
17
|
+
<% if @site.domains && @site.domains.count > 0 %>
|
18
|
+
<table class='data'>
|
19
|
+
<tr>
|
20
|
+
<th>Domain</th>
|
21
|
+
<th>Primary</th>
|
22
|
+
<th>Under Construction</th>
|
23
|
+
<th>Delete</th>
|
24
|
+
</tr>
|
25
|
+
<% @site.domains.all.each do |d| %>
|
26
|
+
<tr>
|
27
|
+
<td><%= d.domain %></td>
|
28
|
+
<td align='center'><input type='radio' name='primary_domain' <%= d.primary? ? "checked='true'" : '' %> onclick="set_primary_domain(<%= s.id %>, <%= d.id %>);" /></td>
|
29
|
+
<td align='center'><input type='checkbox' name='under_construction_<%= d.id %>' <%= d.under_construction ? "checked='true'" : '' %> onclick="set_under_construction(<%= s.id %>, <%= d.id %>, $(this).prop('checked'));" /></td>
|
30
|
+
<td align='center'><input type='button' value='Delete' onclick="delete_domain(<%= @site.id %>, <%= d.id %>);" /></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
<% else %>
|
35
|
+
<p>This site doesn't have any domains yet.</p>
|
36
|
+
<% end %>
|
37
|
+
<div id='domain_message'></div>
|
38
|
+
|
39
|
+
<h2>Members</h2>
|
40
|
+
<div id='members'>
|
41
|
+
<table class='data'>
|
42
|
+
<tr><th>User</th><th>None</th><th>User</th><th>Admin</th></tr>
|
43
|
+
<% Caboose::User.reorder('last_name, first_name').all.each do |u| %>
|
44
|
+
<tr>
|
45
|
+
<td><%= u.first_name %> <%= u.last_name %> (<%= u.email %>)</td>
|
46
|
+
<td align='center'><input type='radio' name='user<%= u.id %>' <%= !admin_ids.include?(u.id) && !user_ids.include?(u.id) ? "checked='true'" : '' %> onclick="remove_site_membership(<%= s.id %>, <%= u.id %>);" /></td>
|
47
|
+
<td align='center'><input type='radio' name='user<%= u.id %>' <%= user_ids.include?(u.id) ? "checked='true'" : '' %> onclick="add_site_membership(<%= s.id %>, <%= u.id %>, 'User');" /></td>
|
48
|
+
<td align='center'><input type='radio' name='user<%= u.id %>' <%= admin_ids.include?(u.id) ? "checked='true'" : '' %> onclick="add_site_membership(<%= s.id %>, <%= u.id %>, 'Admin');" /></td>
|
49
|
+
</tr>
|
50
|
+
<% end %>
|
51
|
+
</table>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<%= render :partial => 'caboose/sites/admin_footer' %>
|
55
|
+
|
56
|
+
<% content_for :caboose_js do %>
|
57
|
+
<script type="text/javascript">
|
58
|
+
|
59
|
+
$(document).ready(function() {
|
60
|
+
new ModelBinder({
|
61
|
+
name: 'Site',
|
62
|
+
id: <%= @site.id %>,
|
63
|
+
update_url: '/admin/sites/<%= @site.id %>',
|
64
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
65
|
+
attributes: [
|
66
|
+
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
|
67
|
+
{ name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
|
68
|
+
{ name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 }
|
69
|
+
]
|
70
|
+
});
|
71
|
+
});
|
72
|
+
|
73
|
+
function set_under_construction(site_id, domain_id, checked)
|
74
|
+
{
|
75
|
+
$.ajax({
|
76
|
+
url: '/admin/sites/' + site_id + '/domains/' + domain_id,
|
77
|
+
type: 'put',
|
78
|
+
data: { under_construction: checked ? 1 : 0 }
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
function add_site_membership(site_id, user_id, role)
|
83
|
+
{
|
84
|
+
$.ajax({
|
85
|
+
url: '/admin/sites/' + site_id +'/members',
|
86
|
+
type: 'post',
|
87
|
+
data: {
|
88
|
+
user_id: user_id,
|
89
|
+
role: role
|
90
|
+
},
|
91
|
+
succes: function(resp) {}
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
95
|
+
function remove_site_membership(site_id, user_id)
|
96
|
+
{
|
97
|
+
$.ajax({
|
98
|
+
url: '/admin/sites/' + site_id +'/members/' + user_id,
|
99
|
+
type: 'delete',
|
100
|
+
succes: function(resp) {}
|
101
|
+
});
|
102
|
+
}
|
103
|
+
|
104
|
+
function add_domain(site_id, domain)
|
105
|
+
{
|
106
|
+
if (!domain)
|
107
|
+
{
|
108
|
+
var div = $('<div/>')
|
109
|
+
.append($('<p/>')
|
110
|
+
.addClass('note warning')
|
111
|
+
.append("What domain would you like to add?<br />")
|
112
|
+
.append($('<input/>').attr('type','text').attr('id','new_domain').css('width', '200px')).append(' ')
|
113
|
+
.append($('<input/>').attr('type','button').val('Add').click(function() { add_domain(site_id, $('#new_domain').val()); })).append(' ')
|
114
|
+
.append($('<input/>').attr('type','button').val('Cancel').click(function() { $('#new_domain_container').empty(); }))
|
115
|
+
)
|
116
|
+
.append($('<div/>').attr('id', 'new_domain_message'));
|
117
|
+
$('#new_domain_container').empty().append(div);
|
118
|
+
return;
|
119
|
+
}
|
120
|
+
$('#new_domain_message').empty().html("<p class='loading'>Adding domain...</p>");
|
121
|
+
$.ajax({
|
122
|
+
url: '/admin/sites/' + site_id + '/domains',
|
123
|
+
type: 'post',
|
124
|
+
data: { domain: domain },
|
125
|
+
success: function(resp) {
|
126
|
+
if (resp.error) $('#new_domain_message').html("<p class='note error'>" + resp.error + "<br /></p>");
|
127
|
+
if (resp.refresh) window.location.reload(true);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
function delete_domain(site_id, domain_id, confirm)
|
133
|
+
{
|
134
|
+
if (!confirm)
|
135
|
+
{
|
136
|
+
var p = $('<p/>').addClass('note confirm')
|
137
|
+
.append('Are you sure you want to delete the domain? ')
|
138
|
+
.append($('<input/>').attr('type','button').val('Yes').click(function() { delete_domain(site_id, domain_id, true); })).append(' ')
|
139
|
+
.append($('<input/>').attr('type','button').val('No').click(function() { $('#domain_message').empty(); }));
|
140
|
+
$('#domain_message').empty().append(p);
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
$('#domain_message').html("<p class='loading'>Deleting domain...</p>");
|
144
|
+
$.ajax({
|
145
|
+
url: '/admin/sites/' + site_id + '/domains/' + domain_id,
|
146
|
+
type: 'delete',
|
147
|
+
success: function(resp) {
|
148
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
149
|
+
if (resp.refresh) window.location.reload(true);
|
150
|
+
}
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
function set_primary_domain(site_id, domain_id)
|
155
|
+
{
|
156
|
+
$.ajax({
|
157
|
+
url: '/admin/sites/' + site_id + '/domains/' + domain_id + '/set-primary',
|
158
|
+
type: 'put',
|
159
|
+
success: function(resp) {}
|
160
|
+
});
|
161
|
+
}
|
162
|
+
|
163
|
+
</script>
|
164
|
+
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<%= render :partial => 'caboose/sites/admin_header' %>
|
2
|
+
|
3
|
+
<h2>Shipping Packages</h2>
|
4
|
+
<div id='shipping_packages'></div>
|
5
|
+
|
6
|
+
<%= render :partial => 'caboose/sites/admin_footer' %>
|
7
|
+
|
8
|
+
<% content_for :caboose_js do %>
|
9
|
+
<script type='text/javascript'>
|
10
|
+
|
11
|
+
$(document).ready(function() {
|
12
|
+
var that = this;
|
13
|
+
var table = new IndexTable({
|
14
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
15
|
+
container: 'shipping_packages',
|
16
|
+
base_url: '/admin/sites/<%= @site.id %>/shipping-packages',
|
17
|
+
allow_bulk_edit: false,
|
18
|
+
allow_bulk_delete: true,
|
19
|
+
allow_duplicate: false,
|
20
|
+
allow_advanced_edit: false,
|
21
|
+
fields: [
|
22
|
+
{ show: true , name: 'name' , nice_name: 'Shipping Method' , sort: 'shipping_method_id' , type: 'select' , value: function(sp) { return sp.shipping_method_id }, width: 75, align: 'left' },
|
23
|
+
{ show: true , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(sp) { return sp.length }, width: 50, align: 'right' },
|
24
|
+
{ show: true , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(sp) { return sp.width }, width: 50, align: 'right' },
|
25
|
+
{ show: true , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(sp) { return sp.height }, width: 50, align: 'right' },
|
26
|
+
{ show: true , name: 'volume' , nice_name: 'Volume (in<sup>3</sup>)' , sort: 'volume' , type: 'text' , value: function(sp) { return sp.volume }, width: 50, align: 'right' },
|
27
|
+
{ show: true , name: 'flat_rate_price' , nice_name: 'Flat Rate Price' , sort: 'flat_rate_price' , type: 'text' , value: function(sp) { return sp.flat_rate_price }, width: 50, align: 'right' },
|
28
|
+
{ show: true , name: 'priority' , nice_name: 'Priority' , sort: 'priority' , type: 'text' , value: function(sp) { return sp.priority }, width: 50, align: 'right' }
|
29
|
+
],
|
30
|
+
new_model_text: 'New Shipping Package',
|
31
|
+
new_model_fields: [
|
32
|
+
{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , width: 50 },
|
33
|
+
{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , width: 50 },
|
34
|
+
{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , width: 50 }
|
35
|
+
],
|
36
|
+
bulk_import_fields: ['shipping_method_id', 'length', 'width', 'height'],
|
37
|
+
bulk_import_url: '/admin/sites/<%= @site.id %>/shipping-packages/bulk'
|
38
|
+
});
|
39
|
+
});
|
40
|
+
|
41
|
+
</script>
|
42
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
<h1>New Site</h1>
|
3
|
+
|
4
|
+
<form action='/admin/sites' method='post' id='new_site_form'>
|
5
|
+
<input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
|
6
|
+
<p><input type='text' name='name' id='name' placeholder='Name' value='' style='width: 400px;' /></p>
|
7
|
+
<div id='message'></div>
|
8
|
+
<p><input type='submit' value='Add Site' /></p>
|
9
|
+
</form>
|
10
|
+
|
11
|
+
<% content_for :caboose_js do %>
|
12
|
+
<script type='text/javascript'>
|
13
|
+
|
14
|
+
$(document).ready(function() {
|
15
|
+
$('#new_site_form').submit(function() { add_site(); return false; });
|
16
|
+
});
|
17
|
+
|
18
|
+
function add_site()
|
19
|
+
{
|
20
|
+
$('#message').html("<p class='loading'>Adding site...</p>");
|
21
|
+
$.ajax({
|
22
|
+
url: '/admin/sites',
|
23
|
+
type: 'post',
|
24
|
+
data: $('#new_site_form').serialize(),
|
25
|
+
success: function(resp) {
|
26
|
+
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
27
|
+
if (resp.redirect) window.location = resp.redirect;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
</script>
|
33
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -405,6 +405,20 @@ Caboose::Engine.routes.draw do
|
|
405
405
|
post "/admin/stackable-groups" => "stackable_groups#admin_add"
|
406
406
|
delete "/admin/stackable-groups/bulk" => "stackable_groups#admin_bulk_delete"
|
407
407
|
delete "/admin/stackable-groups/:id" => "stackable_groups#admin_delete"
|
408
|
+
|
409
|
+
#=============================================================================
|
410
|
+
# Shipping Packages
|
411
|
+
#=============================================================================
|
412
|
+
|
413
|
+
get "/admin/sites/:site_id/shipping-packages/options" => "shipping_packages#admin_options"
|
414
|
+
get "/admin/sites/:site_id/shipping-packages/shipping-method-options" => "shipping_packages#admin_shipping_method_options"
|
415
|
+
get "/admin/sites/:site_id/shipping-packages/json" => "shipping_packages#admin_json"
|
416
|
+
get "/admin/sites/:site_id/shipping-packages/:id/json" => "shipping_packages#admin_json_single"
|
417
|
+
get "/admin/sites/:site_id/shipping-packages" => "shipping_packages#admin_index"
|
418
|
+
put "/admin/sites/:site_id/shipping-packages/:id" => "shipping_packages#admin_update"
|
419
|
+
post "/admin/sites/:site_id/shipping-packages" => "shipping_packages#admin_add"
|
420
|
+
delete "/admin/sites/:site_id/shipping-packages/bulk" => "shipping_packages#admin_bulk_delete"
|
421
|
+
delete "/admin/sites/:site_id/shipping-packages/:id" => "shipping_packages#admin_delete"
|
408
422
|
|
409
423
|
#=============================================================================
|
410
424
|
# Categories
|
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.5.
|
4
|
+
version: 0.5.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -499,6 +499,7 @@ files:
|
|
499
499
|
- app/controllers/caboose/reviews_controller.rb
|
500
500
|
- app/controllers/caboose/roles_controller.rb
|
501
501
|
- app/controllers/caboose/settings_controller.rb
|
502
|
+
- app/controllers/caboose/shipping_packages_controller.rb
|
502
503
|
- app/controllers/caboose/sites_controller.rb
|
503
504
|
- app/controllers/caboose/stackable_groups_controller.rb
|
504
505
|
- app/controllers/caboose/station_controller.rb
|
@@ -581,7 +582,10 @@ files:
|
|
581
582
|
- app/models/caboose/search_filter.rb
|
582
583
|
- app/models/caboose/setting.rb
|
583
584
|
- app/models/caboose/shipping_calculator.rb
|
585
|
+
- app/models/caboose/shipping_method.rb
|
586
|
+
- app/models/caboose/shipping_method_loader.rb
|
584
587
|
- app/models/caboose/shipping_package.rb
|
588
|
+
- app/models/caboose/shipping_package_method.rb
|
585
589
|
- app/models/caboose/site.rb
|
586
590
|
- app/models/caboose/site_membership.rb
|
587
591
|
- app/models/caboose/smtp_config.rb
|
@@ -781,6 +785,9 @@ files:
|
|
781
785
|
- app/views/caboose/settings/edit.html.erb
|
782
786
|
- app/views/caboose/settings/index.html.erb
|
783
787
|
- app/views/caboose/settings/new.html.erb
|
788
|
+
- app/views/caboose/shipping_packages/admin_edit.html.erb
|
789
|
+
- app/views/caboose/shipping_packages/admin_index.html.erb
|
790
|
+
- app/views/caboose/shipping_packages/admin_new.html.erb
|
784
791
|
- app/views/caboose/sites/_admin_footer.html.erb
|
785
792
|
- app/views/caboose/sites/_admin_header.html.erb
|
786
793
|
- app/views/caboose/sites/admin_delete_form.html.erb
|