caboose-cms 0.9.6 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/caboose/invoices_controller.rb +4 -2
- data/app/controllers/caboose/my_account_invoices_controller.rb +15 -0
- data/app/controllers/caboose/vendors_controller.rb +9 -9
- data/app/models/caboose/core_plugin.rb +1 -1
- data/app/models/caboose/invoice_pdf.rb +21 -3
- data/app/models/caboose/schema.rb +2 -1
- data/app/models/caboose/store_config.rb +2 -1
- data/app/views/caboose/my_account_invoices/edit.html.erb +4 -1
- data/app/views/caboose/vendors/admin_edit.html.erb +5 -5
- data/app/views/caboose/vendors/admin_index.html.erb +3 -3
- data/app/views/caboose/vendors/admin_new.html.erb +3 -3
- data/lib/caboose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98b08e4c257fd3373839e4de959db0931d3785c
|
4
|
+
data.tar.gz: 822ea095f72aebd54c20c8c6552e28b0df7cca24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82006d6ddc689439f838c6c471c3a6a994341c801af00b7fd8f61932a41e453af824e4562a3488a1e31b67f8f4930215dcd9eb16be9baf64742023802fc35c02
|
7
|
+
data.tar.gz: d239512ce0344384b4a09d602d0ce9bdeb488e9201394dc5084a4773bfb34f29db94cf998571e63ba18220dedd4e334925c2c53ad004a0d38eb84ef6f9b189a2
|
@@ -51,7 +51,7 @@ module Caboose
|
|
51
51
|
resp.invoice_transactions = invoice.invoice_transactions.reorder(:date_processed).all
|
52
52
|
|
53
53
|
render :json => resp
|
54
|
-
|
54
|
+
ends
|
55
55
|
|
56
56
|
# @route GET /admin/invoices/new
|
57
57
|
def admin_new
|
@@ -198,7 +198,9 @@ module Caboose
|
|
198
198
|
def admin_print
|
199
199
|
return if !user_is_allowed('invoices', 'edit')
|
200
200
|
|
201
|
-
pdf =
|
201
|
+
pdf = @site.store_config.custom_invoice_pdf
|
202
|
+
pdf = "InvoicePdf" if pdf.nil? || pdf.strip.length == 0
|
203
|
+
eval("pdf = #{pdf}.new")
|
202
204
|
pdf.invoice = Invoice.find(params[:id])
|
203
205
|
send_data pdf.to_pdf, :filename => "invoice_#{pdf.invoice.id}.pdf", :type => "application/pdf", :disposition => "inline"
|
204
206
|
end
|
@@ -165,6 +165,21 @@ module Caboose
|
|
165
165
|
:invoice_transactions
|
166
166
|
])
|
167
167
|
end
|
168
|
+
|
169
|
+
# @route GET /my-account/invoices/:id/print
|
170
|
+
def invoice_pdf
|
171
|
+
invoice = Invoice.find(params[:id])
|
172
|
+
|
173
|
+
if invoice.customer_id != logged_in_user.id
|
174
|
+
@error = "The given invoice does not belong to you."
|
175
|
+
render :file => 'caboose/extras/error'
|
176
|
+
return
|
177
|
+
end
|
178
|
+
|
179
|
+
pdf = InvoicePdf.new
|
180
|
+
pdf.invoice = Invoice.find(params[:id])
|
181
|
+
send_data pdf.to_pdf, :filename => "invoice_#{pdf.invoice.id}.pdf", :type => "application/pdf", :disposition => "inline"
|
182
|
+
end
|
168
183
|
|
169
184
|
# @route GET /my-account/invoices/authnet-relay
|
170
185
|
# @route POST /my-account/invoices/authnet-relay
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Caboose
|
2
2
|
class VendorsController < Caboose::ApplicationController
|
3
3
|
|
4
|
-
# @route GET /admin/vendors/:id
|
4
|
+
# @route GET /admin/store/vendors/:id
|
5
5
|
def admin_edit
|
6
6
|
return if !user_is_allowed('vendors', 'edit')
|
7
7
|
@vendor = Vendor.find(params[:id])
|
8
8
|
render :layout => 'caboose/admin'
|
9
9
|
end
|
10
10
|
|
11
|
-
# @route GET /admin/vendors
|
11
|
+
# @route GET /admin/store/vendors
|
12
12
|
def admin_index
|
13
13
|
return if !user_is_allowed('vendors', 'view')
|
14
14
|
|
@@ -30,13 +30,13 @@ module Caboose
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# @route_priority 3
|
33
|
-
# @route GET /admin/vendors/new
|
33
|
+
# @route GET /admin/store/vendors/new
|
34
34
|
def admin_new
|
35
35
|
return if !user_is_allowed('vendors', 'add')
|
36
36
|
render :layout => 'caboose/admin'
|
37
37
|
end
|
38
38
|
|
39
|
-
# @route POST /admin/vendors/:id/image
|
39
|
+
# @route POST /admin/store/vendors/:id/image
|
40
40
|
def admin_update_image
|
41
41
|
return if !user_is_allowed('vendors', 'edit')
|
42
42
|
|
@@ -50,7 +50,7 @@ module Caboose
|
|
50
50
|
render :json => resp
|
51
51
|
end
|
52
52
|
|
53
|
-
# @route PUT /admin/vendors/:id/update
|
53
|
+
# @route PUT /admin/store/vendors/:id/update
|
54
54
|
def admin_update
|
55
55
|
return if !user_is_allowed('vendors', 'edit')
|
56
56
|
vendor = Vendor.find(params[:id])
|
@@ -67,7 +67,7 @@ module Caboose
|
|
67
67
|
render :json => { :success => vendor.save }
|
68
68
|
end
|
69
69
|
|
70
|
-
# @route POST /admin/vendors
|
70
|
+
# @route POST /admin/store/vendors
|
71
71
|
def admin_add
|
72
72
|
return if !user_is_allowed('vendors', 'add')
|
73
73
|
|
@@ -81,7 +81,7 @@ module Caboose
|
|
81
81
|
render :json => { :success => vendor.save, :redirect => "/admin/vendors/#{vendor.id}" }
|
82
82
|
end
|
83
83
|
|
84
|
-
# @route DELETE /admin/vendors/:id
|
84
|
+
# @route DELETE /admin/store/vendors/:id
|
85
85
|
def admin_delete
|
86
86
|
return if !user_is_allowed('vendors', 'delete')
|
87
87
|
v = Vendor.find(params[:id])
|
@@ -94,13 +94,13 @@ module Caboose
|
|
94
94
|
end
|
95
95
|
|
96
96
|
# @route_priority 1
|
97
|
-
# @route GET /admin/vendors/options
|
97
|
+
# @route GET /admin/store/vendors/options
|
98
98
|
def options
|
99
99
|
render :json => Vendor.where(:site_id => @site.id).reorder(:name).all.collect{ |v| { :value => v.id, :text => v.name }}
|
100
100
|
end
|
101
101
|
|
102
102
|
# @route_priority 2
|
103
|
-
# @route GET /admin/vendors/status-options
|
103
|
+
# @route GET /admin/store/vendors/status-options
|
104
104
|
def status_options
|
105
105
|
render :json => [
|
106
106
|
{ :text => 'Active' , :value => 'Active' },
|
@@ -39,7 +39,7 @@ class Caboose::CorePlugin < Caboose::CaboosePlugin
|
|
39
39
|
item['children'] << { 'id' => 'invoices' , 'href' => '/admin/invoices' , 'text' => 'Invoices' , 'modal' => false } if user.is_allowed('invoices' , 'view')
|
40
40
|
item['children'] << { 'id' => 'products' , 'href' => '/admin/products' , 'text' => 'Products' , 'modal' => false } if user.is_allowed('products' , 'view')
|
41
41
|
item['children'] << { 'id' => 'shippingpackages' , 'href' => '/admin/shipping-packages' , 'text' => 'Shipping Packages' , 'modal' => false } if user.is_allowed('shippingpackages' , 'view')
|
42
|
-
item['children'] << { 'id' => 'vendors' , 'href' => '/admin/vendors'
|
42
|
+
item['children'] << { 'id' => 'vendors' , 'href' => '/admin/store/vendors' , 'text' => 'Vendors' , 'modal' => false } if user.is_allowed('vendors' , 'view')
|
43
43
|
nav << item if item['children'].count > 0
|
44
44
|
end
|
45
45
|
|
@@ -14,9 +14,8 @@ module Caboose
|
|
14
14
|
font_size 9
|
15
15
|
|
16
16
|
img = open("http://cabooseit.s3.amazonaws.com/uploads/template.jpg")
|
17
|
-
|
18
|
-
|
19
|
-
#image open("https://dmwwflw4i3miv.cloudfront.net/logo.png"), :position => :center
|
17
|
+
|
18
|
+
header_info
|
20
19
|
move_down 10
|
21
20
|
invoice_info
|
22
21
|
move_down 15
|
@@ -28,6 +27,9 @@ module Caboose
|
|
28
27
|
render
|
29
28
|
end
|
30
29
|
|
30
|
+
def header_info
|
31
|
+
end
|
32
|
+
|
31
33
|
def formatted_phone(str)
|
32
34
|
return '' if str.nil?
|
33
35
|
str = str.gsub(/[^0-9]/i, '')
|
@@ -52,6 +54,8 @@ module Caboose
|
|
52
54
|
sc = self.invoice.site.store_config
|
53
55
|
ot = self.invoice.invoice_transactions.where(:transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first
|
54
56
|
|
57
|
+
return unless ot
|
58
|
+
|
55
59
|
case ot.payment_processor
|
56
60
|
when StoreConfig::PAYMENT_PROCESSOR_AUTHNET
|
57
61
|
|
@@ -82,6 +86,18 @@ module Caboose
|
|
82
86
|
invoice_info = "Invoice Number: #{invoice.invoice_number}\n"
|
83
87
|
invoice_info << "Invoice Date: #{invoice.date_created.strftime('%d %b %Y %H:%M:%S %p')}\n"
|
84
88
|
invoice_info << "Status: #{invoice.status.capitalize}\n"
|
89
|
+
|
90
|
+
if invoice.status == Invoice::STATUS_PENDING
|
91
|
+
s = self.invoice.site
|
92
|
+
sc = self.invoice.site.store_config
|
93
|
+
invoice_info << "\n"
|
94
|
+
invoice_info << "Please mail payments to:\n"
|
95
|
+
invoice_info << "#{s.description}\n"
|
96
|
+
invoice_info << "#{sc.origin_address1}\n"
|
97
|
+
invoice_info << "#{sc.origin_address2}\n"
|
98
|
+
invoice_info << "#{sc.origin_city}, " << "#{sc.origin_state} " << "#{sc.origin_zip}\n"
|
99
|
+
end
|
100
|
+
|
85
101
|
tbl = []
|
86
102
|
tbl << [
|
87
103
|
{ :content => invoice_info }
|
@@ -92,6 +108,7 @@ module Caboose
|
|
92
108
|
|
93
109
|
|
94
110
|
def customer_info
|
111
|
+
return if self.invoice.status == Invoice::STATUS_PENDING
|
95
112
|
|
96
113
|
c = invoice.customer
|
97
114
|
|
@@ -254,6 +271,7 @@ module Caboose
|
|
254
271
|
end
|
255
272
|
|
256
273
|
def payment_info
|
274
|
+
return if self.invoice.status == Invoice::STATUS_PENDING
|
257
275
|
|
258
276
|
trans = invoice.invoice_transactions.where(:transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first
|
259
277
|
tbl = []
|
@@ -841,7 +841,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
841
841
|
[ :default_vendor_id , :integer ],
|
842
842
|
[ :default_product_status , :string ],
|
843
843
|
[ :default_taxable , :boolean ],
|
844
|
-
[ :allow_instore_pickup , :boolean , { :default => false }]
|
844
|
+
[ :allow_instore_pickup , :boolean , { :default => false }],
|
845
|
+
[ :custom_invoice_pdf , :string ]
|
845
846
|
],
|
846
847
|
Caboose::Subscription => [
|
847
848
|
[ :variant_id , :integer ],
|
@@ -12,7 +12,10 @@ store_config = @invoice.site.store_config
|
|
12
12
|
<div id='invoice_table'></div>
|
13
13
|
<div id='message'></div>
|
14
14
|
|
15
|
-
<p
|
15
|
+
<p>
|
16
|
+
<input type='button' value='< Back' class='btn' onclick="window.location='/my-account/invoices';" />
|
17
|
+
<input type='button' value='Print Invoice' class='btn' onclick='window.location="/my-account/invoices/<%= @invoice.id %>/print";' />
|
18
|
+
</p>
|
16
19
|
|
17
20
|
<% content_for :caboose_js do %>
|
18
21
|
<%= javascript_include_tag 'https://js.stripe.com/v2/' %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<p><div id="vendor_<%= @vendor.id %>_featured"></div></p>
|
5
5
|
<p><div id="vendor_<%= @vendor.id %>_image"></div></p>
|
6
6
|
<div id='message'></div>
|
7
|
-
<input type="button" value="< Back" onclick="window.location='/admin/vendors';" />
|
7
|
+
<input type="button" value="< Back" onclick="window.location='/admin/store/vendors';" />
|
8
8
|
<input type="button" value="Delete" onclick="delete_vendor(<%= @vendor.id %>);" />
|
9
9
|
|
10
10
|
<% content_for :caboose_js do %>
|
@@ -14,13 +14,13 @@ $(document).ready(function() {
|
|
14
14
|
m = new ModelBinder({
|
15
15
|
id: <%= @vendor.id %>,
|
16
16
|
name: 'Vendor',
|
17
|
-
update_url: '/admin/vendors/<%= @vendor.id %>',
|
17
|
+
update_url: '/admin/store/vendors/<%= @vendor.id %>',
|
18
18
|
authenticity_token: '<%= form_authenticity_token %>',
|
19
19
|
attributes: [
|
20
20
|
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@vendor.name) %>, width: 500 },
|
21
|
-
{ name: 'status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(@vendor.status) %>, width: 500, options_url: '/admin/vendors/status-options' },
|
21
|
+
{ name: 'status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(@vendor.status) %>, width: 500, options_url: '/admin/store/vendors/status-options' },
|
22
22
|
{ name: 'featured' , nice_name: 'Featured' , type: 'checkbox' , value: <%= @vendor.featured ? 1 : 0 %>, width: 500 },
|
23
|
-
{ name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(@vendor.image.url(:thumb)) %>, width: 500 , update_url: '/admin/vendors/<%= @vendor.id %>/image' }
|
23
|
+
{ name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(@vendor.image.url(:thumb)) %>, width: 500 , update_url: '/admin/store/vendors/<%= @vendor.id %>/image' }
|
24
24
|
]
|
25
25
|
})
|
26
26
|
});
|
@@ -38,7 +38,7 @@ function delete_vendor(vendor_id, confirm)
|
|
38
38
|
}
|
39
39
|
$('#message').html("<p class='loading'>Deleting vendor...</p>");
|
40
40
|
$.ajax({
|
41
|
-
url: '/admin/vendors/' + vendor_id,
|
41
|
+
url: '/admin/store/vendors/' + vendor_id,
|
42
42
|
type: 'delete',
|
43
43
|
success: function(resp) {
|
44
44
|
if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<h1>Vendors</h1>
|
2
2
|
|
3
|
-
<p><a href="/admin/vendors/new">New Vendor</a></p>
|
3
|
+
<p><a href="/admin/store/vendors/new">New Vendor</a></p>
|
4
4
|
|
5
|
-
<form action="/admin/vendors" method="get" style="margin: 0 0 12px">
|
5
|
+
<form action="/admin/store/vendors" method="get" style="margin: 0 0 12px">
|
6
6
|
<input name="name_like" value="<%= params[:name_like] %>" placeholder="Search for vendor" />
|
7
7
|
<input type="submit" value="Search" />
|
8
8
|
</form>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
</tr>
|
21
21
|
|
22
22
|
<% @vendors.each do |vendor| %>
|
23
|
-
<tr onclick="window.location='/admin/vendors/<%= vendor.id %>';">
|
23
|
+
<tr onclick="window.location='/admin/store/vendors/<%= vendor.id %>';">
|
24
24
|
<td style="text-align: center"><%= raw vendor.id %></td>
|
25
25
|
<td><% if vendor.image %><img src='<%= raw vendor.image.url(:tiny) %>' /><% else %> <% end %></td>
|
26
26
|
<td><%= raw vendor.name %></td>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<h1>New Vendor</h1>
|
2
2
|
|
3
|
-
<form id="new-vendor" action="/admin/vendors" method="post">
|
3
|
+
<form id="new-vendor" action="/admin/store/vendors" method="post">
|
4
4
|
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
|
5
5
|
<p><input id="name" name="name" id='name' type="text" placeholder="Vendor Name" style="width: 400px" /></p>
|
6
6
|
<p><input type='checkbox' name='stay' id='stay' value='1' /> Stay here so I can add another vendor</p>
|
7
7
|
<div id='message'></div>
|
8
8
|
<p>
|
9
|
-
<input type="button" value="< Back" onclick="window.location='/admin/vendors';" />
|
9
|
+
<input type="button" value="< Back" onclick="window.location='/admin/store/vendors';" />
|
10
10
|
<input type="submit" value="Add Vendor" />
|
11
11
|
</p>
|
12
12
|
</form>
|
@@ -20,7 +20,7 @@ $(document).ready(function() {
|
|
20
20
|
|
21
21
|
$('#message').html("<p class='loading'>Adding vendor...</p>");
|
22
22
|
$.ajax({
|
23
|
-
url: '/admin/vendors',
|
23
|
+
url: '/admin/store/vendors',
|
24
24
|
type: 'post',
|
25
25
|
data: $('#new-vendor').serialize(),
|
26
26
|
success: function(resp) {
|
data/lib/caboose/version.rb
CHANGED