caboose-cms 0.5.46 → 0.5.47
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/categories_controller.rb +56 -45
- data/app/controllers/caboose/products_controller.rb +13 -6
- data/app/controllers/caboose/vendors_controller.rb +33 -34
- data/app/models/caboose/category.rb +3 -1
- data/app/models/caboose/discount.rb +3 -0
- data/app/models/caboose/order.rb +3 -1
- data/app/models/caboose/product.rb +3 -1
- data/app/models/caboose/schema.rb +18 -10
- data/app/models/caboose/vendor.rb +7 -2
- data/app/views/caboose/vendors/admin_new.html.erb +21 -21
- data/config/routes.rb +3 -3
- data/lib/caboose/version.rb +1 -1
- metadata +2 -3
- data/app/models/caboose/#Untitled-1# +0 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzBjMTkxZTAwZThkY2FjNDA1YTcxZWFjOWIyYWE1MWUzZTM0YjdiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGNiMzEwYWJhZWZjZWVkNjg2MTY3YWFmNTg4ZTA0OWY0ZWZhZGEwZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGRiZTFkYjgwZjRkYTI1YzRlNDE1MzAwOTA5MzM1YTIwN2VmZDFhMzQxYzI1
|
10
|
+
YWM3YjU3ZWNiNjNkYTBmZjNlNjRiODc0NjcwMGM4MmVhMTU4YWY5ZDkxMWZm
|
11
|
+
YjE4MTdhYzViZTY3OWU4OTQ3MWRiOTM0N2E4M2JkMWYzM2ExNWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjUzZjU4ZDgzMGI5NzEzYTJjYTk0ODE0YmY0ODYxYTJlYWJiNzc4ZTljMWEx
|
14
|
+
N2Q3MmM2MTlhNjMzNGViM2VkOGNmNmFjMmMwYzAzYzU0MzcwYTg0ZTNlYjVl
|
15
|
+
MWQ0MmZjMmE2NzFmOGY5ZjAyMDU5M2JiOGFhODU3NjNjNjc5ODk=
|
@@ -8,43 +8,52 @@ module Caboose
|
|
8
8
|
# GET /admin/categories
|
9
9
|
def admin_index
|
10
10
|
return unless user_is_allowed('categories', 'view')
|
11
|
-
render layout
|
11
|
+
render :layout => 'caboose/admin'
|
12
12
|
end
|
13
13
|
|
14
14
|
# GET /admin/categories/new
|
15
15
|
def admin_new
|
16
16
|
return unless user_is_allowed('categories', 'add')
|
17
|
-
render layout
|
17
|
+
render :layout => 'caboose/admin'
|
18
18
|
end
|
19
19
|
|
20
20
|
# POST /admin/categories
|
21
21
|
def admin_add
|
22
22
|
return unless user_is_allowed('categories', 'add')
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
resp = Caboose::StdClass.new
|
25
|
+
|
26
|
+
p = Category.where(:id => params[:parent_id]).first
|
27
|
+
|
28
|
+
if params[:parent_id].nil? || params[:parent_id].empty? || p.nil?
|
29
|
+
resp.error = 'Please select a parent category.'
|
30
|
+
elsif params[:name].nil? || params[:name].empty?
|
31
|
+
resp.error = 'This title cannot be empty'
|
32
|
+
else
|
33
|
+
cat = Category.new(
|
34
|
+
:site_id => @site.id,
|
35
|
+
:parent_id => p.id,
|
36
|
+
:name => params[:name],
|
37
|
+
:status => 'Inactive'
|
38
|
+
)
|
39
|
+
cat.slug = cat.generate_slug
|
40
|
+
cat.url = "#{p.url}/#{cat.slug}"
|
34
41
|
|
35
|
-
if
|
36
|
-
|
42
|
+
if cat.save
|
43
|
+
resp.redirect = "/admin/categories/#{cat.id}"
|
37
44
|
else
|
38
|
-
|
45
|
+
resp.error = 'There was an error saving the category.'
|
39
46
|
end
|
40
47
|
end
|
48
|
+
|
49
|
+
render :json => resp
|
41
50
|
end
|
42
51
|
|
43
52
|
# GET /admin/categories/:id/edit
|
44
53
|
def admin_edit
|
45
54
|
return unless user_is_allowed('categories', 'edit')
|
46
55
|
@category = Category.find(params[:id])
|
47
|
-
render layout
|
56
|
+
render :layout => 'caboose/admin'
|
48
57
|
end
|
49
58
|
|
50
59
|
# PUT /admin/categories/:id
|
@@ -52,62 +61,64 @@ module Caboose
|
|
52
61
|
return unless user_is_allowed('categories', 'edit')
|
53
62
|
|
54
63
|
# Define category and initialize response
|
55
|
-
|
56
|
-
|
64
|
+
cat = Category.find(params[:id])
|
65
|
+
resp = Caboose::StdClass.new({ :attributes => {} })
|
57
66
|
|
58
67
|
# Iterate over params and update relevant attributes
|
59
68
|
params.each do |key, value|
|
60
69
|
case key
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
70
|
+
when 'site_id' then cat.name = value
|
71
|
+
when 'name' then cat.name = value
|
72
|
+
when 'slug' then cat.slug = value
|
73
|
+
when 'status' then cat.status = value
|
74
|
+
when 'image' then cat.image = value
|
65
75
|
end
|
66
76
|
end
|
67
77
|
|
68
78
|
# Try and save category
|
69
|
-
|
79
|
+
resp.success = cat.save
|
70
80
|
|
71
81
|
# If an image is passed, return the url
|
72
|
-
|
82
|
+
resp.attributes[:image] = { :value => cat.image.url(:medium) } if params[:image]
|
73
83
|
|
74
84
|
# Respond to update request
|
75
|
-
render :json =>
|
85
|
+
render :json => resp
|
76
86
|
end
|
77
87
|
|
78
88
|
# DELETE /admin/categories/:id
|
79
89
|
def admin_delete
|
80
90
|
return unless user_is_allowed('categories', 'delete')
|
81
91
|
|
82
|
-
|
92
|
+
resp = Caboose::StdClass.new
|
93
|
+
cat = Category.find(params[:id])
|
83
94
|
|
84
|
-
if
|
85
|
-
|
86
|
-
elsif
|
87
|
-
|
95
|
+
if cat.products.any?
|
96
|
+
resp.error = "Can't delete a category that has products in it."
|
97
|
+
elsif cat.children.any?
|
98
|
+
resp.error = "You can't delete a category that has child categories."
|
88
99
|
else
|
89
|
-
|
100
|
+
resp.success = cat.destroy
|
101
|
+
resp.redirect = '/admin/categories'
|
90
102
|
end
|
103
|
+
render :json => resp
|
91
104
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
:value => status,
|
101
|
-
:text => status
|
102
|
-
}
|
103
|
-
end
|
104
|
-
render :json => options
|
105
|
+
|
106
|
+
# GET /admin/categories/status-options
|
107
|
+
def admin_status_options
|
108
|
+
render :json => [
|
109
|
+
{ :value => 'Active' , :text => 'Active' },
|
110
|
+
{ :value => 'Inactive' , :text => 'Inactive' },
|
111
|
+
{ :value => 'Deleted' , :text => 'Deleted' }
|
112
|
+
]
|
105
113
|
end
|
106
114
|
|
107
115
|
# GET /admin/categories/options
|
108
116
|
def admin_options
|
109
117
|
options = []
|
110
|
-
cat = Category.
|
118
|
+
cat = Category.where("site_id = ? and parent_id is null").first
|
119
|
+
if cat.nil?
|
120
|
+
cat = Category.create(:site_id => @site.id, :name => 'All Products', :url => '/')
|
121
|
+
end
|
111
122
|
cat.children.each do |c|
|
112
123
|
admin_options_helper(options, c, '')
|
113
124
|
end
|
@@ -29,7 +29,7 @@ module Caboose
|
|
29
29
|
url_without_params = request.fullpath.split('?').first
|
30
30
|
|
31
31
|
# Find the category
|
32
|
-
category = Category.where(:url => url_without_params).first
|
32
|
+
category = Category.where(:site_id => @site.id, :url => url_without_params).first
|
33
33
|
|
34
34
|
# Set category ID
|
35
35
|
params['category_id'] = category.id
|
@@ -42,6 +42,7 @@ module Caboose
|
|
42
42
|
|
43
43
|
# Otherwise looking at a category or search parameters
|
44
44
|
@pager = Caboose::Pager.new(params, {
|
45
|
+
'site_id' => @site.id,
|
45
46
|
'category_id' => '',
|
46
47
|
'vendor_id' => '',
|
47
48
|
'vendor_name' => '',
|
@@ -165,10 +166,10 @@ module Caboose
|
|
165
166
|
@variants = products.collect { |product| product.variants }.flatten
|
166
167
|
|
167
168
|
# Grab all categories; except for "all" and "uncategorized"
|
168
|
-
@categories = Category.where('parent_id IS NOT NULL AND name IS NOT NULL').order(:url)
|
169
|
+
@categories = Category.where('site_id = ? and parent_id IS NOT NULL AND name IS NOT NULL', @site.id).order(:url)
|
169
170
|
|
170
171
|
# Grab all vendors
|
171
|
-
@vendors = Vendor.where('name IS NOT NULL').order(:name)
|
172
|
+
@vendors = Vendor.where('site_id = ? and name IS NOT NULL', @site.id).order(:name)
|
172
173
|
|
173
174
|
render :layout => 'caboose/admin'
|
174
175
|
end
|
@@ -265,6 +266,7 @@ module Caboose
|
|
265
266
|
params[:sort] = 'store_vendors.name' if params[:sort] == 'vendor'
|
266
267
|
|
267
268
|
@gen = Caboose::PageBarGenerator.new(params, {
|
269
|
+
'site_id' => @site.id,
|
268
270
|
'vendor_name' => '',
|
269
271
|
'search_like' => '',
|
270
272
|
'price' => params[:filters] && params[:filters][:missing_prices] ? 0 : ''
|
@@ -309,6 +311,7 @@ module Caboose
|
|
309
311
|
params[:sort] = 'store_vendors.name' if params[:sort] == 'vendor'
|
310
312
|
|
311
313
|
pager = Caboose::PageBarGenerator.new(params, {
|
314
|
+
'site_id' => @site.id,
|
312
315
|
'vendor_name' => '',
|
313
316
|
'search_like' => '',
|
314
317
|
'price' => params[:filters] && params[:filters][:missing_prices] ? 0 : ''
|
@@ -577,6 +580,7 @@ module Caboose
|
|
577
580
|
save = true
|
578
581
|
params.each do |name,value|
|
579
582
|
case name
|
583
|
+
when 'site_id' then product.site_id = value
|
580
584
|
when 'alternate_id' then product.alternate_id = value
|
581
585
|
when 'title' then product.title = value
|
582
586
|
when 'caption' then product.caption = value
|
@@ -642,12 +646,15 @@ module Caboose
|
|
642
646
|
:redirect => nil
|
643
647
|
)
|
644
648
|
|
645
|
-
|
649
|
+
name = params[:name]
|
646
650
|
|
647
|
-
if
|
651
|
+
if name.length == 0
|
648
652
|
resp.error = "The title cannot be empty."
|
649
653
|
else
|
650
|
-
p = Product.new(
|
654
|
+
p = Product.new(
|
655
|
+
:site_id => @site.id,
|
656
|
+
:title => name
|
657
|
+
)
|
651
658
|
p.save
|
652
659
|
resp.redirect = "/admin/products/#{p.id}/general"
|
653
660
|
end
|
@@ -1,39 +1,10 @@
|
|
1
1
|
module Caboose
|
2
2
|
class VendorsController < Caboose::ApplicationController
|
3
|
-
|
4
|
-
# GET /admin/vendors/status-options
|
5
|
-
def status_options
|
6
|
-
options = Array.new
|
7
|
-
|
8
|
-
['Active', 'Inactive', 'Deleted'].each do |status|
|
9
|
-
options << {
|
10
|
-
:text => status,
|
11
|
-
:value => status
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
render :json => options
|
16
|
-
end
|
17
|
-
|
18
|
-
# GET /admin/vendors/new
|
19
|
-
def admin_new
|
20
|
-
render :layout => 'caboose/admin'
|
21
|
-
end
|
22
|
-
|
23
|
-
# POST /admin/vendors/create
|
24
|
-
def admin_create
|
25
|
-
render :json => { :success => false, :message => 'Must define a name' } and return if params[:name].nil? || params[:name].empty?
|
26
|
-
|
27
|
-
vendor = Vendor.new
|
28
|
-
vendor.name = params[:name]
|
29
|
-
vendor.status = 'Inactive'
|
30
|
-
|
31
|
-
render :json => { :success => vendor.save, :redirect => "/admin/vendors/#{vendor.id}/edit" }
|
32
|
-
end
|
33
|
-
|
3
|
+
|
34
4
|
# GET /admin/vendors
|
35
5
|
def admin_index
|
36
6
|
@pager = Caboose::Pager.new(params, {
|
7
|
+
'site_id' => @site.id,
|
37
8
|
'name_like' => ''
|
38
9
|
}, {
|
39
10
|
'model' => 'Caboose::Vendor',
|
@@ -49,7 +20,7 @@ module Caboose
|
|
49
20
|
render :layout => 'caboose/admin'
|
50
21
|
end
|
51
22
|
|
52
|
-
# GET /admin/vendors/:id
|
23
|
+
# GET /admin/vendors/:id
|
53
24
|
def admin_edit
|
54
25
|
@vendor = Vendor.find(params[:id])
|
55
26
|
render :layout => 'caboose/admin'
|
@@ -61,13 +32,41 @@ module Caboose
|
|
61
32
|
|
62
33
|
params.each do |name, value|
|
63
34
|
case name
|
64
|
-
when '
|
65
|
-
when '
|
35
|
+
when 'site_id' then vendor.site_id = value
|
36
|
+
when 'name' then vendor.name = value
|
37
|
+
when 'status' then vendor.status = value
|
66
38
|
end
|
67
39
|
end
|
68
40
|
|
69
41
|
render :json => { :success => vendor.save }
|
70
42
|
end
|
43
|
+
|
44
|
+
# GET /admin/vendors/new
|
45
|
+
def admin_new
|
46
|
+
render :layout => 'caboose/admin'
|
47
|
+
end
|
48
|
+
|
49
|
+
# POST /admin/vendors
|
50
|
+
def admin_add
|
51
|
+
render :json => { :success => false, :message => 'Must define a name' } and return if params[:name].nil? || params[:name].empty?
|
52
|
+
|
53
|
+
vendor = Vendor.new(
|
54
|
+
:site_id => @site.id,
|
55
|
+
:name => params[:name],
|
56
|
+
:status => 'Inactive'
|
57
|
+
)
|
58
|
+
render :json => { :success => vendor.save, :redirect => "/admin/vendors/#{vendor.id}" }
|
59
|
+
end
|
60
|
+
|
61
|
+
# GET /admin/vendors/status-options
|
62
|
+
def status_options
|
63
|
+
render :json => [
|
64
|
+
{ :text => 'Active' , :value => 'Active' },
|
65
|
+
{ :text => 'Inactive' , :value => 'Inactive' },
|
66
|
+
{ :text => 'Deleted' , :value => 'Deleted' }
|
67
|
+
]
|
68
|
+
end
|
69
|
+
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
@@ -7,7 +7,8 @@
|
|
7
7
|
module Caboose
|
8
8
|
class Category < ActiveRecord::Base
|
9
9
|
self.table_name = 'store_categories'
|
10
|
-
|
10
|
+
|
11
|
+
belongs_to :site
|
11
12
|
belongs_to :parent, :class_name => 'Category', :foreign_key => 'parent_id'
|
12
13
|
has_many :children, :class_name => 'Category', :foreign_key => 'parent_id', :order => 'name'
|
13
14
|
has_many :products, :through => :category_memberships, :order => 'title'
|
@@ -27,6 +28,7 @@ module Caboose
|
|
27
28
|
validates_attachment_content_type :image, :content_type => %w(image/jpeg image/jpg image/png)
|
28
29
|
|
29
30
|
attr_accessible :id,
|
31
|
+
:site_id,
|
30
32
|
:parent_id,
|
31
33
|
:name,
|
32
34
|
:url,
|
@@ -3,7 +3,10 @@ module Caboose
|
|
3
3
|
self.table_name = 'store_discounts'
|
4
4
|
self.primary_key = 'id'
|
5
5
|
|
6
|
+
belongs_to :site
|
7
|
+
|
6
8
|
attr_accessible :id,
|
9
|
+
:site_id,
|
7
10
|
:name, # The name of this discount
|
8
11
|
:code, # The code the customer has to input to apply for this discount
|
9
12
|
:amount_current,
|
data/app/models/caboose/order.rb
CHANGED
@@ -6,7 +6,8 @@ module Caboose
|
|
6
6
|
class Order < ActiveRecord::Base
|
7
7
|
self.table_name = 'store_orders'
|
8
8
|
self.primary_key = 'id'
|
9
|
-
|
9
|
+
|
10
|
+
belongs_to :site
|
10
11
|
belongs_to :customer, :class_name => 'Caboose::User'
|
11
12
|
belongs_to :shipping_address, :class_name => 'Address'
|
12
13
|
belongs_to :billing_address, :class_name => 'Address'
|
@@ -16,6 +17,7 @@ module Caboose
|
|
16
17
|
has_many :packages, :class_name => 'Caboose::OrderPackage'
|
17
18
|
|
18
19
|
attr_accessible :id,
|
20
|
+
:site_id,
|
19
21
|
:order_number,
|
20
22
|
:subtotal,
|
21
23
|
:tax,
|
@@ -2,7 +2,8 @@ module Caboose
|
|
2
2
|
class Product < ActiveRecord::Base
|
3
3
|
self.table_name = 'store_products'
|
4
4
|
self.primary_key = 'id'
|
5
|
-
|
5
|
+
|
6
|
+
belongs_to :site
|
6
7
|
belongs_to :stackable_group, :class_name => 'Caboose::StackableGroup'
|
7
8
|
belongs_to :vendor, :class_name => 'Caboose::Vendor'
|
8
9
|
has_many :customizations, :class_name => 'Caboose::Product', :through => :customization_memberships
|
@@ -17,6 +18,7 @@ module Caboose
|
|
17
18
|
#default_scope order('store_products.sort_order')
|
18
19
|
|
19
20
|
attr_accessible :id,
|
21
|
+
:site_id,
|
20
22
|
:alternate_id,
|
21
23
|
:title,
|
22
24
|
:description,
|
@@ -55,7 +55,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
55
55
|
:repeat_end
|
56
56
|
],
|
57
57
|
#Caboose::PageCache => [:block],
|
58
|
-
Caboose::Variant => [:quantity]
|
58
|
+
Caboose::Variant => [:quantity],
|
59
|
+
Caboose::Vendor => [:vendor]
|
59
60
|
}
|
60
61
|
end
|
61
62
|
|
@@ -196,7 +197,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
196
197
|
[ :repeat_count , :integer ],
|
197
198
|
[ :date_end , :date ]
|
198
199
|
],
|
199
|
-
Caboose::Category => [
|
200
|
+
Caboose::Category => [
|
201
|
+
[ :site_id , :integer ],
|
200
202
|
[ :parent_id , :integer ],
|
201
203
|
[ :name , :string ],
|
202
204
|
[ :url , :string ],
|
@@ -226,6 +228,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
226
228
|
[ :updated_at , :datetime , :null => true ]
|
227
229
|
],
|
228
230
|
Caboose::Discount => [
|
231
|
+
[ :site_id , :integer ],
|
229
232
|
[ :name , :string ],
|
230
233
|
[ :code , :string ],
|
231
234
|
[ :amount_current , :numeric ],
|
@@ -273,6 +276,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
273
276
|
[ :file , :attachment ]
|
274
277
|
],
|
275
278
|
Caboose::Order => [
|
279
|
+
[ :site_id , :integer ],
|
276
280
|
[ :email , :string ],
|
277
281
|
[ :order_number , :string ],
|
278
282
|
[ :subtotal , :numeric , :default => 0 ],
|
@@ -389,6 +393,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
389
393
|
[ :post_category_id , :integer ]
|
390
394
|
],
|
391
395
|
Caboose::Product => [
|
396
|
+
[ :site_id , :integer ],
|
392
397
|
[ :alternate_id , :string ],
|
393
398
|
[ :title , :string ],
|
394
399
|
[ :caption , :string ],
|
@@ -460,8 +465,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
460
465
|
[ :prices , :text ]
|
461
466
|
],
|
462
467
|
Caboose::Setting => [
|
463
|
-
[ :
|
464
|
-
[ :
|
468
|
+
[ :site_id , :integer ],
|
469
|
+
[ :name , :string ],
|
470
|
+
[ :value , :text ]
|
465
471
|
],
|
466
472
|
Caboose::ShippingPackage => [
|
467
473
|
[ :carrier , :string ],
|
@@ -521,6 +527,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
521
527
|
[ :handling_percentage , :string ]
|
522
528
|
],
|
523
529
|
Caboose::User => [
|
530
|
+
[ :site_id , :integer ],
|
524
531
|
[ :first_name , :string ],
|
525
532
|
[ :last_name , :string ],
|
526
533
|
[ :username , :string ],
|
@@ -542,6 +549,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
542
549
|
[ :is_guest , :boolean , { :default => false }]
|
543
550
|
],
|
544
551
|
Caboose::Variant => [
|
552
|
+
[ :product_id , :integer ],
|
553
|
+
[ :alternate_id , :string ],
|
545
554
|
[ :sku , :string ],
|
546
555
|
[ :barcode , :string ],
|
547
556
|
[ :price , :numeric , :default => 0 ],
|
@@ -559,10 +568,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
559
568
|
[ :option2 , :string ],
|
560
569
|
[ :option3 , :string ],
|
561
570
|
[ :requires_shipping , :boolean ],
|
562
|
-
[ :taxable , :boolean ],
|
563
|
-
[ :
|
564
|
-
[ :shipping_unit_value , :numeric ],
|
565
|
-
[ :alternate_id , :string ],
|
571
|
+
[ :taxable , :boolean ],
|
572
|
+
[ :shipping_unit_value , :numeric ],
|
566
573
|
[ :status , :string ],
|
567
574
|
[ :option1_sort_order , :integer , { :defult => 0 }],
|
568
575
|
[ :option2_sort_order , :integer , { :defult => 0 }],
|
@@ -570,8 +577,9 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
570
577
|
[ :sort_order , :integer , { :defult => 0 }]
|
571
578
|
],
|
572
579
|
Caboose::Vendor => [
|
573
|
-
[ :
|
574
|
-
[ :
|
580
|
+
[ :site_id , :integer ],
|
581
|
+
[ :name , :string ],
|
582
|
+
[ :status , :string, { default: 'Active' } ]
|
575
583
|
]
|
576
584
|
}
|
577
585
|
|
@@ -2,9 +2,14 @@
|
|
2
2
|
module Caboose
|
3
3
|
class Vendor < ActiveRecord::Base
|
4
4
|
self.table_name = 'store_vendors'
|
5
|
-
|
5
|
+
|
6
|
+
belongs_to :site
|
6
7
|
has_many :products
|
7
|
-
attr_accessible :id,
|
8
|
+
attr_accessible :id,
|
9
|
+
:site_id,
|
10
|
+
:name,
|
11
|
+
:status,
|
12
|
+
:sort_order
|
8
13
|
after_save :clear_filters
|
9
14
|
|
10
15
|
def self.active
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<h1>New Vendor</h1>
|
2
2
|
|
3
|
-
<form id="new-vendor" action="/admin/vendors
|
3
|
+
<form id="new-vendor" action="/admin/vendors" method="post">
|
4
4
|
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
|
5
5
|
<input id="name" name="name" type="text" placeholder="Vendor Name" style="width: 400px" />
|
6
|
-
|
6
|
+
<div id='message'></div>
|
7
7
|
<p>
|
8
8
|
<input type="button" value="< Back" onclick="window.location='/admin/products'" />
|
9
9
|
<input type="submit" value="Add Vendor" />
|
@@ -11,24 +11,24 @@
|
|
11
11
|
</form>
|
12
12
|
|
13
13
|
<% content_for :caboose_js do %>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
});
|
31
|
-
});
|
14
|
+
<script>
|
15
|
+
$(document).ready(function() {
|
16
|
+
$('#new-vendor').on('submit', function(event) {
|
17
|
+
$('#message').html("<p class='loading'>Adding vendor...</p>");
|
18
|
+
event.preventDefault();
|
19
|
+
|
20
|
+
$.ajax({
|
21
|
+
url: '/admin/vendors',
|
22
|
+
type: 'post',
|
23
|
+
data: $('#new-vendor').serialize(),
|
24
|
+
success: function(resp) {
|
25
|
+
if (resp.error)
|
26
|
+
$('#message').html("<p class='note error'>" + resp.error + "</p>");
|
27
|
+
else if (resp.redirect)
|
28
|
+
window.location = resp.redirect;
|
29
|
+
}
|
32
30
|
});
|
33
|
-
|
31
|
+
});
|
32
|
+
});
|
33
|
+
</script>
|
34
34
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -358,10 +358,10 @@ Caboose::Engine.routes.draw do
|
|
358
358
|
|
359
359
|
get "/admin/categories" => "categories#admin_index"
|
360
360
|
get "/admin/categories/new" => "categories#admin_new"
|
361
|
-
get "/admin/categories/options" => "categories#admin_options"
|
361
|
+
get "/admin/categories/options" => "categories#admin_options"
|
362
|
+
get '/admin/categories/status-options' => 'categories#admin_status_options'
|
362
363
|
get "/admin/categories/:id" => "categories#admin_edit"
|
363
|
-
put "/admin/categories/:id" => "categories#admin_update"
|
364
|
-
get '/admin/categories/status-options' => 'categories#admin_status_options'
|
364
|
+
put "/admin/categories/:id" => "categories#admin_update"
|
365
365
|
post "/admin/categories/:id" => "categories#admin_update"
|
366
366
|
post "/admin/categories" => "categories#admin_add"
|
367
367
|
delete "/admin/categories/:id" => "categories#admin_delete"
|
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.47
|
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-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -509,7 +509,6 @@ files:
|
|
509
509
|
- app/helpers/caboose/products_helper.rb
|
510
510
|
- app/mailers/caboose/login_mailer.rb
|
511
511
|
- app/mailers/caboose/orders_mailer.rb
|
512
|
-
- app/models/caboose/#Untitled-1#
|
513
512
|
- app/models/caboose/ab_option.rb
|
514
513
|
- app/models/caboose/ab_testing.rb
|
515
514
|
- app/models/caboose/ab_value.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
caboosecms.com
|
2
|
-
swe
|
3
|
-
sweethomefoodbar.com
|
4
|
-
tuscaloosaorthopedics.com
|
5
|
-
tuscaloosarivermarket.com
|
6
|
-
sweethomefoodbaral.com
|
7
|
-
westerveltenergy.com
|
8
|
-
nine.is
|
9
|
-
parkertowing.com
|
10
|
-
arc.caboosecms.com
|
11
|
-
tuscortho.com
|
12
|
-
ninelite.com
|
13
|
-
alabamarealtorsvote.com TRUE TRUE
|
14
|
-
birminghamcorporatechallenge.com FALSE FALSE
|
15
|
-
lockerroom.caboosecms.com FALSE FALSE
|
16
|
-
groves.caboosecms.com TRUE FALSE
|