caboose-cms 0.5.122 → 0.5.123
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin.js +1 -0
- data/app/assets/javascripts/caboose/admin_edit_order.js +6 -8
- data/app/assets/javascripts/caboose/cart.js +2 -2
- data/app/assets/javascripts/caboose/jquery.datetimepicker.js +1925 -0
- data/app/assets/javascripts/caboose/model/all.js +1 -0
- data/app/assets/javascripts/caboose/model/bound_date.js +10 -3
- data/app/assets/javascripts/caboose/model/bound_date_time.js +121 -0
- data/app/assets/javascripts/caboose/model/model_binder.js +3 -0
- data/app/assets/stylesheets/caboose/admin.css +1 -0
- data/app/assets/stylesheets/caboose/jquery.datetimepicker.css +523 -0
- data/app/assets/templates/caboose/cart/line_items.jst.ejs +1 -1
- data/app/assets/templates/caboose/checkout/line_items.jst.ejs +2 -2
- data/app/controllers/caboose/checkout_controller.rb +3 -2
- data/app/controllers/caboose/line_items_controller.rb +4 -2
- data/app/controllers/caboose/my_account_controller.rb +43 -0
- data/app/controllers/caboose/my_account_orders_controller.rb +40 -6
- data/app/controllers/caboose/orders_controller.rb +26 -20
- data/app/controllers/caboose/products_controller.rb +1 -0
- data/app/controllers/caboose/sites_controller.rb +15 -1
- data/app/controllers/caboose/users_controller.rb +0 -35
- data/app/controllers/caboose/variants_controller.rb +51 -2
- data/app/controllers/caboose/vendors_controller.rb +3 -2
- data/app/models/caboose/address.rb +9 -1
- data/app/models/caboose/line_item.rb +17 -9
- data/app/models/caboose/model_binder.rb +63 -0
- data/app/models/caboose/order.rb +21 -14
- data/app/models/caboose/order_pdf.rb +3 -3
- data/app/models/caboose/pending_orders_pdf.rb +1 -1
- data/app/models/caboose/product.rb +15 -16
- data/app/models/caboose/schema.rb +20 -13
- data/app/models/caboose/site.rb +9 -0
- data/app/models/caboose/store_config.rb +6 -0
- data/app/models/caboose/variant.rb +15 -1
- data/app/views/caboose/checkout/_cart.html.erb +3 -3
- data/app/views/caboose/checkout/_confirm.html.erb +3 -3
- data/app/views/caboose/login/index.html.erb +7 -3
- data/app/views/caboose/{users/my_account.html.erb → my_account/index.html.erb} +7 -6
- data/app/views/caboose/my_account_orders/edit.html.erb +104 -0
- data/app/views/caboose/my_account_orders/index.html.erb +36 -0
- data/app/views/caboose/sites/admin_edit.html.erb +2 -0
- data/app/views/caboose/variants/admin_edit.html.erb +11 -1
- data/app/views/caboose/variants/admin_index.html.erb +5 -2
- data/config/routes.rb +7 -2
- data/lib/caboose/#Untitled-1# +264 -0
- data/lib/caboose/engine.rb +23 -140
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +15 -1
- metadata +11 -4
- data/app/views/caboose/orders/admin_edit_old.html.erb +0 -155
@@ -1,8 +1,12 @@
|
|
1
1
|
<form action="/login" method="post" id="login-form">
|
2
2
|
<div class="header">
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
<% if @site.logo %>
|
4
|
+
<img src='<%= @site.logo.url(:thumb) %>' alt="<%= @site.description %>" />
|
5
|
+
<% else %>
|
6
|
+
<img src="/assets/caboose/caboose_logo.png" alt="Caboose">
|
7
|
+
<h1>caboose</h1>
|
8
|
+
<p>Coo Coo Ca Choo</p>
|
9
|
+
<% end %>
|
6
10
|
</div>
|
7
11
|
|
8
12
|
<input type="hidden" name="return_url" value="<%= @return_url %>" />
|
@@ -1,21 +1,22 @@
|
|
1
1
|
|
2
2
|
<h1>My Account</h1>
|
3
|
+
|
3
4
|
<p><div id='user_<%= @user.id %>_first_name' ></div></p>
|
4
5
|
<p><div id='user_<%= @user.id %>_last_name' ></div></p>
|
5
6
|
<p><div id='user_<%= @user.id %>_email' ></div></p>
|
6
7
|
<p><div id='user_<%= @user.id %>_phone' ></div></p>
|
7
8
|
<div id='message'></div>
|
8
|
-
|
9
|
+
|
10
|
+
<p>
|
11
|
+
<% if @site.use_store %>
|
12
|
+
<input type='button' value='Order History' class='btn' onclick="window.location='/my-account/orders';" />
|
13
|
+
<% end %>
|
14
|
+
</p>
|
9
15
|
|
10
16
|
<% content_for :caboose_js do %>
|
11
17
|
<%= javascript_include_tag "caboose/model/all" %>
|
12
18
|
<script type='text/javascript'>
|
13
19
|
|
14
|
-
var modal = false;
|
15
|
-
$(window).load(function() {
|
16
|
-
modal = new CabooseModal(450);
|
17
|
-
});
|
18
|
-
|
19
20
|
$(document).ready(function() {
|
20
21
|
new ModelBinder({
|
21
22
|
name: 'User',
|
@@ -0,0 +1,104 @@
|
|
1
|
+
<%
|
2
|
+
captured = @order.financial_status == 'captured'
|
3
|
+
%>
|
4
|
+
<input type='hidden' name='order_id' id='order_id' value='<%= @order.id %>' />
|
5
|
+
|
6
|
+
<h1>Order #<%= @order.order_number %></h1>
|
7
|
+
|
8
|
+
<table class='order'>
|
9
|
+
<tr>
|
10
|
+
<th>Billing Address</th>
|
11
|
+
<th>Shipping Address</th>
|
12
|
+
<th>Order Status</th>
|
13
|
+
<th>Payment Status</th>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td valign='top'><%= raw @order.billing_address.name_and_address %></td>
|
17
|
+
<td valign='top'><%= raw @order.shipping_address.name_and_address %></td>
|
18
|
+
<td valign='top'><%= @order.status.capitalize %></td>
|
19
|
+
<td valign='top'><%= @order.financial_status.capitalize %></td>
|
20
|
+
</tr>
|
21
|
+
</table><br />
|
22
|
+
|
23
|
+
<table class='order' width='100%'>
|
24
|
+
<% @order.packages.each_with_index do |op, i| %>
|
25
|
+
<tr><td colspan='5' class='package_header'>Package <%= (i+1) %>: <%= op.shipping_method.service_name %><br /><%= op.status %></td></tr>
|
26
|
+
<tr>
|
27
|
+
<th>Item</th>
|
28
|
+
<th>Status</th>
|
29
|
+
<th>Unit Price</th>
|
30
|
+
<th>Quantity</th>
|
31
|
+
<th>Subtotal</th>
|
32
|
+
</tr>
|
33
|
+
<% op.line_items.each do |li| %>
|
34
|
+
<% img = li.variant.product_image %>
|
35
|
+
<tr>
|
36
|
+
<td>
|
37
|
+
<% if img %><img src='<%= img.url(:tiny) %>' /><% end %>
|
38
|
+
<% if li.variant.nil? || li.variant.product.nil? %>
|
39
|
+
<% if li.variant.nil? %>Unknown variant<% else %><%= li.variant.sku %><% end %>
|
40
|
+
<% else %>
|
41
|
+
<a href='/products/<%= li.variant.product.id %>'><%= li.variant.product.title %></a><br />
|
42
|
+
<% if li.variant.sku && li.variant.sku.strip.length > 0 %><%= li.variant.sku %><br /><% end %>
|
43
|
+
<%= li.variant.title %>
|
44
|
+
<% end %>
|
45
|
+
</td>
|
46
|
+
<td><%= li.status.capitalize %></td>
|
47
|
+
<td style='text-align: right;'><%= number_to_currency(li.unit_price) %></td>
|
48
|
+
<td style='text-align: right;'><%= li.quantity %></td>
|
49
|
+
<td style='text-align: right;'><%= number_to_currency(li.subtotal) %></td>
|
50
|
+
</tr>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
53
|
+
<% @order.line_items.each do |li| %>
|
54
|
+
<% next if li.order_package_id %>
|
55
|
+
<tr><td colspan='5'>Unpackaged Items</td></tr>
|
56
|
+
<% img = li.variant.product_image %>
|
57
|
+
<tr>
|
58
|
+
<td>
|
59
|
+
<% if img %><img src='<%= img.url(:tiny) %>' /><% end %>
|
60
|
+
<% if li.variant.nil? || li.variant.product.nil? %>
|
61
|
+
<% if li.variant.nil? %>Unknown variant<% else %><%= li.variant.sku %><% end %>
|
62
|
+
<% else %>
|
63
|
+
<a href='/admin/products/<%= li.variant.product.id %>'><%= li.variant.product.title %></a><br />
|
64
|
+
<% if li.variant.sku && li.variant.sku.strip.length > 0 %><%= li.variant.sku %><br /><% end %>
|
65
|
+
<%= li.variant.title %>
|
66
|
+
<% end %>
|
67
|
+
</td>
|
68
|
+
<td><%= li.status.capitalize %></td>
|
69
|
+
<td style='text-align: right;'><%= number_to_currency(li.unit_price) %></td>
|
70
|
+
<td style='text-align: right;'><%= li.quantity %></td>
|
71
|
+
<td style='text-align: right;'><%= number_to_currency(li.subtotal) %></td>
|
72
|
+
</tr>
|
73
|
+
<% end %>
|
74
|
+
<tr><td colspan='5' class='totals_header'>Totals</td></tr>
|
75
|
+
<tr><td colspan='4' align='right'>Subtotal </td><td style='text-align: right;'><%= number_to_currency(@order.subtotal ) %></td></tr>
|
76
|
+
<tr><td colspan='4' align='right'>Tax </td><td style='text-align: right;'><%= number_to_currency(@order.tax ) %></td></tr>
|
77
|
+
<tr><td colspan='4' align='right'>Shipping & Handling </td><td style='text-align: right;'><%= number_to_currency(@order.shipping + @order.handling) %></td></tr>
|
78
|
+
<tr><td colspan='4' align='right'>Discount </td><td style='text-align: right;'><%= number_to_currency(@order.discount ) %></td></tr>
|
79
|
+
<tr><td colspan='4' align='right'>Total </td><td style='text-align: right;'><%= number_to_currency(@order.total ) %></td></tr>
|
80
|
+
</table>
|
81
|
+
<div id='message'></div>
|
82
|
+
|
83
|
+
<p>
|
84
|
+
<input type='button' value='< Back' class='btn' onclick="window.location='/my-account/orders';" />
|
85
|
+
</p>
|
86
|
+
|
87
|
+
<% content_for :caboose_css do %>
|
88
|
+
<style type='text/css'>
|
89
|
+
|
90
|
+
table.order { border-collapse: collapse; margin-bottom: 20px; }
|
91
|
+
table.order th { margin: 0; padding: 10px; border: #000 0px solid; font-weight: bold; text-align: center; }
|
92
|
+
table.order td { margin: 0; padding: 10px; border: #000 1px solid; }
|
93
|
+
table.order td img { float: left; margin-right: 10px; }
|
94
|
+
table.order td.package_header { font-weight: bold; text-align: center; border: 0; }
|
95
|
+
table.order td.totals_header { font-weight: bold; text-align: center; border: 0; }
|
96
|
+
|
97
|
+
</style>
|
98
|
+
<% end %>
|
99
|
+
|
100
|
+
<% content_for :caboose_js do %>
|
101
|
+
<script type='text/javascript'>
|
102
|
+
|
103
|
+
</script>
|
104
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
<h1>Order History</h1>
|
3
|
+
|
4
|
+
<% if @orders.count > 0 %>
|
5
|
+
<table class='orders'>
|
6
|
+
<tr>
|
7
|
+
<th>Date</th>
|
8
|
+
<th>Order Number</th>
|
9
|
+
<th>Total</th>
|
10
|
+
<th>Status</th>
|
11
|
+
</tr>
|
12
|
+
<% @orders.each do |order| %>
|
13
|
+
<tr onclick="window.location='/my-account/orders/<%= order.id %>';">
|
14
|
+
<td><%= order.date_created.strftime('%m/%d/%Y') %></td>
|
15
|
+
<td><%= order.order_number %></td>
|
16
|
+
<td><%= number_to_currency(order.total) %></td>
|
17
|
+
<td><%= order.status.capitalize %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
<% else %>
|
22
|
+
<p>You haven't placed any orders yet.<p>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<p><input type='button' value='< Back to My Account' class='btn' onclick="window.location='/my-account';" /></p>
|
26
|
+
|
27
|
+
<% content_for :caboose_css do %>
|
28
|
+
<style type='text/css'>
|
29
|
+
|
30
|
+
table.orders { border-collapse: collapse; margin-bottom: 20px; }
|
31
|
+
table.orders th { margin: 0; padding: 10px; border: #000 0px solid; font-weight: bold; text-align: center; }
|
32
|
+
table.orders td { margin: 0; padding: 10px; border: #000 1px solid; }
|
33
|
+
table.orders tr:hover td { background: #ccc; cursor: pointer; cursor: hand; }
|
34
|
+
|
35
|
+
</style>
|
36
|
+
<% end %>
|
@@ -7,6 +7,7 @@ user_ids = [] if user_ids.nil?
|
|
7
7
|
%>
|
8
8
|
<%= render :partial => 'caboose/sites/admin_header' %>
|
9
9
|
|
10
|
+
<p><div id='site_<%= @site.id %>_logo' ></div></p>
|
10
11
|
<p><div id='site_<%= @site.id %>_name' ></div></p>
|
11
12
|
<p><div id='site_<%= @site.id %>_description' ></div></p>
|
12
13
|
<p><div id='site_<%= @site.id %>_under_construction_html' ></div></p>
|
@@ -64,6 +65,7 @@ $(document).ready(function() {
|
|
64
65
|
update_url: '/admin/sites/<%= @site.id %>',
|
65
66
|
authenticity_token: '<%= form_authenticity_token %>',
|
66
67
|
attributes: [
|
68
|
+
{ name: 'logo' , nice_name: 'Logo' , type: 'image' , value: <%= raw Caboose.json(@site.logo ? @site.logo.url(:thumb) : '') %>, width: 400, update_url: '/admin/sites/<%= @site.id %>/logo' },
|
67
69
|
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
|
68
70
|
{ name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
|
69
71
|
{ name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 },
|
@@ -31,6 +31,13 @@ v = @variant
|
|
31
31
|
<div id='variant_<%= v.id %>_length' ></div>
|
32
32
|
<div id='variant_<%= v.id %>_width' ></div>
|
33
33
|
<div id='variant_<%= v.id %>_height' ></div>
|
34
|
+
</td><td valign='top'>
|
35
|
+
<h2>Sale</h2>
|
36
|
+
<div id='variant_<%= v.id %>_sale_price' ></div>
|
37
|
+
<div id='variant_<%= v.id %>_date_sale_starts' ></div>
|
38
|
+
<div id='variant_<%= v.id %>_time_sale_starts' ></div>
|
39
|
+
<div id='variant_<%= v.id %>_date_sale_ends' ></div>
|
40
|
+
<div id='variant_<%= v.id %>_time_sale_ends' ></div>
|
34
41
|
</td>
|
35
42
|
</tr>
|
36
43
|
</table>
|
@@ -60,7 +67,10 @@ $(document).ready(function() {
|
|
60
67
|
{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 250 },
|
61
68
|
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
|
62
69
|
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
|
63
|
-
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(sprintf("%.2f", v.price) ) %>, width: 250 },
|
70
|
+
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(sprintf("%.2f", v.price) ) %>, width: 250 },
|
71
|
+
{ name: 'sale_price' , nice_name: 'Sale price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.sale_price ) %>, width: 275 },
|
72
|
+
{ name: 'date_sale_starts' , nice_name: 'Sale starts' , type: 'datetime' , align: 'right' , value: <%= raw Caboose.json(v.date_sale_starts ? v.date_sale_starts.in_time_zone(@logged_in_user.timezone).strftime('%m/%d/%Y %I:%M %P') : '') %>, width: 275 },
|
73
|
+
{ name: 'date_sale_ends' , nice_name: 'Sale ends' , type: 'datetime' , align: 'right' , value: <%= raw Caboose.json(v.date_sale_ends ? v.date_sale_ends.in_time_zone(@logged_in_user.timezone).strftime('%m/%d/%Y %I:%M %P') : '') %>, width: 275 },
|
64
74
|
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
|
65
75
|
{ name: 'ignore_quantity' , nice_name: 'Ignore Quantity' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.ignore_quantity ) %>, width: 250 },
|
66
76
|
{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 250 },
|
@@ -72,7 +72,10 @@ $(document).ready(function() {
|
|
72
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
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
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 },
|
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: 'sale_price' , nice_name: 'Sale price' , sort: 'sale_price' , type: 'text' , value: function(v) { return v.sale_price }, width: 75, align: 'right' , bulk_edit: true },
|
77
|
+
{ show: false , name: 'date_sale_starts' , nice_name: 'Sale starts' , sort: 'date_sale_starts' , type: 'datetime' , value: function(v) { return v.date_sale_starts }, width: 75, align: 'left' , bulk_edit: true },
|
78
|
+
{ show: false , name: 'date_sale_ends' , nice_name: 'Sale ends' , sort: 'date_sale_ends' , type: 'datetime' , value: function(v) { return v.date_sale_ends }, width: 75, align: 'left' , bulk_edit: true },
|
76
79
|
{ 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
80
|
{ 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
81
|
{ 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 },
|
@@ -83,7 +86,7 @@ $(document).ready(function() {
|
|
83
86
|
{ show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, text: function(v) { return v.taxable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
|
84
87
|
{ show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, text: function(v) { return v.allow_backorder ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
|
85
88
|
{ show: false , name: 'downloadable' , nice_name: 'Downloadable' , sort: 'downloadable' , type: 'checkbox' , value: function(v) { return v.downloadable }, text: function(v) { return v.downloadable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
|
86
|
-
{ show: false , name: 'download_path' , nice_name: 'Download path' , sort: 'download_path' , type: 'text' , value: function(v) { return v.download_path }, width: 50, align: 'left' , bulk_edit: true }
|
89
|
+
{ show: false , name: 'download_path' , nice_name: 'Download path' , sort: 'download_path' , type: 'text' , value: function(v) { return v.download_path }, width: 50, align: 'left' , bulk_edit: true }
|
87
90
|
],
|
88
91
|
new_model_text: 'New Variant',
|
89
92
|
new_model_fields: [
|
data/config/routes.rb
CHANGED
@@ -24,8 +24,8 @@ Caboose::Engine.routes.draw do
|
|
24
24
|
# My Account
|
25
25
|
#=============================================================================
|
26
26
|
|
27
|
-
get "my-account" => "users#my_account"
|
28
|
-
put "my-account" => "users#update_my_account"
|
27
|
+
#get "my-account" => "users#my_account"
|
28
|
+
#put "my-account" => "users#update_my_account"
|
29
29
|
|
30
30
|
get "my-account/orders/:order_id/line-items/:id/download" => "my_account_line_items#download"
|
31
31
|
get "my-account/orders/:order_id/line-items/:id" => "my_account_line_items#edit"
|
@@ -33,6 +33,9 @@ Caboose::Engine.routes.draw do
|
|
33
33
|
|
34
34
|
get "my-account/orders/:id" => "my_account_orders#edit"
|
35
35
|
get "my-account/orders" => "my_account_orders#index"
|
36
|
+
|
37
|
+
get "my-account" => "my_account#index"
|
38
|
+
put "my-account" => "my_account#update"
|
36
39
|
|
37
40
|
#=============================================================================
|
38
41
|
# Sites
|
@@ -46,6 +49,7 @@ Caboose::Engine.routes.draw do
|
|
46
49
|
get "admin/sites" => "sites#admin_index"
|
47
50
|
|
48
51
|
post "admin/sites" => "sites#admin_add"
|
52
|
+
post "admin/sites/:id/logo" => "sites#admin_update_logo"
|
49
53
|
put "admin/sites/:id" => "sites#admin_update"
|
50
54
|
delete "admin/sites/:id" => "sites#admin_delete"
|
51
55
|
post "admin/sites/:id/members" => "sites#admin_add_member"
|
@@ -555,6 +559,7 @@ Caboose::Engine.routes.draw do
|
|
555
559
|
get '/admin/vendors/new' => 'vendors#admin_new'
|
556
560
|
get '/admin/vendors/:id' => 'vendors#admin_edit'
|
557
561
|
get '/admin/vendors' => 'vendors#admin_index'
|
562
|
+
post '/admin/vendors/:id/image' => 'vendors#admin_update_image'
|
558
563
|
put '/admin/vendors/:id' => 'vendors#admin_update'
|
559
564
|
post '/admin/vendors' => 'vendors#admin_add'
|
560
565
|
delete '/admin/vendors/:id' => 'vendors#admin_delete'
|
@@ -0,0 +1,264 @@
|
|
1
|
+
|
2
|
+
require 'tinymce-rails'
|
3
|
+
require 'jquery-ui-rails'
|
4
|
+
require 'colorbox-rails'
|
5
|
+
require 'paperclip'
|
6
|
+
|
7
|
+
class ActiveRecord::Base
|
8
|
+
# (PLU)cks a single uni(Q)ue field
|
9
|
+
def self.pluq(field, compact = true, sort = true)
|
10
|
+
arr = self.uniq.pluck(field)
|
11
|
+
return [] if arr.nil?
|
12
|
+
arr = arr.compact if compact
|
13
|
+
arr = arr.sort if sort
|
14
|
+
return arr
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Caboose
|
19
|
+
|
20
|
+
def Caboose.log(message, title = nil)
|
21
|
+
if (Rails.logger.nil?)
|
22
|
+
puts "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
23
|
+
puts title.to_s unless title.nil?
|
24
|
+
puts message
|
25
|
+
puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
|
26
|
+
else
|
27
|
+
Rails.logger.info("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
|
28
|
+
Rails.logger.info(title.to_s) unless title.nil?
|
29
|
+
Rails.logger.info(message)
|
30
|
+
Rails.logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def Caboose.plugin_hook(*args)
|
35
|
+
resp = nil
|
36
|
+
args[0] = args[0].to_sym
|
37
|
+
Caboose.plugins.each do |mod|
|
38
|
+
#resp = mod.constantize.send(*args)
|
39
|
+
if (mod.constantize.respond_to?(args[0]))
|
40
|
+
resp = mod.constantize.send(*args)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
return resp
|
44
|
+
end
|
45
|
+
|
46
|
+
def Caboose.json(obj, defaultvalue = "", options = {})
|
47
|
+
return defaultvalue.to_json if obj.nil?
|
48
|
+
return obj.to_json(options)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Strips html and returns the text that breaks closest to the given length
|
52
|
+
def Caboose.teaser_text(str, length = 100)
|
53
|
+
return '' if str.nil?
|
54
|
+
str2 = ActionController::Base.helpers.strip_tags(str).gsub("\n", ' ')
|
55
|
+
return '' if str2.nil? || str2.length == 0
|
56
|
+
if str2.length > length
|
57
|
+
i = str2.index(' ', length)
|
58
|
+
if i.nil?
|
59
|
+
i = length
|
60
|
+
else
|
61
|
+
i = i - 1
|
62
|
+
end
|
63
|
+
str2 = str2[0..i]
|
64
|
+
str2[str2.length-1] = "" if str2.ends_with?(",")
|
65
|
+
str2 = "#{str2}..."
|
66
|
+
end
|
67
|
+
return str2
|
68
|
+
end
|
69
|
+
|
70
|
+
class Engine < ::Rails::Engine
|
71
|
+
isolate_namespace Caboose
|
72
|
+
require 'jquery-rails'
|
73
|
+
initializer 'caboose.assets.precompile' do |app|
|
74
|
+
app.config.assets.precompile += [
|
75
|
+
|
76
|
+
# Images
|
77
|
+
'caboose/caboose_logo_small.png',
|
78
|
+
'caboose/caboose_nav_black.png',
|
79
|
+
'caboose/caboose_nav.png',
|
80
|
+
'caboose/default_user_pic.png',
|
81
|
+
'caboose/loading_black_on_white.gif',
|
82
|
+
'caboose/loading_green.gif',
|
83
|
+
'caboose/loading_small_black_on_white.gif',
|
84
|
+
'caboose/loading_small_white_on_black.gif',
|
85
|
+
'caboose/loading_white_on_black.gif',
|
86
|
+
'caboose/search.png',
|
87
|
+
|
88
|
+
# Javascript
|
89
|
+
'caboose/admin_block_edit.js',
|
90
|
+
'caboose/admin_edit_order.js',
|
91
|
+
'caboose/admin_images_index.js',
|
92
|
+
'caboose/admin_main.js',
|
93
|
+
'caboose/admin_page_edit_content.js',
|
94
|
+
'caboose/admin_page_new_blocks.js',
|
95
|
+
'caboose/admin_products.js',
|
96
|
+
'caboose/admin.js',
|
97
|
+
'caboose/application.js',
|
98
|
+
'caboose/authorize.net.js',
|
99
|
+
'caboose/cart.js',
|
100
|
+
'caboose/cart_old.js',
|
101
|
+
'caboose/checkout_addresses.js',
|
102
|
+
'caboose/checkout_gift_cards.js',
|
103
|
+
'caboose/checkout_login_register.js',
|
104
|
+
'caboose/checkout_module.js',
|
105
|
+
'caboose/checkout_payment.js',
|
106
|
+
'caboose/checkout_shipping.js',
|
107
|
+
'caboose/checkout.js',
|
108
|
+
'caboose/date_format.js',
|
109
|
+
'caboose/imageZoom.js',
|
110
|
+
'caboose/jquery.detect.js',
|
111
|
+
'caboose/jquery.fileupload.js',
|
112
|
+
'caboose/jquery.iframe-transport.js',
|
113
|
+
'caboose/jquery.placeholder.js',
|
114
|
+
'caboose/jquery.timepicker.js',
|
115
|
+
'caboose/lodash.min.js',
|
116
|
+
'caboose/main.js',
|
117
|
+
'caboose/modal_integration.js',
|
118
|
+
'caboose/modal.js',
|
119
|
+
'caboose/model/all.js',
|
120
|
+
'caboose/model/attribute.js',
|
121
|
+
'caboose/model/bound_checkbox_multiple.js',
|
122
|
+
'caboose/model/bound_checkbox.js',
|
123
|
+
'caboose/model/bound_code.js',
|
124
|
+
'caboose/model/bound_color.js',
|
125
|
+
'caboose/model/bound_control.js',
|
126
|
+
'caboose/model/bound_date.js',
|
127
|
+
'caboose/model/bound_file.js',
|
128
|
+
'caboose/model/bound_image.js',
|
129
|
+
'caboose/model/bound_richtext.js',
|
130
|
+
'caboose/model/bound_s3_image.js',
|
131
|
+
'caboose/model/bound_select.js',
|
132
|
+
'caboose/model/bound_text.js',
|
133
|
+
'caboose/model/bound_textarea.js',
|
134
|
+
'caboose/model/bound_time.js',
|
135
|
+
'caboose/model/class.js',
|
136
|
+
'caboose/model/index_table_bak.js',
|
137
|
+
'caboose/model/index_table.js',
|
138
|
+
'caboose/model/model_binder.js',
|
139
|
+
'caboose/model/model.js',
|
140
|
+
'caboose/model/pager.js',
|
141
|
+
'caboose/model/s3.js',
|
142
|
+
'caboose/model.form.page.js',
|
143
|
+
'caboose/model.form.user.js',
|
144
|
+
'caboose/product.js',
|
145
|
+
'caboose/s3upload.js',
|
146
|
+
'caboose/shortcut.js',
|
147
|
+
'caboose/spectrum.js',
|
148
|
+
'caboose/station.js',
|
149
|
+
'caboose/testing.js',
|
150
|
+
'jquery.js',
|
151
|
+
'jquery_ujs.js',
|
152
|
+
'jquery-ui.js',
|
153
|
+
'colorbox-rails/jquery.colorbox-min.js',
|
154
|
+
'colorbox-rails.js',
|
155
|
+
'colorbox-rails/colorbox-links.js',
|
156
|
+
'tinymce/plugins/caboose/plugin.js',
|
157
|
+
'tinymce/preinit.js',
|
158
|
+
'tinymce/plugins/caboose/plugin.js',
|
159
|
+
'tinymce/themes/modern/theme.js',
|
160
|
+
'tinymce/plugins/advlist/plugin.js',
|
161
|
+
'tinymce/plugins/lists/plugin.js',
|
162
|
+
'tinymce/plugins/autolink/plugin.js',
|
163
|
+
'tinymce/plugins/link/plugin.js',
|
164
|
+
'tinymce/plugins/image/plugin.js',
|
165
|
+
'tinymce/plugins/charmap/plugin.js',
|
166
|
+
'tinymce/plugins/print/plugin.js',
|
167
|
+
'tinymce/plugins/preview/plugin.js',
|
168
|
+
'tinymce/plugins/hr/plugin.js',
|
169
|
+
'tinymce/plugins/anchor/plugin.js',
|
170
|
+
'tinymce/plugins/searchreplace/plugin.js',
|
171
|
+
'tinymce/plugins/pagebreak/plugin.js',
|
172
|
+
'tinymce/plugins/wordcount/plugin.js',
|
173
|
+
'tinymce/plugins/visualblocks/plugin.js',
|
174
|
+
'tinymce/plugins/visualchars/plugin.js',
|
175
|
+
'tinymce/plugins/code/plugin.js',
|
176
|
+
'tinymce/plugins/fullscreen/plugin.js',
|
177
|
+
'tinymce/plugins/insertdatetime/plugin.js',
|
178
|
+
'tinymce/plugins/media/plugin.js',
|
179
|
+
'tinymce/plugins/nonbreaking/plugin.js',
|
180
|
+
'tinymce/plugins/table/plugin.js',
|
181
|
+
'tinymce/plugins/contextmenu/plugin.js',
|
182
|
+
'tinymce/plugins/directionality/plugin.js',
|
183
|
+
'tinymce/plugins/emoticons/plugin.js',
|
184
|
+
'tinymce/plugins/paste/plugin.js',
|
185
|
+
'tinymce/plugins/template/plugin.js',
|
186
|
+
'tinymce/plugins/textcolor/plugin.js',
|
187
|
+
'tinymce/plugins/caboose/plugin.js',
|
188
|
+
|
189
|
+
# Site JS
|
190
|
+
'*/js/application.js',
|
191
|
+
|
192
|
+
# CSS
|
193
|
+
'caboose/admin_crumbtrail.css',
|
194
|
+
'caboose/admin_images_index.css',
|
195
|
+
'caboose/admin_main.css',
|
196
|
+
'caboose/admin_page_edit_content.css',
|
197
|
+
'caboose/admin_products.css',
|
198
|
+
'caboose/admin.css',
|
199
|
+
'caboose/application.css',
|
200
|
+
'caboose/bound_input.css',
|
201
|
+
'caboose/caboose.css',
|
202
|
+
'caboose/cart.css',
|
203
|
+
'caboose/checkout.css',
|
204
|
+
'caboose/fonts/avenir-medium.eot',
|
205
|
+
'caboose/fonts/avenir-medium.ttf',
|
206
|
+
'caboose/fonts/big_noodle_titling_oblique.ttf',
|
207
|
+
'caboose/fonts/big_noodle_titling.ttf',
|
208
|
+
'caboose/fonts.css',
|
209
|
+
'caboose/icomoon_fonts.css',
|
210
|
+
'caboose/icons.txt',
|
211
|
+
'caboose/jquery.timepicker.css',
|
212
|
+
'caboose/login.css',
|
213
|
+
'caboose/message_boxes.css',
|
214
|
+
'caboose/modal.css',
|
215
|
+
'caboose/model_binder.css',
|
216
|
+
'caboose/page_bar_generator.css',
|
217
|
+
'caboose/print.css',
|
218
|
+
'caboose/product_images.css',
|
219
|
+
'caboose/product_options.css',
|
220
|
+
'caboose/register.css',
|
221
|
+
'caboose/responsive.css',
|
222
|
+
'caboose/spectrum.css',
|
223
|
+
'caboose/station_modal.css',
|
224
|
+
'caboose/station_sidebar.css',
|
225
|
+
'caboose/tinymce.css',
|
226
|
+
'colorbox-rails.css',
|
227
|
+
'colorbox-rails/colorbox-rails.css',
|
228
|
+
'jquery-ui.css',
|
229
|
+
|
230
|
+
# Site CSS
|
231
|
+
'*/css/application.css'
|
232
|
+
|
233
|
+
]
|
234
|
+
end
|
235
|
+
|
236
|
+
# Configure rspec
|
237
|
+
config.generators do |g|
|
238
|
+
g.test_framework :rspec, :fixture => false
|
239
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
240
|
+
g.assets false
|
241
|
+
g.helper false
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
#initializer 'caboose_store.payment_processor', :after => :finish_hook do |app|
|
248
|
+
# case Caboose::payment_processor
|
249
|
+
# when 'authorize.net'
|
250
|
+
# Caboose::PaymentProcessor = Caboose::PaymentProcessors::Authorizenet
|
251
|
+
# when 'payscape'
|
252
|
+
# Caboose::PaymentProcessor = Caboose::PaymentProcessors::Payscape
|
253
|
+
# end
|
254
|
+
#end
|
255
|
+
#
|
256
|
+
#initializer 'caboose_store.cart', :after => :finish_hook do |app|
|
257
|
+
# ActiveSupport.on_load(:action_controller) do
|
258
|
+
# include Caboose::BootStrapper
|
259
|
+
# end
|
260
|
+
#
|
261
|
+
# Caboose::User.class_eval do
|
262
|
+
# self.primary_key = :id
|
263
|
+
# end
|
264
|
+
#end
|