caboose-store 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +113 -0
- data/Rakefile +38 -0
- data/app/assets/images/caboose_store/caboose_logo_small.png +0 -0
- data/app/assets/images/caboose_store/caboose_nav.png +0 -0
- data/app/assets/images/caboose_store/caboose_nav_black.png +0 -0
- data/app/assets/images/caboose_store/default_user_pic.png +0 -0
- data/app/assets/images/caboose_store/loading_green.gif +0 -0
- data/app/assets/images/caboose_store/loading_small_white_on_black.gif +0 -0
- data/app/assets/images/caboose_store/loading_white_on_black.gif +0 -0
- data/app/assets/javascripts/caboose_store/admin.js +20 -0
- data/app/assets/javascripts/caboose_store/application.js +17 -0
- data/app/assets/javascripts/caboose_store/modal.js +52 -0
- data/app/assets/javascripts/caboose_store/modal_integration.js +25 -0
- data/app/assets/javascripts/caboose_store/model.form.page.js +30 -0
- data/app/assets/javascripts/caboose_store/model.form.user.js +36 -0
- data/app/assets/javascripts/caboose_store/shortcut.js +11 -0
- data/app/assets/javascripts/caboose_store/station.js +60 -0
- data/app/assets/stylesheets/caboose_store/admin.css +100 -0
- data/app/assets/stylesheets/caboose_store/application.css +19 -0
- data/app/assets/stylesheets/caboose_store/bound_input.css +1 -0
- data/app/assets/stylesheets/caboose_store/caboose.css +4 -0
- data/app/assets/stylesheets/caboose_store/fonts/big_noodle_titling.ttf +0 -0
- data/app/assets/stylesheets/caboose_store/fonts/big_noodle_titling_oblique.ttf +0 -0
- data/app/assets/stylesheets/caboose_store/fonts.css +5 -0
- data/app/assets/stylesheets/caboose_store/login.css +23 -0
- data/app/assets/stylesheets/caboose_store/modal.css +240 -0
- data/app/assets/stylesheets/caboose_store/page_bar_generator.css +34 -0
- data/app/assets/stylesheets/caboose_store/register.css +25 -0
- data/app/assets/stylesheets/caboose_store/station_modal.css +104 -0
- data/app/assets/stylesheets/caboose_store/station_sidebar.css +232 -0
- data/app/assets/stylesheets/caboose_store/tinymce.css +25 -0
- data/app/controllers/caboose_store/application_controller.rb +18 -0
- data/app/controllers/caboose_store/cart_controller.rb +59 -0
- data/app/controllers/caboose_store/categories_controller.rb +128 -0
- data/app/controllers/caboose_store/checkout_controller.rb +164 -0
- data/app/controllers/caboose_store/orders_controller.rb +264 -0
- data/app/controllers/caboose_store/product_images_controller.rb +38 -0
- data/app/controllers/caboose_store/products_controller.rb +387 -0
- data/app/controllers/caboose_store/reviews_controller.rb +15 -0
- data/app/controllers/caboose_store/variants_controller.rb +152 -0
- data/app/helpers/caboose_store/application_helper.rb +46 -0
- data/app/helpers/caboose_store/cart_helper.rb +28 -0
- data/app/helpers/caboose_store/categories_helper.rb +38 -0
- data/app/helpers/caboose_store/products_helper.rb +87 -0
- data/app/mailers/caboose_store/orders_mailer.rb +36 -0
- data/app/models/caboose_store/address.rb +30 -0
- data/app/models/caboose_store/caboose_store_plugin.rb +22 -0
- data/app/models/caboose_store/category.rb +63 -0
- data/app/models/caboose_store/category_membership.rb +11 -0
- data/app/models/caboose_store/discount.rb +14 -0
- data/app/models/caboose_store/message.rb +22 -0
- data/app/models/caboose_store/order.rb +97 -0
- data/app/models/caboose_store/order_discount.rb +11 -0
- data/app/models/caboose_store/order_line_item.rb +13 -0
- data/app/models/caboose_store/order_pdf.rb +82 -0
- data/app/models/caboose_store/product.rb +78 -0
- data/app/models/caboose_store/product_image.rb +25 -0
- data/app/models/caboose_store/product_image_variant.rb +10 -0
- data/app/models/caboose_store/review.rb +13 -0
- data/app/models/caboose_store/schema.rb +146 -0
- data/app/models/caboose_store/shipping_calculator.rb +79 -0
- data/app/models/caboose_store/states.rb +60 -0
- data/app/models/caboose_store/tax_calculator.rb +26 -0
- data/app/models/caboose_store/tax_line.rb +12 -0
- data/app/models/caboose_store/variant.rb +42 -0
- data/app/models/caboose_store/vendor.rb +7 -0
- data/app/views/caboose_store/application/_category_thumb.html.erb +6 -0
- data/app/views/caboose_store/application/_product_thumb.html.erb +13 -0
- data/app/views/caboose_store/cart/index.html.erb +19 -0
- data/app/views/caboose_store/categories/admin_edit.html.erb +82 -0
- data/app/views/caboose_store/categories/admin_index.html.erb +13 -0
- data/app/views/caboose_store/categories/admin_new.html.erb +45 -0
- data/app/views/caboose_store/checkout/billing.html.erb +168 -0
- data/app/views/caboose_store/checkout/discount.html.erb +166 -0
- data/app/views/caboose_store/checkout/index.html.erb +113 -0
- data/app/views/caboose_store/checkout/quantity_box.html.erb +39 -0
- data/app/views/caboose_store/checkout/shipping.html.erb +90 -0
- data/app/views/caboose_store/checkout/thank_you.html.erb +36 -0
- data/app/views/caboose_store/layouts/_banner.html.erb +10 -0
- data/app/views/caboose_store/layouts/_banner2.html.erb +10 -0
- data/app/views/caboose_store/layouts/_footer.html.erb +55 -0
- data/app/views/caboose_store/layouts/_header.html.erb +69 -0
- data/app/views/caboose_store/layouts/_sidebar.html.erb +27 -0
- data/app/views/caboose_store/layouts/application.html.erb +33 -0
- data/app/views/caboose_store/layouts/authorize_net.erb +18 -0
- data/app/views/caboose_store/layouts/layout_about.html.erb +42 -0
- data/app/views/caboose_store/layouts/layout_blog.html.erb +159 -0
- data/app/views/caboose_store/layouts/layout_confirm.html.erb +85 -0
- data/app/views/caboose_store/layouts/layout_contact.html.erb +38 -0
- data/app/views/caboose_store/layouts/layout_default.html.erb +10 -0
- data/app/views/caboose_store/layouts/layout_detail.html.erb +114 -0
- data/app/views/caboose_store/layouts/layout_order.html.erb +77 -0
- data/app/views/caboose_store/layouts/layout_pricing.html.erb +182 -0
- data/app/views/caboose_store/layouts/layout_product.html.erb +110 -0
- data/app/views/caboose_store/layouts/layout_profile.html.erb +55 -0
- data/app/views/caboose_store/layouts/layout_single.html.erb +3 -0
- data/app/views/caboose_store/layouts/layout_testimonial.html.erb +110 -0
- data/app/views/caboose_store/layouts/layout_testing.html.erb +4 -0
- data/app/views/caboose_store/orders/_admin_footer.html.erb +2 -0
- data/app/views/caboose_store/orders/_admin_header.html.erb +31 -0
- data/app/views/caboose_store/orders/_quickbooks_order.html.erb +0 -0
- data/app/views/caboose_store/orders/admin_delete_form.html.erb +21 -0
- data/app/views/caboose_store/orders/admin_edit.html.erb +173 -0
- data/app/views/caboose_store/orders/admin_index.html.erb +79 -0
- data/app/views/caboose_store/orders/admin_new.html.erb +42 -0
- data/app/views/caboose_store/orders/admin_print.html.erb +72 -0
- data/app/views/caboose_store/orders_mailer/customer_new_order.html.erb +47 -0
- data/app/views/caboose_store/orders_mailer/customer_status_updated.html.erb +49 -0
- data/app/views/caboose_store/orders_mailer/fulfillment_new_order.html.erb +43 -0
- data/app/views/caboose_store/orders_mailer/shipping_order_ready.html.erb +46 -0
- data/app/views/caboose_store/products/_admin_footer.html.erb +2 -0
- data/app/views/caboose_store/products/_admin_header.html.erb +31 -0
- data/app/views/caboose_store/products/admin_delete_form.html.erb +21 -0
- data/app/views/caboose_store/products/admin_edit_categories.html.erb +73 -0
- data/app/views/caboose_store/products/admin_edit_category_images.html.erb +233 -0
- data/app/views/caboose_store/products/admin_edit_description.html.erb +41 -0
- data/app/views/caboose_store/products/admin_edit_general.html.erb +47 -0
- data/app/views/caboose_store/products/admin_edit_images.html.erb +234 -0
- data/app/views/caboose_store/products/admin_edit_options.html.erb +51 -0
- data/app/views/caboose_store/products/admin_edit_seo.html.erb +37 -0
- data/app/views/caboose_store/products/admin_edit_variant_columns.html.erb +75 -0
- data/app/views/caboose_store/products/admin_edit_variants.html.erb +101 -0
- data/app/views/caboose_store/products/admin_edit_variants_single.html.erb +68 -0
- data/app/views/caboose_store/products/admin_index.html.erb +47 -0
- data/app/views/caboose_store/products/admin_new.html.erb +41 -0
- data/app/views/caboose_store/products/details.html.erb +437 -0
- data/app/views/caboose_store/products/index.html.erb +46 -0
- data/app/views/caboose_store/products/not_available.html.erb +35 -0
- data/app/views/caboose_store/variants/admin_edit.html.erb +80 -0
- data/app/views/caboose_store/variants/admin_new.html.erb +59 -0
- data/config/routes.rb +95 -0
- data/lib/caboose-store/caboose_store_helper.rb +35 -0
- data/lib/caboose-store/engine.rb +8 -0
- data/lib/caboose-store/version.rb +3 -0
- data/lib/caboose-store.rb +9 -0
- data/lib/tasks/caboose-store.rake +17 -0
- data/test/caboose_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +25 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +260 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
has_options = p.options && p.options.count > 0
|
4
|
+
may_delete1 = p.variants.collect{|v| v.option1 }.uniq.count == 1
|
5
|
+
may_delete2 = p.variants.collect{|v| v.option2 }.uniq.count == 1
|
6
|
+
may_delete3 = p.variants.collect{|v| v.option3 }.uniq.count == 1
|
7
|
+
%>
|
8
|
+
<%= render :partial => 'caboose_store/products/admin_header' %>
|
9
|
+
|
10
|
+
<p class='note' style='font-size: 85%; font-weight: normal; line-height: 140%;'>Product options allow you to present a group of similar products as a single
|
11
|
+
product to the end user. Common options include color, size, and style.
|
12
|
+
But an option can be anything. So for example, you could create a "Sleave" option for
|
13
|
+
shirts that are either long or short sleeved. Or you could create a "Tip" option
|
14
|
+
for chopsticks that are either rounded or squared at the tip. It's up to you.</p>
|
15
|
+
|
16
|
+
<table>
|
17
|
+
<tr><td><div id='product_<%= p.id %>_option1'></div></td><td><div id='product_<%= p.id %>_default1'></div></td></tr>
|
18
|
+
<tr><td><div id='product_<%= p.id %>_option2'></div></td><td><div id='product_<%= p.id %>_default2'></div></td></tr>
|
19
|
+
<tr><td><div id='product_<%= p.id %>_option3'></div></td><td><div id='product_<%= p.id %>_default3'></div></td></tr>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<div id='message'></div>
|
23
|
+
|
24
|
+
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
25
|
+
<% content_for :caboose_js do %>
|
26
|
+
<script type='text/javascript'>
|
27
|
+
|
28
|
+
var modal = false;
|
29
|
+
$(window).load(function() {
|
30
|
+
modal = new CabooseModal(800);
|
31
|
+
});
|
32
|
+
|
33
|
+
$(document).ready(function() {
|
34
|
+
m = new ModelBinder({
|
35
|
+
name: 'Product',
|
36
|
+
id: <%= p.id %>,
|
37
|
+
update_url: '/admin/products/<%= p.id %>',
|
38
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
39
|
+
attributes: [
|
40
|
+
{ name: 'option1' , nice_name: 'Option 1' , type: 'text', value: <%= raw Caboose.json(p.option1) %>, width: 250, fixed_placeholder: true },
|
41
|
+
{ name: 'option2' , nice_name: 'Option 2' , type: 'text', value: <%= raw Caboose.json(p.option2) %>, width: 250, fixed_placeholder: true },
|
42
|
+
{ name: 'option3' , nice_name: 'Option 3' , type: 'text', value: <%= raw Caboose.json(p.option3) %>, width: 250, fixed_placeholder: true },
|
43
|
+
{ name: 'default1' , nice_name: 'Default value' , type: 'text', value: <%= raw Caboose.json(p.default1) %>, width: 285, fixed_placeholder: true },
|
44
|
+
{ name: 'default2' , nice_name: 'Default value' , type: 'text', value: <%= raw Caboose.json(p.default2) %>, width: 285, fixed_placeholder: true },
|
45
|
+
{ name: 'default3' , nice_name: 'Default value' , type: 'text', value: <%= raw Caboose.json(p.default3) %>, width: 285, fixed_placeholder: true }
|
46
|
+
]
|
47
|
+
});
|
48
|
+
});
|
49
|
+
|
50
|
+
</script>
|
51
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose_store/products/admin_header' %>
|
5
|
+
|
6
|
+
<p><div id='product_<%= p.id %>_handle'></div></p>
|
7
|
+
<p><div id='product_<%= p.id %>_seo_title'></div></p>
|
8
|
+
<p><div id='product_<%= p.id %>_seo_description'></div></p>
|
9
|
+
|
10
|
+
<div id='message'><%= raw flash[:message] ? flash[:message] : "" %></div>
|
11
|
+
|
12
|
+
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
13
|
+
|
14
|
+
<% content_for :caboose_js do %>
|
15
|
+
<script type='text/javascript'>
|
16
|
+
|
17
|
+
$(document).ready(function() {
|
18
|
+
m = new ModelBinder({
|
19
|
+
name: 'Product',
|
20
|
+
id: <%= p.id %>,
|
21
|
+
update_url: '/admin/products/<%= p.id %>',
|
22
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
23
|
+
attributes: [
|
24
|
+
{ name: 'handle' , nice_name: 'URL Handle' , type: 'text' , value: <%= raw Caboose.json(p.handle ) %>, width: 500 },
|
25
|
+
{ name: 'seo_title' , nice_name: 'SEO Page Title' , type: 'text' , value: <%= raw Caboose.json(p.seo_title ) %>, width: 500 },
|
26
|
+
{ name: 'seo_description' , nice_name: 'SEO Meta Description' , type: 'textarea' , value: <%= raw Caboose.json(p.seo_description ) %>, width: 500, height: 200 }
|
27
|
+
]
|
28
|
+
});
|
29
|
+
});
|
30
|
+
|
31
|
+
var modal = false;
|
32
|
+
$(window).load(function() {
|
33
|
+
modal = new CabooseModal(800);
|
34
|
+
});
|
35
|
+
|
36
|
+
</script>
|
37
|
+
<% end %>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
%>
|
4
|
+
<%= render :partial => 'caboose_store/products/admin_header' %>
|
5
|
+
|
6
|
+
<p class='note'>Check which columns you want to show in the list of variants.</p>
|
7
|
+
<table>
|
8
|
+
<tr>
|
9
|
+
<td valign='top'>
|
10
|
+
<div id='variantcol_1_option1' ></div>
|
11
|
+
<div id='variantcol_1_option2' ></div>
|
12
|
+
<div id='variantcol_1_option3' ></div>
|
13
|
+
</td><td valign='top'>
|
14
|
+
<div id='variantcol_1_status' ></div>
|
15
|
+
<div id='variantcol_1_sku' ></div>
|
16
|
+
<div id='variantcol_1_barcode' ></div>
|
17
|
+
<div id='variantcol_1_price' ></div>
|
18
|
+
<div id='variantcol_1_quantity_in_stock' ></div>
|
19
|
+
</td><td valign='top'>
|
20
|
+
<div id='variantcol_1_weight' ></div>
|
21
|
+
<div id='variantcol_1_length' ></div>
|
22
|
+
<div id='variantcol_1_width' ></div>
|
23
|
+
<div id='variantcol_1_height' ></div>
|
24
|
+
<div id='variantcol_1_cylinder' ></div>
|
25
|
+
</td><td valign='top'>
|
26
|
+
<div id='variantcol_1_requires_shipping' ></div>
|
27
|
+
<div id='variantcol_1_allow_backorder' ></div>
|
28
|
+
<div id='variantcol_1_taxable' ></div>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
</table>
|
32
|
+
<div id='message'></div>
|
33
|
+
<p><input type='button' value='< Back' onclick="window.location='/admin/products/<%= p.id %>/variants';" /></p>
|
34
|
+
|
35
|
+
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
36
|
+
<% content_for :caboose_js do %>
|
37
|
+
<script type='text/javascript'>
|
38
|
+
|
39
|
+
$(document).ready(function() {
|
40
|
+
<% p.variants.each do |v| %>
|
41
|
+
new ModelBinder({
|
42
|
+
name: 'VariantCol',
|
43
|
+
id: 1,
|
44
|
+
update_url: '/admin/products/<%= p.id %>/variant-cols',
|
45
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
46
|
+
attributes: [
|
47
|
+
<% if p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
|
48
|
+
<% if p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
|
49
|
+
<% if p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'checkbox', align: 'right', value: <%= @cols['option1' ] == true ? true : false %>, width: 150 },<% end %>
|
50
|
+
{ name: 'status' , nice_name: 'Status' , type: 'checkbox', align: 'right', value: <%= @cols['status' ] == true ? true : false %>, width: 150 },
|
51
|
+
{ name: 'sku' , nice_name: 'SKU' , type: 'checkbox', align: 'right', value: <%= @cols['sku' ] == true ? true : false %>, width: 150 },
|
52
|
+
{ name: 'barcode' , nice_name: 'Barcode' , type: 'checkbox', align: 'right', value: <%= @cols['barcode' ] == true ? true : false %>, width: 150 },
|
53
|
+
{ name: 'price' , nice_name: 'Price' , type: 'checkbox', align: 'right', value: <%= @cols['price' ] == true ? true : false %>, width: 150 },
|
54
|
+
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'checkbox', align: 'right', value: <%= @cols['quantity_in_stock'] == true ? true : false %>, width: 150 },
|
55
|
+
{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'checkbox', align: 'right', value: <%= @cols['weight' ] == true ? true : false %>, width: 175 },
|
56
|
+
{ name: 'length' , nice_name: 'Length (in)' , type: 'checkbox', align: 'right', value: <%= @cols['length' ] == true ? true : false %>, width: 175 },
|
57
|
+
{ name: 'width' , nice_name: 'Width (in)' , type: 'checkbox', align: 'right', value: <%= @cols['width' ] == true ? true : false %>, width: 175 },
|
58
|
+
{ name: 'height' , nice_name: 'Height (in)' , type: 'checkbox', align: 'right', value: <%= @cols['height' ] == true ? true : false %>, width: 175 },
|
59
|
+
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox', align: 'right', value: <%= @cols['cylinder' ] == true ? true : false %>, width: 175 },
|
60
|
+
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox', align: 'right', value: <%= @cols['requires_shipping'] == true ? true : false %>, width: 200 },
|
61
|
+
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox', align: 'right', value: <%= @cols['taxable' ] == true ? true : false %>, width: 200 },
|
62
|
+
{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox', align: 'right', value: <%= @cols['allow_backorder' ] == true ? true : false %>, width: 200 },
|
63
|
+
|
64
|
+
]
|
65
|
+
});
|
66
|
+
<% end %>
|
67
|
+
});
|
68
|
+
|
69
|
+
var modal = false;
|
70
|
+
$(window).load(function() {
|
71
|
+
modal = new CabooseModal(800);
|
72
|
+
});
|
73
|
+
|
74
|
+
</script>
|
75
|
+
<% end %>
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
v = @variant
|
4
|
+
%>
|
5
|
+
<%= render :partial => 'caboose_store/products/admin_header' %>
|
6
|
+
<p style='font-size: 75%;'><a href='/admin/products/<%= p.id %>/variant-cols'>Edit visible columns</a></p>
|
7
|
+
|
8
|
+
<div id='message'></div>
|
9
|
+
|
10
|
+
<div id='variants_wrapper'>
|
11
|
+
<table id='variants'>
|
12
|
+
<tr>
|
13
|
+
<% if @cols['option1' ] && p.option1 %><th valign='bottom'><%= p.option1 %></th><% end %>
|
14
|
+
<% if @cols['option2' ] && p.option2 %><th valign='bottom'><%= p.option2 %></th><% end %>
|
15
|
+
<% if @cols['option3' ] && p.option3 %><th valign='bottom'><%= p.option3 %></th><% end %>
|
16
|
+
<% if @cols['status' ] == true %><th valign='bottom'>Status </th><% end %>
|
17
|
+
<% if @cols['alternate_id' ] == true %><th valign='bottom'>Alternate ID </th><% end %>
|
18
|
+
<% if @cols['sku' ] == true %><th valign='bottom'>SKU </th><% end %>
|
19
|
+
<% if @cols['barcode' ] == true %><th valign='bottom'>Barcode </th><% end %>
|
20
|
+
<% if @cols['price' ] == true %><th valign='bottom'>Price </th><% end %>
|
21
|
+
<% if @cols['quantity_in_stock' ] == true %><th valign='bottom'>Quantity </th><% end %>
|
22
|
+
<% if @cols['weight' ] == true %><th valign='bottom'>Weight </th><% end %>
|
23
|
+
<% if @cols['length' ] == true %><th valign='bottom'>Length </th><% end %>
|
24
|
+
<% if @cols['width' ] == true %><th valign='bottom'>Width </th><% end %>
|
25
|
+
<% if @cols['height' ] == true %><th valign='bottom'>Height </th><% end %>
|
26
|
+
<% if @cols['cylinder' ] == true %><th valign='bottom'>Cylinder </th><% end %>
|
27
|
+
<% if @cols['requires_shipping' ] == true %><th valign='bottom'>Requires Shipping </th><% end %>
|
28
|
+
<% if @cols['allow_backorder' ] == true %><th valign='bottom'>Allow Backorder </th><% end %>
|
29
|
+
<% if @cols['taxable' ] == true %><th valign='bottom'>Taxable </th><% end %>
|
30
|
+
<th> </th>
|
31
|
+
<th> </th>
|
32
|
+
</tr>
|
33
|
+
<% p.variants.where(:status => ['Active', 'Inactive']).each do |v| %>
|
34
|
+
<tr>
|
35
|
+
<% if @cols['option1' ] && p.option1 %><td><div id='variant_<%= v.id %>_option1' ></div></td><% end %>
|
36
|
+
<% if @cols['option2' ] && p.option2 %><td><div id='variant_<%= v.id %>_option2' ></div></td><% end %>
|
37
|
+
<% if @cols['option3' ] && p.option3 %><td><div id='variant_<%= v.id %>_option3' ></div></td><% end %>
|
38
|
+
<% if @cols['status' ] == true %><td><div id='variant_<%= v.id %>_status' ></div></td><% end %>
|
39
|
+
<% if @cols['alternate_id' ] == true %><td><div id='variant_<%= v.id %>_alternate_id' ></div></td><% end %>
|
40
|
+
<% if @cols['sku' ] == true %><td><div id='variant_<%= v.id %>_sku' ></div></td><% end %>
|
41
|
+
<% if @cols['barcode' ] == true %><td><div id='variant_<%= v.id %>_barcode' ></div></td><% end %>
|
42
|
+
<% if @cols['price' ] == true %><td><div id='variant_<%= v.id %>_price' ></div></td><% end %>
|
43
|
+
<% if @cols['quantity_in_stock' ] == true %><td><div id='variant_<%= v.id %>_quantity_in_stock' ></div></td><% end %>
|
44
|
+
<% if @cols['weight' ] == true %><td><div id='variant_<%= v.id %>_weight' ></div></td><% end %>
|
45
|
+
<% if @cols['length' ] == true %><td><div id='variant_<%= v.id %>_length' ></div></td><% end %>
|
46
|
+
<% if @cols['width' ] == true %><td><div id='variant_<%= v.id %>_width' ></div></td><% end %>
|
47
|
+
<% if @cols['height' ] == true %><td><div id='variant_<%= v.id %>_height' ></div></td><% end %>
|
48
|
+
<% if @cols['cylinder' ] == true %><td><div id='variant_<%= v.id %>_cylinder' ></div></td><% end %>
|
49
|
+
<% if @cols['requires_shipping' ] == true %><td><div id='variant_<%= v.id %>_requires_shipping' ></div></td><% end %>
|
50
|
+
<% if @cols['allow_backorder' ] == true %><td><div id='variant_<%= v.id %>_allow_backorder' ></div></td><% end %>
|
51
|
+
<% if @cols['taxable' ] == true %><td><div id='variant_<%= v.id %>_taxable' ></div></td><% end %>
|
52
|
+
<td class='edit'><a href='/admin/products/<%= p.id %>/variants/<%= v.id %>/edit'>Edit</a></td>
|
53
|
+
<td class='delete'><a href='#' onclick='delete_variant(<%= v.id %>);'>Delete</a></td>
|
54
|
+
</tr>
|
55
|
+
<% end %>
|
56
|
+
</table>
|
57
|
+
</div>
|
58
|
+
<p><input type='button' value='New Variant' onclick="add_variant(<%= p.id %>);" /></p>
|
59
|
+
|
60
|
+
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
61
|
+
|
62
|
+
<% content_for :caboose_js do %>
|
63
|
+
<script type='text/javascript'>
|
64
|
+
|
65
|
+
$(document).ready(function() {
|
66
|
+
<% p.variants.each do |v| %>
|
67
|
+
new ModelBinder({
|
68
|
+
name: 'Variant',
|
69
|
+
id: <%= v.id %>,
|
70
|
+
update_url: '/admin/variants/<%= v.id %>',
|
71
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
72
|
+
attributes: [
|
73
|
+
<% if @cols['option1' ] && p.option1 %>{ name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option1 ) %>, width: 75, fixed_placeholder: false },<% end %>
|
74
|
+
<% if @cols['option2' ] && p.option2 %>{ name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option2 ) %>, width: 75, fixed_placeholder: false },<% end %>
|
75
|
+
<% if @cols['option3' ] && p.option3 %>{ name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.option3 ) %>, width: 75, fixed_placeholder: false },<% end %>
|
76
|
+
<% if @cols['status' ] == true %>{ name: 'status' , nice_name: 'Status' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.status ) %>, width: 75, fixed_placeholder: false },<% end %>
|
77
|
+
<% if @cols['alternate_id' ] == true %>{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 75, fixed_placeholder: false },<% end %>
|
78
|
+
<% if @cols['sku' ] == true %>{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.sku ) %>, width: 75, fixed_placeholder: false },<% end %>
|
79
|
+
<% if @cols['barcode' ] == true %>{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'left' , value: <%= raw Caboose.json(v.barcode ) %>, width: 75, fixed_placeholder: false },<% end %>
|
80
|
+
<% if @cols['price' ] == true %>{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.price ) %>, width: 75, fixed_placeholder: false },<% end %>
|
81
|
+
<% if @cols['quantity_in_stock' ] == true %>{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 50, fixed_placeholder: false },<% end %>
|
82
|
+
<% if @cols['weight' ] == true %>{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 50, fixed_placeholder: false },<% end %>
|
83
|
+
<% if @cols['length' ] == true %>{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.length ) %>, width: 50, fixed_placeholder: false },<% end %>
|
84
|
+
<% if @cols['width' ] == true %>{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.width ) %>, width: 50, fixed_placeholder: false },<% end %>
|
85
|
+
<% if @cols['height' ] == true %>{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.height ) %>, width: 50, fixed_placeholder: false },<% end %>
|
86
|
+
<% if @cols['cylinder' ] == true %>{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.cylinder ) %>, width: 50, fixed_placeholder: false },<% end %>
|
87
|
+
<% if @cols['requires_shipping' ] == true %>{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 50, fixed_placeholder: false },<% end %>
|
88
|
+
<% if @cols['taxable' ] == true %>{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.taxable ) %>, width: 50, fixed_placeholder: false },<% end %>
|
89
|
+
<% if @cols['allow_backorder' ] == true %>{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'center', value: <%= raw Caboose.json(v.allow_backorder ) %>, width: 50, fixed_placeholder: false } <% end %>
|
90
|
+
]
|
91
|
+
});
|
92
|
+
<% end %>
|
93
|
+
});
|
94
|
+
|
95
|
+
var modal = false;
|
96
|
+
$(window).load(function() {
|
97
|
+
modal = new CabooseModal('100%');
|
98
|
+
});
|
99
|
+
|
100
|
+
</script>
|
101
|
+
<% end %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
v = @variant
|
4
|
+
%>
|
5
|
+
<%= render :partial => 'caboose_store/products/admin_header' %>
|
6
|
+
|
7
|
+
<p style='font-size: 75%;'><a href='/admin/products/<%= p.id %>/options'>Need options like color or size?</a></p>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<tr>
|
11
|
+
<td valign='top'>
|
12
|
+
<div id='variant_<%= v.id %>_alternate_id' ></div>
|
13
|
+
<div id='variant_<%= v.id %>_sku' ></div>
|
14
|
+
<div id='variant_<%= v.id %>_barcode' ></div>
|
15
|
+
<div id='variant_<%= v.id %>_price' ></div>
|
16
|
+
<div id='variant_<%= v.id %>_quantity_in_stock' ></div>
|
17
|
+
<div id='variant_<%= v.id %>_allow_backorder' ></div>
|
18
|
+
<div id='variant_<%= v.id %>_taxable' ></div>
|
19
|
+
</td><td valign='top'>
|
20
|
+
<div id='variant_<%= v.id %>_status' ></div>
|
21
|
+
<div id='variant_<%= v.id %>_requires_shipping' ></div>
|
22
|
+
<div id='variant_<%= v.id %>_weight' ></div>
|
23
|
+
<div id='variant_<%= v.id %>_cylinder' ></div>
|
24
|
+
<div id='variant_<%= v.id %>_length' ></div>
|
25
|
+
<div id='variant_<%= v.id %>_width' ></div>
|
26
|
+
<div id='variant_<%= v.id %>_height' ></div>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
</table>
|
30
|
+
<div id='message'></div>
|
31
|
+
|
32
|
+
<%= render :partial => 'caboose_store/products/admin_footer' %>
|
33
|
+
|
34
|
+
<% content_for :caboose_js do %>
|
35
|
+
<script type='text/javascript'>
|
36
|
+
|
37
|
+
$(document).ready(function() {
|
38
|
+
m = new ModelBinder({
|
39
|
+
name: 'Variant',
|
40
|
+
id: <%= v.id %>,
|
41
|
+
update_url: '/admin/variants/<%= v.id %>',
|
42
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
43
|
+
attributes: [
|
44
|
+
{ 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' },
|
45
|
+
{ name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.alternate_id ) %>, width: 250 },
|
46
|
+
{ name: 'sku' , nice_name: 'SKU' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
|
47
|
+
{ name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
|
48
|
+
{ name: 'price' , nice_name: 'Price' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.price ) %>, width: 250 },
|
49
|
+
{ name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
|
50
|
+
{ name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.weight ) %>, width: 250 },
|
51
|
+
{ name: 'length' , nice_name: 'Length (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.length ) %>, width: 250 },
|
52
|
+
{ name: 'width' , nice_name: 'Width (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.width ) %>, width: 250 },
|
53
|
+
{ name: 'height' , nice_name: 'Height (in)' , type: 'text' , align: 'right' , value: <%= raw Caboose.json(v.height ) %>, width: 250 },
|
54
|
+
{ name: 'cylinder' , nice_name: 'Cylinder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.cylinder ) %>, width: 250 },
|
55
|
+
{ name: 'requires_shipping' , nice_name: 'Requires shipping' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.requires_shipping ) %>, width: 250 },
|
56
|
+
{ name: 'taxable' , nice_name: 'Taxable' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.taxable ) %>, width: 250 },
|
57
|
+
{ name: 'allow_backorder' , nice_name: 'Allow backorder' , type: 'checkbox' , align: 'right' , value: <%= raw Caboose.json(v.allow_backorder ) %>, width: 250 }
|
58
|
+
]
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
var modal = false;
|
63
|
+
$(window).load(function() {
|
64
|
+
modal = new CabooseModal(800);
|
65
|
+
});
|
66
|
+
|
67
|
+
</script>
|
68
|
+
<% end %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<h1>Products</h1>
|
2
|
+
|
3
|
+
<style type='text/css'>
|
4
|
+
#search_form_wrapper { margin-bottom: 10px; position: absolute; top:0; right: 0; }
|
5
|
+
</style>
|
6
|
+
|
7
|
+
<div id='new_button'><a href='/admin/products/new'><span>New Product</span></a></div>
|
8
|
+
|
9
|
+
<div id='search_form_wrapper'>
|
10
|
+
<form action='/admin/products' method='get' id='search_form'>
|
11
|
+
<input type='text' name='id' placeholder='Product ID' value="<%= @gen.params['id'] %>" style='width: 100px;' />
|
12
|
+
<input type='text' name='title_like' placeholder='Title' value="<%= @gen.params['title_like'] %>" style='width: 150px;' />
|
13
|
+
<input type='submit' value='Search' />
|
14
|
+
<input type='button' value='Clear' onclick="window.location='/admin/products';" />
|
15
|
+
</form>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% if @products.count > 0 %>
|
19
|
+
<table class='data' id='properties_table'>
|
20
|
+
<tr>
|
21
|
+
<%= raw @gen.sortable_table_headings({
|
22
|
+
'id' => 'ID',
|
23
|
+
'title' => 'Title',
|
24
|
+
'vendor' => 'Vendor'
|
25
|
+
})
|
26
|
+
%>
|
27
|
+
</tr>
|
28
|
+
<% @products.each do |p| %>
|
29
|
+
<tr onclick="window.location='/admin/products/<%= p.id %>/general';">
|
30
|
+
<td><%= raw p.id %></td>
|
31
|
+
<td><%= raw p.title %></td>
|
32
|
+
<td><%= raw p.vendor.nil? ? 'Unknown' : p.vendor.name %></td>
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</table>
|
36
|
+
<p><%= raw @gen.generate %></p>
|
37
|
+
<% else %>
|
38
|
+
<p>There are no products right now.</p>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<% content_for :caboose_js do %>
|
42
|
+
<script type='text/javascript'>
|
43
|
+
$(document).ready(function() {
|
44
|
+
var modal = new CabooseModal(800);
|
45
|
+
});
|
46
|
+
</script>
|
47
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%
|
2
|
+
p = @product
|
3
|
+
%>
|
4
|
+
<h1>New Product</h1>
|
5
|
+
|
6
|
+
<form action='/admin/products' method='post' id='new_form'>
|
7
|
+
<input type='hidden' name='authenticity_token' value="<%= form_authenticity_token %>" />
|
8
|
+
<p><input type='text' name='title' value='' placeholder='Product Title' style='width: 400px;' /></p>
|
9
|
+
<div id='message'><%= raw flash[:message] ? flash[:message] : "" %></div>
|
10
|
+
<p>
|
11
|
+
<input type='button' value='< Back' onclick="window.location='/admin/products';" />
|
12
|
+
<input type='submit' value='Add Product' onclick='add_product(); return false' />
|
13
|
+
</p>
|
14
|
+
</form>
|
15
|
+
|
16
|
+
<% content_for :caboose_js do %>
|
17
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
18
|
+
<script type='text/javascript'>
|
19
|
+
|
20
|
+
function add_product()
|
21
|
+
{
|
22
|
+
modal.autosize("<p class='loading'>Adding product...</p>");
|
23
|
+
$.ajax({
|
24
|
+
url: '/admin/products',
|
25
|
+
type: 'post',
|
26
|
+
data: $('#new_form').serialize(),
|
27
|
+
success: function(resp) {
|
28
|
+
if (resp.error)
|
29
|
+
modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
30
|
+
if (resp.redirect)
|
31
|
+
window.location = resp.redirect
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
var modal = false;
|
37
|
+
$(window).load(function() {
|
38
|
+
modal = new CabooseModal(800);
|
39
|
+
});
|
40
|
+
</script>
|
41
|
+
<% end %>
|