caboose-cms 0.4.151 → 0.5.1
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_products.js +79 -0
- data/app/assets/javascripts/caboose/application.js +2 -1
- data/app/assets/javascripts/caboose/cart.js +168 -0
- data/app/assets/javascripts/caboose/checkout.js +151 -0
- data/app/assets/javascripts/caboose/checkout_module.js +312 -0
- data/app/assets/javascripts/caboose/checkout_step1.js +179 -0
- data/app/assets/javascripts/caboose/checkout_step2.js +39 -0
- data/app/assets/javascripts/caboose/checkout_step3.js +34 -0
- data/app/assets/javascripts/caboose/checkout_step4.js +97 -0
- data/app/assets/javascripts/caboose/main.js +99 -8
- data/app/assets/javascripts/caboose/product.js +284 -0
- data/app/assets/stylesheets/caboose/admin_products.css +86 -0
- data/app/assets/templates/caboose/cart/add_to_cart.jst.ejs +7 -0
- data/app/assets/templates/caboose/cart/line_items.jst.ejs +41 -0
- data/app/assets/templates/caboose/checkout/address.jst.ejs +53 -0
- data/app/assets/templates/caboose/checkout/forms/guest.jst.ejs +8 -0
- data/app/assets/templates/caboose/checkout/forms/register.jst.ejs +11 -0
- data/app/assets/templates/caboose/checkout/forms/signin.jst.ejs +7 -0
- data/app/assets/templates/caboose/checkout/line_items.jst.ejs +31 -0
- data/app/assets/templates/caboose/checkout/login.jst.ejs +21 -0
- data/app/assets/templates/caboose/checkout/payment.jst.ejs +5 -0
- data/app/assets/templates/caboose/checkout/shipping.jst.ejs +18 -0
- data/app/assets/templates/caboose/product/images.jst.ejs +8 -0
- data/app/assets/templates/caboose/product/options.jst.ejs +19 -0
- data/app/controllers/caboose/application_controller.rb +29 -1
- data/app/controllers/caboose/cart_controller.rb +52 -0
- data/app/controllers/caboose/categories_controller.rb +108 -0
- data/app/controllers/caboose/checkout_controller.rb +325 -0
- data/app/controllers/caboose/orders_controller.rb +439 -0
- data/app/controllers/caboose/product_images_controller.rb +38 -0
- data/app/controllers/caboose/products_controller.rb +737 -0
- data/app/controllers/caboose/reviews_controller.rb +15 -0
- data/app/controllers/caboose/variants_controller.rb +218 -0
- data/app/controllers/caboose/vendors_controller.rb +73 -0
- data/app/helpers/caboose/application_helper.rb +4 -0
- data/app/helpers/caboose/categories_helper.rb +82 -0
- data/app/helpers/caboose/checkout_helper.rb +20 -0
- data/app/helpers/caboose/products_helper.rb +8 -0
- data/app/mailers/caboose/orders_mailer.rb +30 -0
- data/app/models/caboose/address.rb +26 -0
- data/app/models/caboose/category.rb +89 -0
- data/app/models/caboose/category_membership.rb +10 -0
- data/app/models/caboose/core_plugin.rb +15 -37
- data/app/models/caboose/customization_membership.rb +10 -0
- data/app/models/caboose/discount.rb +16 -0
- data/app/models/caboose/line_item.rb +81 -0
- data/app/models/caboose/message.rb +20 -0
- data/app/models/caboose/order.rb +191 -0
- data/app/models/caboose/order_discount.rb +10 -0
- data/app/models/caboose/order_pdf.rb +78 -0
- data/app/models/caboose/payment_processors/authorizenet.rb +53 -0
- data/app/models/caboose/payment_processors/base.rb +39 -0
- data/app/models/caboose/payment_processors/payscape.rb +94 -0
- data/app/models/caboose/product.rb +145 -0
- data/app/models/caboose/product_image.rb +62 -0
- data/app/models/caboose/product_image_variant.rb +10 -0
- data/app/models/caboose/review.rb +13 -0
- data/app/models/caboose/schema.rb +205 -1
- data/app/models/caboose/search_filter.rb +191 -0
- data/app/models/caboose/shipping_calculator.rb +81 -0
- data/app/models/caboose/states.rb +61 -52
- data/app/models/caboose/tax_calculator.rb +23 -0
- data/app/models/caboose/tax_line.rb +9 -0
- data/app/models/caboose/variant.rb +99 -0
- data/app/models/caboose/vendor.rb +22 -0
- data/app/views/caboose/cart/index.html.erb +8 -0
- data/app/views/caboose/categories/admin_edit.html.erb +79 -0
- data/app/views/caboose/categories/admin_index.html.erb +11 -0
- data/app/views/caboose/categories/admin_new.html.erb +62 -0
- data/app/views/caboose/checkout/_address_form.html.erb +111 -0
- data/app/views/caboose/checkout/_billing_form.html.erb +47 -0
- data/app/views/caboose/checkout/_cart.html.erb +52 -0
- data/app/views/caboose/checkout/_confirm.html.erb +61 -0
- data/app/views/caboose/checkout/_order_discount.html.erb +40 -0
- data/app/views/caboose/checkout/_shipping_address.html.erb +10 -0
- data/app/views/caboose/checkout/_shipping_method.html.erb +2 -0
- data/app/views/caboose/checkout/_shipping_method_form.html.erb +21 -0
- data/app/views/caboose/checkout/billing.html.erb +11 -0
- data/app/views/caboose/checkout/discount.html.erb +11 -0
- data/app/views/caboose/checkout/empty.html.erb +2 -0
- data/app/views/caboose/checkout/error.html.erb +2 -0
- data/app/views/caboose/checkout/index.html.erb +43 -0
- data/app/views/caboose/checkout/login.html.erb +2 -0
- data/app/views/caboose/checkout/payment.html.erb +79 -0
- data/app/views/caboose/checkout/relay.html.erb +23 -0
- data/app/views/caboose/checkout/relay_old.html.erb +12 -0
- data/app/views/caboose/checkout/relay_postMessage.html.erb +19 -0
- data/app/views/caboose/checkout/shipping.html.erb +15 -0
- data/app/views/caboose/checkout/step_four.html.erb +93 -0
- data/app/views/caboose/checkout/step_one.html.erb +56 -0
- data/app/views/caboose/checkout/step_one_old.html.erb +13 -0
- data/app/views/caboose/checkout/step_three.html.erb +23 -0
- data/app/views/caboose/checkout/step_two.html.erb +52 -0
- data/app/views/caboose/checkout/step_two_old.html.erb +14 -0
- data/app/views/caboose/checkout/thanks.html.erb +5 -0
- data/app/views/caboose/orders/_admin_footer.html.erb +2 -0
- data/app/views/caboose/orders/_admin_header.html.erb +31 -0
- data/app/views/caboose/orders/_quickbooks_order.html.erb +0 -0
- data/app/views/caboose/orders/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/orders/admin_edit.html.erb +271 -0
- data/app/views/caboose/orders/admin_index.html.erb +89 -0
- data/app/views/caboose/orders/admin_new.html.erb +42 -0
- data/app/views/caboose/orders/admin_print.html.erb +72 -0
- data/app/views/caboose/orders_mailer/customer_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/customer_status_updated.html.erb +1 -0
- data/app/views/caboose/orders_mailer/fulfillment_new_order.html.erb +1 -0
- data/app/views/caboose/orders_mailer/shipping_order_ready.html.erb +1 -0
- data/app/views/caboose/products/_admin_footer.html.erb +2 -0
- data/app/views/caboose/products/_admin_header.html.erb +32 -0
- data/app/views/caboose/products/_sort_options.html.erb +19 -0
- data/app/views/caboose/products/admin_add_upcs.html.erb +58 -0
- data/app/views/caboose/products/admin_delete_form.html.erb +21 -0
- data/app/views/caboose/products/admin_edit_categories.html.erb +73 -0
- data/app/views/caboose/products/admin_edit_category_images.html.erb +233 -0
- data/app/views/caboose/products/admin_edit_description.html.erb +38 -0
- data/app/views/caboose/products/admin_edit_general.html.erb +104 -0
- data/app/views/caboose/products/admin_edit_images.html.erb +236 -0
- data/app/views/caboose/products/admin_edit_options.html.erb +51 -0
- data/app/views/caboose/products/admin_edit_seo.html.erb +37 -0
- data/app/views/caboose/products/admin_edit_variant_columns.html.erb +75 -0
- data/app/views/caboose/products/admin_edit_variant_sort_order.html.erb +63 -0
- data/app/views/caboose/products/admin_edit_variants.html.erb +171 -0
- data/app/views/caboose/products/admin_edit_variants_single.html.erb +68 -0
- data/app/views/caboose/products/admin_group_variants.html.erb +433 -0
- data/app/views/caboose/products/admin_index.html.erb +95 -0
- data/app/views/caboose/products/admin_new.html.erb +41 -0
- data/app/views/caboose/products/admin_sort.html copy.erb +155 -0
- data/app/views/caboose/products/admin_sort.html.erb +254 -0
- data/app/views/caboose/products/details.html.erb +438 -0
- data/app/views/caboose/products/index.html.erb +46 -0
- data/app/views/caboose/products/not_available.html.erb +35 -0
- data/app/views/caboose/variants/admin_edit.html.erb +82 -0
- data/app/views/caboose/variants/admin_group.html.erb +184 -0
- data/app/views/caboose/variants/admin_new.html.erb +59 -0
- data/app/views/caboose/vendors/admin_edit.html.erb +24 -0
- data/app/views/caboose/vendors/admin_index.html.erb +30 -0
- data/app/views/caboose/vendors/admin_new.html.erb +34 -0
- data/app/views/layouts/caboose/store/_banner.html.erb +10 -0
- data/app/views/layouts/caboose/store/_banner2.html.erb +10 -0
- data/app/views/layouts/caboose/store/_footer.html.erb +55 -0
- data/app/views/layouts/caboose/store/_header.html.erb +69 -0
- data/app/views/layouts/caboose/store/_sidebar.html.erb +27 -0
- data/app/views/layouts/caboose/store/application.html.erb +33 -0
- data/app/views/layouts/caboose/store/authorize_net.erb +18 -0
- data/app/views/layouts/caboose/store/layout_about.html.erb +42 -0
- data/app/views/layouts/caboose/store/layout_blog.html.erb +159 -0
- data/app/views/layouts/caboose/store/layout_confirm.html.erb +85 -0
- data/app/views/layouts/caboose/store/layout_contact.html.erb +38 -0
- data/app/views/layouts/caboose/store/layout_default.html.erb +10 -0
- data/app/views/layouts/caboose/store/layout_detail.html.erb +114 -0
- data/app/views/layouts/caboose/store/layout_order.html.erb +77 -0
- data/app/views/layouts/caboose/store/layout_pricing.html.erb +182 -0
- data/app/views/layouts/caboose/store/layout_product.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_profile.html.erb +55 -0
- data/app/views/layouts/caboose/store/layout_single.html.erb +3 -0
- data/app/views/layouts/caboose/store/layout_testimonial.html.erb +110 -0
- data/app/views/layouts/caboose/store/layout_testing.html.erb +4 -0
- data/config/routes.rb +126 -0
- data/lib/caboose.rb +46 -1
- data/lib/caboose/engine.rb +39 -1
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +12 -0
- metadata +151 -4
- data/app/assets/javascripts/caboose/admin_page_edit_content_bak.js +0 -164
- data/app/assets/javascripts/caboose/model/#Untitled-1# +0 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
<% p = @product %>
|
2
|
+
|
3
|
+
<div class="page-content">
|
4
|
+
<div class="container">
|
5
|
+
<div class="row-fluid">
|
6
|
+
<div class="span12">
|
7
|
+
<ul class="breadcrumb">
|
8
|
+
<li><a href="/">Home</a>
|
9
|
+
<% if p.categories[1] %>
|
10
|
+
<span class="divider">/</span></li>
|
11
|
+
<% p.categories[1].ancestry.each do |c| %>
|
12
|
+
<% if c != p.categories[1] %>
|
13
|
+
<li><a href="<%= c.url %>"><%= c.name %></a> <span class="divider">/</span></li>
|
14
|
+
<% else %>
|
15
|
+
<li><a href="<%= c.url %>"><%= c.name %></a></li>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
<% else %>
|
19
|
+
</li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="row-fluid">
|
25
|
+
<div class="span12 single-item">
|
26
|
+
<div class="row-fluid">
|
27
|
+
<div class="span7">
|
28
|
+
<h3><%= p.title %></h3>
|
29
|
+
<p>This product is not currently available.</p>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
v = @variant
|
4
|
+
%>
|
5
|
+
<h1>Edit Variant</h1>
|
6
|
+
|
7
|
+
<table>
|
8
|
+
<tr>
|
9
|
+
<td valign='top'>
|
10
|
+
<h2>Options</h2>
|
11
|
+
<% if p.option1 %><div id='variant_<%= v.id %>_option1'></div><% end %>
|
12
|
+
<% if p.option2 %><div id='variant_<%= v.id %>_option2'></div><% end %>
|
13
|
+
<% if p.option3 %><div id='variant_<%= v.id %>_option3'></div><% end %>
|
14
|
+
<div id='variant_<%= v.id %>_status' ></div>
|
15
|
+
<div id='variant_<%= v.id %>_requires_shipping' ></div>
|
16
|
+
<div id='variant_<%= v.id %>_allow_backorder' ></div>
|
17
|
+
<div id='variant_<%= v.id %>_taxable' ></div>
|
18
|
+
</td><td valign='top'>
|
19
|
+
<h2>Inventory</h2>
|
20
|
+
<div id='variant_<%= v.id %>_alternate_id' ></div>
|
21
|
+
<div id='variant_<%= v.id %>_sku' ></div>
|
22
|
+
<div id='variant_<%= v.id %>_barcode' ></div>
|
23
|
+
<div id='variant_<%= v.id %>_price' ></div>
|
24
|
+
<div id='variant_<%= v.id %>_quantity_in_stock' ></div>
|
25
|
+
<div id='variant_<%= v.id %>_ignore_quantity' ></div>
|
26
|
+
</td><td valign='top'>
|
27
|
+
<h2>Dimensions</h2>
|
28
|
+
<div id='variant_<%= v.id %>_weight' ></div>
|
29
|
+
<div id='variant_<%= v.id %>_cylinder' ></div>
|
30
|
+
<div id='variant_<%= v.id %>_length' ></div>
|
31
|
+
<div id='variant_<%= v.id %>_width' ></div>
|
32
|
+
<div id='variant_<%= v.id %>_height' ></div>
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
</table>
|
36
|
+
<div id='message'></div>
|
37
|
+
<p>
|
38
|
+
<input type='button' value='< Back' onclick="window.location='/admin/products/<%= p.id %>/variants';" />
|
39
|
+
<input type='button' value='Delete Variant' onclick="delete_variant(<%= v.id %>);" />
|
40
|
+
</p>
|
41
|
+
|
42
|
+
<% content_for :caboose_js do %>
|
43
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
44
|
+
<%= javascript_include_tag "caboose/admin_products" %>
|
45
|
+
<script type='text/javascript'>
|
46
|
+
|
47
|
+
$(document).ready(function() {
|
48
|
+
m = new ModelBinder({
|
49
|
+
name: 'Variant',
|
50
|
+
id: <%= v.id %>,
|
51
|
+
update_url: '/admin/variants/<%= v.id %>',
|
52
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
53
|
+
attributes: [
|
54
|
+
<% if p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.option1 ) %>, width: 250 },<% end %>
|
55
|
+
<% if p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.option2 ) %>, width: 250 },<% end %>
|
56
|
+
<% if p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.option3 ) %>, width: 250 },<% end %>
|
57
|
+
{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 250 },
|
58
|
+
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
|
59
|
+
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
|
60
|
+
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(sprintf("%.2f", v.price) ) %>, width: 250 },
|
61
|
+
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
|
62
|
+
{ name: 'ignore_quantity' , nice_name: 'Ignore Quantity' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.ignore_quantity ) %>, width: 250 },
|
63
|
+
{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 250 },
|
64
|
+
{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.length ) %>, width: 250 },
|
65
|
+
{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.width ) %>, width: 250 },
|
66
|
+
{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.height ) %>, width: 250 },
|
67
|
+
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.cylinder ) %>, width: 250 },
|
68
|
+
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 250 },
|
69
|
+
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.taxable ) %>, width: 250 },
|
70
|
+
{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.allow_backorder ) %>, width: 250 },
|
71
|
+
{ name: 'status' , nice_name: 'Status' , type: 'select' , align: 'right' , value: <%= raw Caboose.json(v.status) %>, text: <%= raw Caboose.json(v.status) %>, width: 250, options_url: '/admin/variants/status-options' }
|
72
|
+
]
|
73
|
+
});
|
74
|
+
});
|
75
|
+
|
76
|
+
var modal = false;
|
77
|
+
$(window).load(function() {
|
78
|
+
modal = new CabooseModal(800);
|
79
|
+
});
|
80
|
+
|
81
|
+
</script>
|
82
|
+
<% end %>
|
@@ -0,0 +1,184 @@
|
|
1
|
+
<h1>Group Variants</h1>
|
2
|
+
|
3
|
+
<button id="toggle-filter">Toggle Filters</button>
|
4
|
+
|
5
|
+
<div class="sidebar">
|
6
|
+
<aside>
|
7
|
+
<form id="filters" action="/admin/variants/group" method="get">
|
8
|
+
<h4><label for="title">Title</label></h4>
|
9
|
+
<input id="title" name="title" type="text" />
|
10
|
+
|
11
|
+
<h4><label for="categories">Categories</label></h4>
|
12
|
+
<input id="category-filter" type="text" />
|
13
|
+
<select id="categories" name="category_ids[]" multiple>
|
14
|
+
<% @categories.each do |category| %>
|
15
|
+
<% next if category.name.nil? or category.name.empty? %>
|
16
|
+
<option value="<%= category.id %>"><%= category.url.gsub('/products/', '') %></option>
|
17
|
+
<% end %>
|
18
|
+
</select>
|
19
|
+
|
20
|
+
<h4><label for="vendors">Vendors</label><h4>
|
21
|
+
<input id="vendor-filter" type="text" />
|
22
|
+
<select id="vendors" name="vendor_ids[]" multiple>
|
23
|
+
<% @vendors.each do |vendor| %>
|
24
|
+
<% next if vendor.name.nil? or vendor.name.empty? %>
|
25
|
+
<option value="<%= vendor.id %>"><%= vendor.name %></option>
|
26
|
+
<% end %>
|
27
|
+
</select>
|
28
|
+
|
29
|
+
<fieldset>
|
30
|
+
<input type="button" value="Clear" />
|
31
|
+
<input type="submit" value="Filter" />
|
32
|
+
</fieldset>
|
33
|
+
</form>
|
34
|
+
</aside>
|
35
|
+
|
36
|
+
<secton>
|
37
|
+
<h4>Variants</h4>
|
38
|
+
|
39
|
+
<% if @variants.any? %>
|
40
|
+
<form id="variants" action="/admin/variants/group" method="post">
|
41
|
+
<fieldset>
|
42
|
+
<% @variants.each do |variant| %>
|
43
|
+
<label>
|
44
|
+
<input type="checkbox" value="<%= variant.id %>" />
|
45
|
+
<%= variant.product.name %>
|
46
|
+
</label>
|
47
|
+
<% end %>
|
48
|
+
</fieldset>
|
49
|
+
</form>
|
50
|
+
<% else %>
|
51
|
+
<p>No variants to show.</p>
|
52
|
+
<% end %>
|
53
|
+
</section>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<% content_for :caboose_css do %>
|
57
|
+
<style>
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Sidebar
|
61
|
+
*/
|
62
|
+
|
63
|
+
.sidebar,
|
64
|
+
.sidebar > section { overflow: hidden; }
|
65
|
+
|
66
|
+
.sidebar > aside {
|
67
|
+
float: left;
|
68
|
+
margin-right: 12px;
|
69
|
+
width: 300px;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Forms
|
74
|
+
*/
|
75
|
+
|
76
|
+
form#filters {
|
77
|
+
display: none;
|
78
|
+
margin: 24px 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
form#filters select {
|
82
|
+
height: 500px;
|
83
|
+
padding: 6px;
|
84
|
+
}
|
85
|
+
|
86
|
+
form#filters label,
|
87
|
+
form#filters input[type=text],
|
88
|
+
form#filters select {
|
89
|
+
box-sizing: border-box;
|
90
|
+
display: block;
|
91
|
+
outline: none !important;
|
92
|
+
width: 100%;
|
93
|
+
}
|
94
|
+
|
95
|
+
form#filters label + input,
|
96
|
+
form#filters input + label,
|
97
|
+
form#filters label + select,
|
98
|
+
form#filters select + label { margin: 12px 0 0; }
|
99
|
+
|
100
|
+
input#category-filter,
|
101
|
+
input#vendor-filter { border-bottom: none; }
|
102
|
+
|
103
|
+
form#filters fieldset {
|
104
|
+
border: none;
|
105
|
+
margin: 12px 0;
|
106
|
+
padding: 0;
|
107
|
+
}
|
108
|
+
</style>
|
109
|
+
<% end %>
|
110
|
+
|
111
|
+
<% content_for :caboose_js do %>
|
112
|
+
<%= javascript_include_tag 'underscore' %>
|
113
|
+
|
114
|
+
<script>
|
115
|
+
window.count = <%= @variants.count %>;
|
116
|
+
window.categories = <%= @categories.collect { |category| "#{category.id}:#{category.url.gsub('/products/', '')}" }.compact.to_json.html_safe %>;
|
117
|
+
window.vendors = <%= @vendors.collect { |vendor| "#{vendor.id}:#{vendor.name}" unless vendor.name.nil? or vendor.name.empty? }.compact.to_json.html_safe %>;
|
118
|
+
|
119
|
+
$(document).ready(function() {
|
120
|
+
$('#toggle-filters').on('click', toggle_filters);
|
121
|
+
$('#category-filter').on('keyup', filter_categories);
|
122
|
+
$('#vendor-filter').on('keyup', filter_vendors);
|
123
|
+
if (window.count == 0) toggle_filters();
|
124
|
+
});
|
125
|
+
|
126
|
+
function toggle_filters() {
|
127
|
+
$('form#filters').toggle();
|
128
|
+
}
|
129
|
+
|
130
|
+
function filter_categories() {
|
131
|
+
var $categories = $('#categories');
|
132
|
+
|
133
|
+
// Get value to test against from input
|
134
|
+
var string = $('#category-filter').val().toLowerCase();
|
135
|
+
|
136
|
+
// Filter category names
|
137
|
+
var filtered_categories = _.filter(window.categories, function(category) { return category.toLowerCase().indexOf(string) != -1; });
|
138
|
+
|
139
|
+
// Empty category select box
|
140
|
+
$categories.empty();
|
141
|
+
|
142
|
+
// Append filtered category names
|
143
|
+
_.each(filtered_categories, function(category) {
|
144
|
+
var $option = $(document.createElement('option'))
|
145
|
+
, id = category.split(':')[0]
|
146
|
+
, name = category.split(':')[1];
|
147
|
+
|
148
|
+
// Set attributes
|
149
|
+
$option.val(id);
|
150
|
+
$option.text(name);
|
151
|
+
|
152
|
+
// Append to select
|
153
|
+
$categories.append($option);
|
154
|
+
});
|
155
|
+
}
|
156
|
+
|
157
|
+
function filter_vendors() {
|
158
|
+
var $vendors = $('#vendors');
|
159
|
+
|
160
|
+
// Get value to test against from input
|
161
|
+
var string = $('#vendor-filter').val().toLowerCase();
|
162
|
+
|
163
|
+
// Filter vendor names
|
164
|
+
var filtered_vendors = _.filter(window.vendors, function(vendor) { return vendor.toLowerCase().indexOf(string) != -1; });
|
165
|
+
|
166
|
+
// Empty vendor select box
|
167
|
+
$vendors.empty();
|
168
|
+
|
169
|
+
// Append filtered vendor names
|
170
|
+
_.each(filtered_vendors, function(vendor) {
|
171
|
+
var $option = $(document.createElement('option'))
|
172
|
+
, id = vendor.split(':')[0]
|
173
|
+
, name = vendor.split(':')[1];
|
174
|
+
|
175
|
+
// Set attributes
|
176
|
+
$option.val(id);
|
177
|
+
$option.text(name);
|
178
|
+
|
179
|
+
// Append to select
|
180
|
+
$vendors.append($option);
|
181
|
+
});
|
182
|
+
}
|
183
|
+
</script>
|
184
|
+
<% end %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
v = @variant
|
4
|
+
%>
|
5
|
+
<%= render :partial => 'caboose/products/admin_header' %>
|
6
|
+
|
7
|
+
<div id='variant_<%= v.id %>_sku'></div>
|
8
|
+
<div id='variant_<%= v.id %>_barcode'></div>
|
9
|
+
<div id='variant_<%= v.id %>_price'></div>
|
10
|
+
<div id='variant_<%= v.id %>_quantity_in_stock'></div>
|
11
|
+
<div id='variant_<%= v.id %>_taxable'></div>
|
12
|
+
<div id='variant_<%= v.id %>_requires_shipping'></div>
|
13
|
+
|
14
|
+
<div id='dimensions_container' style='display: hidden;'>
|
15
|
+
<h2>Dimensions</h2>
|
16
|
+
<div id='variant_<%= v.id %>_weight'></div>
|
17
|
+
<div id='variant_<%= v.id %>_length'></div>
|
18
|
+
<div id='variant_<%= v.id %>_width'></div>
|
19
|
+
<div id='variant_<%= v.id %>_height'></div>
|
20
|
+
<div id='variant_<%= v.id %>_cylinder'></div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div id='message'></div>
|
24
|
+
|
25
|
+
<%= render :partial => 'caboose/products/admin_footer' %>
|
26
|
+
<% content_for :caboose_js do %>
|
27
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
28
|
+
<%= javascript_include_tag "admin_products" %>
|
29
|
+
<script type='text/javascript'>
|
30
|
+
|
31
|
+
$(document).ready(function() {
|
32
|
+
m = new ModelBinder({
|
33
|
+
name: 'Variant',
|
34
|
+
id: <%= v.id %>,
|
35
|
+
update_url: '/admin/variants/<%= v.id %>',
|
36
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
37
|
+
attributes: [
|
38
|
+
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
|
39
|
+
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
|
40
|
+
{ name: 'price' , nice_name: 'Price' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.price ) %>, width: 250 },
|
41
|
+
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
|
42
|
+
{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.weight ) %>, width: 200 },
|
43
|
+
{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.length ) %>, width: 200 },
|
44
|
+
{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.width ) %>, width: 200 },
|
45
|
+
{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.height ) %>, width: 200 },
|
46
|
+
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align_right: true, value: <%= raw Caboose.json(v.cylinder ) %>, width: 200 },
|
47
|
+
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align_right: true, value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 250 },
|
48
|
+
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align_right: true, value: <%= raw Caboose.json(v.taxable ) %>, width: 250 }
|
49
|
+
]
|
50
|
+
});
|
51
|
+
});
|
52
|
+
|
53
|
+
var modal = false;
|
54
|
+
$(window).load(function() {
|
55
|
+
modal = new CabooseModal(800);
|
56
|
+
});
|
57
|
+
|
58
|
+
</script>
|
59
|
+
<% end %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Edit Vendor</h1>
|
2
|
+
<p><div id="vendor_<%= @vendor.id %>_name"></div></p>
|
3
|
+
<p><div id="vendor_<%= @vendor.id %>_status"></div></p>
|
4
|
+
<input type="button" value="< Back" onclick="window.location=/admin/vendors" />
|
5
|
+
<input type="button" value="Delete" onclick="window.location=/admin/vendors/<%= @vendor.id %>/delete" />
|
6
|
+
|
7
|
+
<% content_for :caboose_js do %>
|
8
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
$(document).ready(function() {
|
12
|
+
m = new ModelBinder({
|
13
|
+
id: <%= @vendor.id %>,
|
14
|
+
name: 'Vendor',
|
15
|
+
update_url: '/admin/vendors/<%= @vendor.id %>/update',
|
16
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
17
|
+
attributes: [
|
18
|
+
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= Caboose.json(@vendor.name).html_safe %>, width: 500 },
|
19
|
+
{ name: 'status' , nice_name: 'Status' , type: 'select' , text: <%= raw Caboose.json(@vendor.status).html_safe %>, value: <%= Caboose.json(@vendor.status).html_safe %>, width: 500, options_url: '/admin/vendors/status-options' }
|
20
|
+
]
|
21
|
+
})
|
22
|
+
});
|
23
|
+
</script>
|
24
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1>Vendors</h1>
|
2
|
+
|
3
|
+
<p><a href="/admin/vendors/new">New Vendor</a></p>
|
4
|
+
|
5
|
+
<form action="/admin/vendors" method="get" style="margin: 0 0 12px">
|
6
|
+
<input name="name_like" value="<%= params[:name_like] %>" placeholder="Search for vendor" />
|
7
|
+
<input type="submit" value="Search" />
|
8
|
+
</form>
|
9
|
+
|
10
|
+
<% if @vendors.count > 0 %>
|
11
|
+
<table class="data" style="width: 350px">
|
12
|
+
<tr>
|
13
|
+
<%= raw @pager.sortable_table_headings({
|
14
|
+
'id' => 'ID',
|
15
|
+
'name' => 'Name'
|
16
|
+
}) %>
|
17
|
+
</tr>
|
18
|
+
|
19
|
+
<% @vendors.each do |vendor| %>
|
20
|
+
<tr onclick="window.location='/admin/vendors/<%= vendor.id %>/edit';">
|
21
|
+
<td style="text-align: center"><%= raw vendor.id %></td>
|
22
|
+
<td><%= raw vendor.name %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<p><%= raw @pager.generate %></p>
|
28
|
+
<% else %>
|
29
|
+
<p>There are no products right now.</p>
|
30
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<h1>New Vendor</h1>
|
2
|
+
|
3
|
+
<form id="new-vendor" action="/admin/vendors/create" method="post">
|
4
|
+
<input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>" />
|
5
|
+
<input id="name" name="name" type="text" placeholder="Vendor Name" style="width: 400px" />
|
6
|
+
|
7
|
+
<p>
|
8
|
+
<input type="button" value="< Back" onclick="window.location='/admin/products'" />
|
9
|
+
<input type="submit" value="Add Vendor" />
|
10
|
+
</p>
|
11
|
+
</form>
|
12
|
+
|
13
|
+
<% content_for :caboose_js do %>
|
14
|
+
<script>
|
15
|
+
$(document).ready(function() {
|
16
|
+
$('#new-vendor').on('submit', function(event) {
|
17
|
+
event.preventDefault();
|
18
|
+
|
19
|
+
$.ajax({
|
20
|
+
url: '/admin/vendors/create',
|
21
|
+
type: 'post',
|
22
|
+
data: $(event.delegateTarget).serialize(),
|
23
|
+
success: function(response) {
|
24
|
+
if (response.success) {
|
25
|
+
window.location = response.redirect;
|
26
|
+
} else {
|
27
|
+
alert(response.message);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
});
|
31
|
+
});
|
32
|
+
});
|
33
|
+
</script>
|
34
|
+
<% end %>
|