caboose-cms 0.5.68 → 0.5.69
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/assets/javascripts/caboose/model/index_table.js +6 -3
- data/app/controllers/caboose/orders_controller.rb +11 -5
- data/app/controllers/caboose/products_controller.rb +7 -4
- data/app/controllers/caboose/variants_controller.rb +39 -2
- data/app/models/caboose/order_pdf.rb +2 -2
- data/app/models/caboose/pending_orders_pdf.rb +83 -0
- data/app/models/caboose/product.rb +5 -0
- data/app/views/caboose/checkout/step_one.html.erb +1 -0
- data/app/views/caboose/orders/admin_edit.html.erb +1 -1
- data/app/views/caboose/orders/admin_index.html.erb +2 -1
- data/app/views/caboose/posts/index.html.erb +18 -7
- data/app/views/caboose/products/admin_edit_categories.html.erb +14 -10
- data/app/views/caboose/products/admin_index.html.erb +11 -3
- data/app/views/caboose/variants/admin_index.html.erb +18 -18
- data/app/views/caboose/vendors/admin_index.html.erb +8 -4
- data/config/routes.rb +3 -1
- data/lib/caboose/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTIzZWY3YjU1ZjI3NWUxNDU1ZjllNmY5OWYxOTllYzdjMGRhYWFlMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTdiNzNmMzBmN2QzM2Q5ZmY5ZTcwYjU0NTg3ZmYzYTVkNTRiYTBjZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTllMjU1YzUwZTFmYzIyMWI2YTJlNjk5OTZmZGRhODBhZTI3MzZjMjYyNWE3
|
10
|
+
MDQ3NWIyMGZjOTJlYWI2MTcwYWY5NTNhMmQ1ZTJhMzAyY2JmNjM0ZDhhODRi
|
11
|
+
ZTE0ZGMwYThhMjFjMWM4MDI3MzZiOGQzY2FiNjViYmViNWVlMmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTE0Y2U1NzE2NmIwYmY0ZjZjNGU3MDgwY2U1Mjk4MzZmNzI2MjJhZGYyODA2
|
14
|
+
MTk4MzNmN2M1NjM4ODNlZDJiMzZiZjFmMjM3YjVjYTg2ZjBlOGM2MDU0M2Uz
|
15
|
+
NWZhOGMzNjI0ZGFhNDRiZjIxMmQxMmI5NDMzNmNhMGJmN2FlM2I=
|
@@ -25,6 +25,7 @@ IndexTable.prototype = {
|
|
25
25
|
|
26
26
|
// Where to post new models
|
27
27
|
add_url: false,
|
28
|
+
after_add: 'refresh', // or 'redirect'
|
28
29
|
|
29
30
|
// Array of fields you want to show in the table (given as model binder attributes with additional text and value functions)
|
30
31
|
// [{
|
@@ -818,10 +819,12 @@ IndexTable.prototype = {
|
|
818
819
|
data: $('#new_form').serialize(),
|
819
820
|
success: function(resp) {
|
820
821
|
if (resp.error) $('#' + that.container + '_new_message').html("<p class='note error'>" + resp.error + "</p>");
|
821
|
-
if (resp.redirect
|
822
|
-
|
822
|
+
if (resp.redirect && that.after_add == 'redirect')
|
823
|
+
window.location = resp.redirect;
|
824
|
+
else if (resp.redirect || resp.refresh || resp.success)
|
825
|
+
{
|
823
826
|
that.hide_message();
|
824
|
-
that.refresh();
|
827
|
+
that.refresh();
|
825
828
|
}
|
826
829
|
}
|
827
830
|
});
|
@@ -186,14 +186,20 @@ module Caboose
|
|
186
186
|
|
187
187
|
# GET /admin/orders/:id/print
|
188
188
|
def admin_print
|
189
|
-
return if !user_is_allowed('orders', 'edit')
|
190
|
-
|
189
|
+
return if !user_is_allowed('orders', 'edit')
|
190
|
+
|
191
191
|
pdf = OrderPdf.new
|
192
192
|
pdf.order = Order.find(params[:id])
|
193
|
-
send_data pdf.to_pdf, :filename => "order_#{pdf.order.id}.pdf", :type => "application/pdf", :disposition => "inline"
|
193
|
+
send_data pdf.to_pdf, :filename => "order_#{pdf.order.id}.pdf", :type => "application/pdf", :disposition => "inline"
|
194
|
+
end
|
195
|
+
|
196
|
+
# GET /admin/orders/print-pending
|
197
|
+
def admin_print_pending
|
198
|
+
return if !user_is_allowed('orders', 'edit')
|
194
199
|
|
195
|
-
|
196
|
-
|
200
|
+
pdf = PendingOrdersPdf.new
|
201
|
+
pdf.orders = Order.where(:status => 'pending').all
|
202
|
+
send_data pdf.to_pdf, :filename => "pending_orders.pdf", :type => "application/pdf", :disposition => "inline"
|
197
203
|
end
|
198
204
|
|
199
205
|
# PUT /admin/orders/:id
|
@@ -169,7 +169,7 @@ module Caboose
|
|
169
169
|
})
|
170
170
|
|
171
171
|
# Make a copy of all the items; so it can be filtered more
|
172
|
-
@all_products = @gen.all_records
|
172
|
+
@all_products = @gen.all_records
|
173
173
|
|
174
174
|
# Apply any extra filters
|
175
175
|
if params[:filters]
|
@@ -177,6 +177,7 @@ module Caboose
|
|
177
177
|
@all_products = @all_products.where('vendor_id IS NULL') if params[:filters][:no_vendor]
|
178
178
|
end
|
179
179
|
|
180
|
+
|
180
181
|
# Get the correct page of the results
|
181
182
|
@products = @all_products.limit(@gen.limit).offset(@gen.offset)
|
182
183
|
@category_options = Category.options(@site.id)
|
@@ -194,7 +195,8 @@ module Caboose
|
|
194
195
|
pager = Caboose::PageBarGenerator.new(params, {
|
195
196
|
'site_id' => @site.id,
|
196
197
|
'vendor_name' => '',
|
197
|
-
'search_like' => '',
|
198
|
+
'search_like' => '',
|
199
|
+
'category_id' => '',
|
198
200
|
'price' => params[:filters] && params[:filters][:missing_prices] ? 0 : ''
|
199
201
|
}, {
|
200
202
|
'model' => 'Caboose::Product',
|
@@ -207,8 +209,9 @@ module Caboose
|
|
207
209
|
'search_like' => 'store_products.title_concat_vendor_name_like'
|
208
210
|
},
|
209
211
|
'includes' => {
|
210
|
-
'
|
211
|
-
'
|
212
|
+
'category_id' => [ 'categories' , 'id' ],
|
213
|
+
'vendor_name' => [ 'vendor' , 'name' ],
|
214
|
+
'price' => [ 'variants' , 'price' ]
|
212
215
|
}
|
213
216
|
})
|
214
217
|
render :json => {
|
@@ -293,7 +293,8 @@ module Caboose
|
|
293
293
|
v.price = '%.2f' % params[:price].strip.to_f
|
294
294
|
v.option1 = params[:option1] if p.option1
|
295
295
|
v.option2 = params[:option2] if p.option2
|
296
|
-
v.option3 = params[:option3] if p.option3
|
296
|
+
v.option3 = params[:option3] if p.option3
|
297
|
+
v.status = 'Active'
|
297
298
|
v.save
|
298
299
|
|
299
300
|
resp.success = true
|
@@ -328,7 +329,8 @@ module Caboose
|
|
328
329
|
v.price = '%.2f' % row[2].strip.to_f
|
329
330
|
v.option1 = row[3] if p.option1
|
330
331
|
v.option2 = row[4] if p.option2
|
331
|
-
v.option3 = row[5] if p.option3
|
332
|
+
v.option3 = row[5] if p.option3
|
333
|
+
v.status = 'Active'
|
332
334
|
v.save
|
333
335
|
end
|
334
336
|
resp.success = true
|
@@ -337,6 +339,41 @@ module Caboose
|
|
337
339
|
render :json => resp
|
338
340
|
end
|
339
341
|
|
342
|
+
# PUT /admin/products/:product_id/variants/bulk
|
343
|
+
def admin_bulk_update
|
344
|
+
return unless user_is_allowed_to 'edit', 'sites'
|
345
|
+
|
346
|
+
resp = Caboose::StdClass.new
|
347
|
+
variants = params[:model_ids].collect{ |variant_id| Variant.find(variant_id) }
|
348
|
+
|
349
|
+
save = true
|
350
|
+
params.each do |k,value|
|
351
|
+
case k
|
352
|
+
when 'alternate_id' then variants.each { |v| v.alternate_id = value }
|
353
|
+
when 'sku' then variants.each { |v| v.sku = value }
|
354
|
+
when 'barcode' then variants.each { |v| v.barcode = value }
|
355
|
+
when 'price' then variants.each { |v| v.price = value }
|
356
|
+
when 'quantity_in_stock' then variants.each { |v| v.quantity_in_stock = value }
|
357
|
+
when 'ignore_quantity' then variants.each { |v| v.ignore_quantity = value }
|
358
|
+
when 'allow_backorder' then variants.each { |v| v.allow_backorder = value }
|
359
|
+
when 'status' then variants.each { |v| v.status = value }
|
360
|
+
when 'weight' then variants.each { |v| v.weight = value }
|
361
|
+
when 'length' then variants.each { |v| v.length = value }
|
362
|
+
when 'width' then variants.each { |v| v.width = value }
|
363
|
+
when 'height' then variants.each { |v| v.height = value }
|
364
|
+
when 'option1' then variants.each { |v| v.option1 = value }
|
365
|
+
when 'option2' then variants.each { |v| v.option2 = value }
|
366
|
+
when 'option3' then variants.each { |v| v.option3 = value }
|
367
|
+
when 'requires_shipping' then variants.each { |v| v.requires_shipping = value }
|
368
|
+
when 'taxable' then variants.each { |v| v.taxable = value }
|
369
|
+
end
|
370
|
+
end
|
371
|
+
variants.each{ |v| v.save }
|
372
|
+
|
373
|
+
resp.success = true
|
374
|
+
render :json => resp
|
375
|
+
end
|
376
|
+
|
340
377
|
# POST /admin/products/:product_id/variants/remove
|
341
378
|
def admin_remove_variants
|
342
379
|
params[:variant_ids].each do |variant_id|
|
@@ -6,7 +6,7 @@ module Caboose
|
|
6
6
|
attr_accessor :order
|
7
7
|
|
8
8
|
def to_pdf
|
9
|
-
image open("https://dmwwflw4i3miv.cloudfront.net/logo.png"), :position => :center
|
9
|
+
#image open("https://dmwwflw4i3miv.cloudfront.net/logo.png"), :position => :center
|
10
10
|
text " "
|
11
11
|
customer_info
|
12
12
|
text " "
|
@@ -68,7 +68,7 @@ module Caboose
|
|
68
68
|
end
|
69
69
|
tbl << [{ :content => "Subtotal" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.subtotal ) , :align => :right }]
|
70
70
|
tbl << [{ :content => "Tax" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
|
71
|
-
tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
|
71
|
+
#tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
|
72
72
|
tbl << [{ :content => "Discount" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
|
73
73
|
tbl << [{ :content => "Total" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.total ) , :align => :right }]
|
74
74
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'prawn'
|
2
|
+
|
3
|
+
module Caboose
|
4
|
+
class PendingOrdersPdf < Prawn::Document
|
5
|
+
|
6
|
+
attr_accessor :orders
|
7
|
+
attr_accessor :order
|
8
|
+
|
9
|
+
def to_pdf
|
10
|
+
#image open("https://dmwwflw4i3miv.cloudfront.net/logo.png"), :position => :center
|
11
|
+
text " "
|
12
|
+
self.orders.each_with_index do |o, i|
|
13
|
+
start_new_page if i > 0
|
14
|
+
self.order = o
|
15
|
+
customer_info
|
16
|
+
text " "
|
17
|
+
order_table
|
18
|
+
end
|
19
|
+
render
|
20
|
+
end
|
21
|
+
|
22
|
+
def customer_info
|
23
|
+
|
24
|
+
order_info = "Order ##{self.order.id}\n"
|
25
|
+
order_info << "Status: #{self.order.status.capitalize}\n"
|
26
|
+
order_info << "Received: #{self.order.date_created ? self.order.date_created.strftime("%m/%d/%Y") : ''}\n"
|
27
|
+
if order.status == 'shipped' && self.order.date_shipped
|
28
|
+
order_info << "Shipped: #{self.order.date_shipped.strftime("%m/%d/%Y")}"
|
29
|
+
end
|
30
|
+
|
31
|
+
c = self.order.customer
|
32
|
+
billed_to = c ? "#{c.first_name} #{c.last_name}\n#{c.email}\n#{c.phone}" : ''
|
33
|
+
|
34
|
+
sa = self.order.shipping_address
|
35
|
+
shipped_to = "#{sa.name}\n#{sa.address1}\n"
|
36
|
+
shipped_to << "#{sa.address2}\n" if sa.address2 && sa.address2.strip.length > 0
|
37
|
+
shipped_to << "#{sa.city}, #{sa.state} #{sa.zip}"
|
38
|
+
|
39
|
+
tbl = []
|
40
|
+
tbl << [
|
41
|
+
{ :content => "Order Info" , :align => :center, :valign => :bottom, :width => 180 },
|
42
|
+
{ :content => "Billed To" , :align => :center, :valign => :bottom, :width => 180 },
|
43
|
+
{ :content => "Shipped To" , :align => :center, :valign => :bottom, :width => 180 }
|
44
|
+
]
|
45
|
+
tbl << [
|
46
|
+
{ :content => order_info, :valign => :top, :height => 75 },
|
47
|
+
{ :content => billed_to , :valign => :top, :height => 75 },
|
48
|
+
{ :content => shipped_to, :valign => :top, :height => 75 }
|
49
|
+
]
|
50
|
+
table tbl
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def order_table
|
55
|
+
|
56
|
+
tbl = []
|
57
|
+
tbl << [
|
58
|
+
{ :content => "Item" , :align => :center, :valign => :bottom },
|
59
|
+
{ :content => "Tracking Number" , :align => :center, :valign => :bottom },
|
60
|
+
{ :content => "Unit Price" , :align => :center, :valign => :bottom },
|
61
|
+
{ :content => "Quantity" , :align => :center, :valign => :bottom },
|
62
|
+
{ :content => "Subtotal" , :align => :center, :valign => :bottom, :width => 60 }
|
63
|
+
]
|
64
|
+
|
65
|
+
order.line_items.each do |li|
|
66
|
+
tbl << [
|
67
|
+
"#{li.variant.product.title}\n#{li.variant.sku}\n#{li.variant.title}",
|
68
|
+
{ :content => li.tracking_number },
|
69
|
+
{ :content => sprintf("%.2f", li.variant.price) , :align => :right },
|
70
|
+
{ :content => "#{li.quantity}" , :align => :right },
|
71
|
+
{ :content => sprintf("%.2f", li.subtotal) , :align => :right }
|
72
|
+
]
|
73
|
+
end
|
74
|
+
tbl << [{ :content => "Subtotal" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.subtotal ) , :align => :right }]
|
75
|
+
tbl << [{ :content => "Tax" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
|
76
|
+
#tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
|
77
|
+
tbl << [{ :content => "Discount" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
|
78
|
+
tbl << [{ :content => "Total" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.total ) , :align => :right }]
|
79
|
+
|
80
|
+
table tbl
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -87,6 +87,11 @@ module Caboose
|
|
87
87
|
self.variants.where('price > ? AND status != ?', 0, 'Deleted').order('price ASC').first
|
88
88
|
end
|
89
89
|
|
90
|
+
def first_tiny_image_url
|
91
|
+
return '' if self.product_images.count == 0
|
92
|
+
return self.product_images.first.image.url(:tiny)
|
93
|
+
end
|
94
|
+
|
90
95
|
def featured_image
|
91
96
|
self.product_images.reject{|p| p.nil?}.first
|
92
97
|
end
|
@@ -29,6 +29,7 @@
|
|
29
29
|
<p><input name="phone" type="text" placeholder="Phone" /></p>
|
30
30
|
<p><input name="pass1" type="password" placeholder="Password" /></p>
|
31
31
|
<p><input name="pass2" type="password" placeholder="Confirm Password" /></p>
|
32
|
+
<p><input name='newsletter' id='newsletter' type='checkbox' value='1' /> <label for='newsletter'>Send me updates on new products and special deals</label></p>
|
32
33
|
<p><input type="submit" value="Continue" /></p>
|
33
34
|
</form>
|
34
35
|
</div>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<% end %>
|
19
19
|
<input type='button' value='Resend Confirmation' onclick="resend_confirmation(<%= @order.id %>)" />
|
20
20
|
<input type='button' value='Add Item' onclick="controller.add_variant();" />
|
21
|
-
<input type='button' value='Print Order' onclick="print_order(<%= @order.id %>);" />
|
21
|
+
<input type='button' value='Print Order' onclick="controller.print_order(<%= @order.id %>);" />
|
22
22
|
|
23
23
|
<% str = Caboose.plugin_hook('admin_edit_order_buttons', "", @order) %>
|
24
24
|
<% if str %><%= raw str %><% end %>
|
@@ -6,7 +6,8 @@
|
|
6
6
|
|
7
7
|
<p>
|
8
8
|
<a href='#' onclick="$('#search_form').toggle(400, function() { modal.autosize(); });">Show/hide search form</a> |
|
9
|
-
<a href='/admin/orders/new'>New Manual Order</a>
|
9
|
+
<a href='/admin/orders/new'>New Manual Order</a> |
|
10
|
+
<a href='/admin/orders/print-pending' target='_blank'>Print Pending Orders</a>
|
10
11
|
</p>
|
11
12
|
<form action='/admin/orders' method='get' id='search_form' style='display: none;'>
|
12
13
|
<p><input type='text' name='id' placeholder='Order ID' value="<%= @pager.params['id'] %>" style='width: 100px;' /></p>
|
@@ -3,16 +3,27 @@
|
|
3
3
|
<% if @posts && @posts.count > 0 %>
|
4
4
|
<ul>
|
5
5
|
<% @posts.each do |p| %>
|
6
|
-
<li>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<
|
6
|
+
<li class='clearfix'>
|
7
|
+
<% if p.image && !p.image.url.include?('placehold.it') %>
|
8
|
+
<figure><a href="/posts/<%= p.id %>"><img src="<%= p.image.url(:thumb) %>" /></a></figure>
|
9
|
+
<% end %>
|
10
|
+
<h5><strong><%= raw p[:title] %></strong></h5>
|
11
|
+
<p class="h-space-mvt"><%= p[:created_at].strftime("%m/%d/%Y") %></p>
|
12
|
+
<p class="h-space-mbt"><%= raw Caboose.teaser_text(p[:body], 200) %></p>
|
13
|
+
<a class="m-btn-red h-space-mts" href="/posts/<%= p.id %>">Read More</a>
|
12
14
|
</li>
|
13
15
|
<% end %>
|
14
16
|
</ul>
|
15
17
|
<% else %>
|
16
18
|
<p>There are no posts right now.</p>
|
17
19
|
<% end %>
|
18
|
-
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% content_for :caboose_css do %>
|
23
|
+
<style type='text/css'>
|
24
|
+
|
25
|
+
.posts li { min-height: 200px; }
|
26
|
+
.posts li figure { float: right; margin: 0 0 20px 10px; }
|
27
|
+
|
28
|
+
</style>
|
29
|
+
<% end %>
|
@@ -9,12 +9,9 @@ p = @product
|
|
9
9
|
|
10
10
|
<% content_for :caboose_css do %>
|
11
11
|
<style type='text/css'>
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
15
|
-
#categories li { list-style: none; }
|
16
|
-
#categories h3 { margin: 0; padding: 0; font-weight: bold; display: inline; }
|
17
|
-
#categories td { padding: 10px; }
|
12
|
+
#content table.data input[type='checkbox'] { position: relative; margin: 0; padding: 0; }
|
13
|
+
#content table.data td { padding: 0 10px !important; }
|
14
|
+
label span.prefix { display: inline-block; margin: 0 8px; }
|
18
15
|
</style>
|
19
16
|
<% end %>
|
20
17
|
<% content_for :caboose_js do %>
|
@@ -33,11 +30,18 @@ $(document).ready(function() {
|
|
33
30
|
nice_name: 'Categories',
|
34
31
|
type: 'checkbox-multiple',
|
35
32
|
options_url: '/admin/categories/options',
|
36
|
-
value: <%= raw Caboose.json(p.categories.collect{ |cat| cat.id }) %>,
|
33
|
+
value: <%= raw Caboose.json(p.categories.collect{ |cat| cat.id }) %>,
|
37
34
|
fixed_placeholder: false,
|
38
|
-
width: 400
|
39
|
-
}
|
40
|
-
]
|
35
|
+
width: 400
|
36
|
+
}
|
37
|
+
],
|
38
|
+
on_load: function() {
|
39
|
+
setTimeout(function() {
|
40
|
+
$('label').each(function(i, el) {
|
41
|
+
$(el).html($(el).html().replace(/-/g, "<span class='prefix'>-</span>"));
|
42
|
+
});
|
43
|
+
}, 400);
|
44
|
+
}
|
41
45
|
});
|
42
46
|
});
|
43
47
|
|
@@ -8,9 +8,9 @@
|
|
8
8
|
|
9
9
|
<form action="/admin/products" method="get" id="search_form" style="margin: 0 0 12px">
|
10
10
|
<p><input type="text" name="search_like" placeholder="Title or Vendor Name" value="<%= params[:search_like] %>" style="width: 350px" /></p>
|
11
|
-
<p><select type="text" name="category_id" placeholder="Category"
|
11
|
+
<p><select type="text" name="category_id" placeholder="Category" style="width: 350px">
|
12
12
|
<option value=''>-- Category --</option>
|
13
|
-
<% @category_options.each do |cat| %><option value="<%= cat[:value] %>"<% if cat[:value] == params[:category_id] %> selected='true'<% end %>><%= cat[:text] %></option><% end %>
|
13
|
+
<% @category_options.each do |cat| %><option value="<%= cat[:value] %>"<% if cat[:value].to_i == params[:category_id].to_i %> selected='true'<% end %>><%= cat[:text] %></option><% end %>
|
14
14
|
</select></p>
|
15
15
|
<p>
|
16
16
|
<input type="submit" value="Search" />
|
@@ -24,6 +24,12 @@
|
|
24
24
|
<%= javascript_include_tag 'caboose/model/all' %>
|
25
25
|
<script type='text/javascript'>
|
26
26
|
|
27
|
+
function tiny_product_image(p) {
|
28
|
+
if (p.images.length == 0) return '';
|
29
|
+
if (p.images[0].urls.length == 0) return '';
|
30
|
+
return "<img src='" + p.images[0].urls['tiny'] + "' />";
|
31
|
+
}
|
32
|
+
|
27
33
|
$(document).ready(function() {
|
28
34
|
var that = this;
|
29
35
|
var table = new IndexTable({
|
@@ -34,8 +40,10 @@ $(document).ready(function() {
|
|
34
40
|
allow_bulk_delete: true,
|
35
41
|
allow_duplicate: false,
|
36
42
|
allow_advanced_edit: true,
|
37
|
-
|
43
|
+
after_add: 'redirect',
|
44
|
+
fields: [
|
38
45
|
{ show: true , name: 'id' , nice_name: 'ID' , sort: 'id' , type: 'text' , value: function(p) { return p.id }, width: 500, editable: false },
|
46
|
+
{ show: true , name: 'image' , nice_name: 'Image' , sort: 'id' , type: 'image' , value: tiny_product_image, width: 500, editable: false },
|
39
47
|
{ show: true , name: 'title' , nice_name: 'Title' , sort: 'title' , type: 'text' , value: function(p) { return p.title }, width: 200 },
|
40
48
|
{ show: true , name: 'caption' , nice_name: 'Caption' , sort: 'caption' , type: 'text' , value: function(p) { return p.caption }, width: 200 },
|
41
49
|
{ show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'select' , value: function(p) { return p.status }, width: 200, options_url: '/admin/products/status-options' },
|
@@ -60,28 +60,28 @@ $(document).ready(function() {
|
|
60
60
|
form_authenticity_token: '<%= form_authenticity_token %>',
|
61
61
|
container: 'variants',
|
62
62
|
base_url: '/admin/products/<%= p.id %>/variants',
|
63
|
-
allow_bulk_edit:
|
63
|
+
allow_bulk_edit: true,
|
64
64
|
allow_bulk_delete: true,
|
65
65
|
allow_duplicate: false,
|
66
66
|
allow_advanced_edit: true,
|
67
67
|
fields: [
|
68
|
-
<% if p.option1 %>{ show: true , name: 'option1'
|
69
|
-
<% if p.option2 %>{ show: true , name: 'option2'
|
70
|
-
<% if p.option3 %>{ show: true , name: 'option3'
|
71
|
-
{ show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' },
|
72
|
-
{ show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 75, align: 'left' },
|
73
|
-
{ show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' },
|
74
|
-
{ show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' },
|
75
|
-
{ show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' },
|
76
|
-
{ show: true , name: 'quantity_in_stock' , nice_name: 'Quantity' , sort: 'quantity_in_stock' , type: 'text' , value: function(v) { return v.quantity_in_stock }, width: 50, align: 'right' },
|
77
|
-
{ show: false , name: 'weight' , nice_name: 'Weight (grams)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' },
|
78
|
-
{ show: false , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' },
|
79
|
-
{ show: false , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' },
|
80
|
-
{ show: false , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' },
|
81
|
-
{ show: false , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, width: 50, align: 'center' },
|
82
|
-
{ show: false , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, width: 50, align: 'center' },
|
83
|
-
{ show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, width: 50, align: 'center' },
|
84
|
-
{ show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, width: 50, align: 'center' }
|
68
|
+
<% if p.option1 %>{ show: true , name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , sort: 'option1' , type: 'text' , value: function(v) { return v.option1 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
|
69
|
+
<% if p.option2 %>{ show: true , name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , sort: 'option2' , type: 'text' , value: function(v) { return v.option2 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
|
70
|
+
<% if p.option3 %>{ show: true , name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , sort: 'option3' , type: 'text' , value: function(v) { return v.option3 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
|
71
|
+
{ show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' , bulk_edit: true },
|
72
|
+
{ show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 75, align: 'left' , bulk_edit: true },
|
73
|
+
{ show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' , bulk_edit: true },
|
74
|
+
{ show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' , bulk_edit: true },
|
75
|
+
{ show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' , bulk_edit: true },
|
76
|
+
{ show: true , name: 'quantity_in_stock' , nice_name: 'Quantity' , sort: 'quantity_in_stock' , type: 'text' , value: function(v) { return v.quantity_in_stock }, width: 50, align: 'right' , bulk_edit: true },
|
77
|
+
{ show: false , name: 'weight' , nice_name: 'Weight (grams)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' , bulk_edit: true },
|
78
|
+
{ show: false , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' , bulk_edit: true },
|
79
|
+
{ show: false , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' , bulk_edit: true },
|
80
|
+
{ show: false , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' , bulk_edit: true },
|
81
|
+
{ show: false , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, width: 50, align: 'center' , bulk_edit: true },
|
82
|
+
{ show: false , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, width: 50, align: 'center' , bulk_edit: true },
|
83
|
+
{ show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, width: 50, align: 'center' , bulk_edit: true },
|
84
|
+
{ show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, width: 50, align: 'center' , bulk_edit: true }
|
85
85
|
],
|
86
86
|
new_model_text: 'New Variant',
|
87
87
|
new_model_fields: [
|
@@ -8,20 +8,24 @@
|
|
8
8
|
</form>
|
9
9
|
|
10
10
|
<% if @vendors.count > 0 %>
|
11
|
-
<table class="data"
|
11
|
+
<table class="data">
|
12
12
|
<tr>
|
13
13
|
<%= raw @pager.sortable_table_headings({
|
14
|
-
'id'
|
15
|
-
'name'
|
16
|
-
'
|
14
|
+
'id' => 'ID',
|
15
|
+
'id,name' => 'Image',
|
16
|
+
'name' => 'Name',
|
17
|
+
'status' => 'Status',
|
18
|
+
'featured' => 'Featured',
|
17
19
|
}) %>
|
18
20
|
</tr>
|
19
21
|
|
20
22
|
<% @vendors.each do |vendor| %>
|
21
23
|
<tr onclick="window.location='/admin/vendors/<%= vendor.id %>';">
|
22
24
|
<td style="text-align: center"><%= raw vendor.id %></td>
|
25
|
+
<td><% if vendor.image %><img src='<%= raw vendor.image.url(:tiny) %>' /><% else %> <% end %></td>
|
23
26
|
<td><%= raw vendor.name %></td>
|
24
27
|
<td><%= raw vendor.status %></td>
|
28
|
+
<td><%= vendor.featured ? 'Yes' : 'No' %></td>
|
25
29
|
</tr>
|
26
30
|
<% end %>
|
27
31
|
</table>
|
data/config/routes.rb
CHANGED
@@ -403,10 +403,11 @@ Caboose::Engine.routes.draw do
|
|
403
403
|
put "/admin/products/:product_id/variants/:id/attach-to-image" => "variants#admin_attach_to_image"
|
404
404
|
put "/admin/products/:product_id/variants/:id/unattach-from-image" => "variants#admin_unattach_from_image"
|
405
405
|
get "/admin/products/:product_id/variants/:id" => "variants#admin_edit"
|
406
|
+
put '/admin/products/:product_id/variants/bulk' => 'variants#admin_bulk_update'
|
406
407
|
put "/admin/products/:product_id/variants/:id" => "variants#admin_update"
|
407
408
|
get "/admin/products/:product_id/variants/new" => "variants#admin_new"
|
408
409
|
post '/admin/products/:product_id/variants/bulk' => 'variants#admin_bulk_add'
|
409
|
-
post "/admin/products/:product_id/variants" => "variants#admin_add"
|
410
|
+
post "/admin/products/:product_id/variants" => "variants#admin_add"
|
410
411
|
delete '/admin/products/:product_id/variants/bulk' => 'variants#admin_bulk_delete'
|
411
412
|
delete "/admin/products/:product_id/variants/:id" => "variants#admin_delete"
|
412
413
|
get "/admin/variants/status-options" => "variants#admin_status_options"
|
@@ -467,6 +468,7 @@ Caboose::Engine.routes.draw do
|
|
467
468
|
get "/admin/orders/test-gmail" => "orders#admin_mail_test_gmail"
|
468
469
|
get "/admin/orders/status-options" => "orders#admin_status_options"
|
469
470
|
get "/admin/orders/new" => "orders#admin_new"
|
471
|
+
get "/admin/orders/print-pending" => "orders#admin_print_pending"
|
470
472
|
get "/admin/orders/:id/capture" => "orders#capture_funds"
|
471
473
|
get "/admin/orders/:id/json" => "orders#admin_json"
|
472
474
|
get "/admin/orders/:id/print" => "orders#admin_print"
|
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.69
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -586,6 +586,7 @@ files:
|
|
586
586
|
- app/models/caboose/payment_processors/authorizenet.rb
|
587
587
|
- app/models/caboose/payment_processors/base.rb
|
588
588
|
- app/models/caboose/payment_processors/payscape.rb
|
589
|
+
- app/models/caboose/pending_orders_pdf.rb
|
589
590
|
- app/models/caboose/permanent_redirect.rb
|
590
591
|
- app/models/caboose/permission.rb
|
591
592
|
- app/models/caboose/post.rb
|