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,438 @@
|
|
1
|
+
<style type='text/css'>
|
2
|
+
.heads {
|
3
|
+
display: none;
|
4
|
+
}
|
5
|
+
#easy_zoom img { min-width: 1200px; }
|
6
|
+
#easy_zoom {
|
7
|
+
width:550px;
|
8
|
+
height:400px;
|
9
|
+
border:5px solid #eee;
|
10
|
+
background:#fff;
|
11
|
+
color:#333;
|
12
|
+
position:absolute;
|
13
|
+
top:148px;
|
14
|
+
left:635px;
|
15
|
+
overflow:hidden;
|
16
|
+
-moz-box-shadow:0 0 10px #777;
|
17
|
+
-webkit-box-shadow:0 0 10px #777;
|
18
|
+
box-shadow:0 0 10px #777;
|
19
|
+
/* vertical and horizontal alignment used for preloader text */
|
20
|
+
line-height:400px;
|
21
|
+
text-align:center;
|
22
|
+
}
|
23
|
+
#login-btn { cursor: pointer; }
|
24
|
+
.thumbnail {
|
25
|
+
width: 60px !important;
|
26
|
+
height: 60px !important;
|
27
|
+
overflow: hidden !important;
|
28
|
+
padding: 1px !important;
|
29
|
+
background-color: #ccc !important;
|
30
|
+
}
|
31
|
+
#itemsingle .carousel-indicators li:nth-child(3n) {
|
32
|
+
margin-right: 13px !important;
|
33
|
+
}
|
34
|
+
a.zoom-image {
|
35
|
+
position: relative;
|
36
|
+
display: block;
|
37
|
+
}
|
38
|
+
a.zoom-image .fullsize-loading {
|
39
|
+
position:absolute;
|
40
|
+
z-index:150;
|
41
|
+
}
|
42
|
+
div.product_thumb_image {
|
43
|
+
overflow: hidden;
|
44
|
+
}
|
45
|
+
div.product_thumb_image img {
|
46
|
+
margin: 0 auto;
|
47
|
+
}
|
48
|
+
ol.carousel-indicators li.thumbnail {
|
49
|
+
width: 100px;
|
50
|
+
height: 100px;
|
51
|
+
}
|
52
|
+
.product-review {
|
53
|
+
list-style:none;
|
54
|
+
margin-left:0;
|
55
|
+
padding:15px;
|
56
|
+
}
|
57
|
+
.product-review:nth-child(odd) {
|
58
|
+
background-color: rgb(240, 240, 240);
|
59
|
+
}
|
60
|
+
</style>
|
61
|
+
<% p = @product %>
|
62
|
+
|
63
|
+
<div class="page-content">
|
64
|
+
<div class="container">
|
65
|
+
<div class="row-fluid">
|
66
|
+
<div class="span12">
|
67
|
+
<ul class="breadcrumb">
|
68
|
+
<li><a href="/">Home</a>
|
69
|
+
<% if p.categories[1] %>
|
70
|
+
<span class="divider">/</span></li>
|
71
|
+
<% p.categories[1].ancestry.each do |c| %>
|
72
|
+
<% if c != p.categories[1] %>
|
73
|
+
<li><a href="<%= c.url %>"><%= c.name %></a> <span class="divider">/</span></li>
|
74
|
+
<% else %>
|
75
|
+
<li><a href="<%= c.url %>"><%= c.name %></a></li>
|
76
|
+
<% end %>
|
77
|
+
<% end %>
|
78
|
+
<% else %>
|
79
|
+
</li>
|
80
|
+
<% end %>
|
81
|
+
</ul>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class="row-fluid">
|
86
|
+
<div class="span12 single-item">
|
87
|
+
<div class="row-fluid">
|
88
|
+
<div class="span5">
|
89
|
+
<div id="itemsingle" class="carousel slide clearfix">
|
90
|
+
<div class="carousel-inner">
|
91
|
+
<% if p.product_images != [] %>
|
92
|
+
<% p.product_images.each_index do |i| %>
|
93
|
+
<% if i == 0 %>
|
94
|
+
<div class="item active" id="img_<%= p.product_images[i].id %>" style='position: relative;'>
|
95
|
+
<% else %>
|
96
|
+
<div class="item" id="img_<%= p.product_images[i].id %>" style='position: relative;'>
|
97
|
+
<% end %>
|
98
|
+
<a href="<%= p.product_images[i].url(:huge) %>" class="zoom-image" title="<%= p.title %>">
|
99
|
+
<img src="<%= p.product_images[i].url(:large) %>" title="<%= p.title %>" />
|
100
|
+
</a>
|
101
|
+
</div>
|
102
|
+
<% end %>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<ol class="carousel-indicators">
|
106
|
+
<% p.product_images.each_index do |i| %>
|
107
|
+
<li class='thumbnail' id="thumb_<%= p.product_images[i].id %>" data-target="#itemsingle" data-slide-to="<%= i %>">
|
108
|
+
<div class='product_thumb_image' style="<%= square_image(p.product_images[i]) %> height:100px; background-size:100px;"></div>
|
109
|
+
</li>
|
110
|
+
<% end %>
|
111
|
+
</ol>
|
112
|
+
<% else %>
|
113
|
+
<div class="item active" style='position: relative;'>
|
114
|
+
<img src="https://dmwwflw4i3miv.cloudfront.net/placeholder.jpg" title="<%= p.title %>" />
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<% end
|
118
|
+
# end p.product_images
|
119
|
+
%>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<div class="span7">
|
124
|
+
<h3><%= p.title %></h3>
|
125
|
+
<div class="row-fluid">
|
126
|
+
<div class="span6">
|
127
|
+
<% if @average > 0 %>
|
128
|
+
<span class="rateit" data-rateit-value="<%= @average %>" data-rateit-ispreset="true" data-rateit-readonly="true" style="margin-bottom:10px;"></span>
|
129
|
+
<% end %>
|
130
|
+
<% if p.option1 && p.option1.strip.length > 0 %>
|
131
|
+
<% default = p.default1 ? p.default1 : p.variants[0].option1 %>
|
132
|
+
<select name='option1' id='option1'>
|
133
|
+
<optgroup label="Select a <%= p.option1 %>">
|
134
|
+
<% p.variants.where(:status => 'Active').collect{|v| v.option1}.reject{|str| str.nil? }.uniq.sort.each do |v| %>
|
135
|
+
<option value="<%= v %>"<%= raw v == default ? " selected='true'" : '' %>><%= v %></option>
|
136
|
+
<% end %>
|
137
|
+
</optgroup>
|
138
|
+
</select>
|
139
|
+
<br>
|
140
|
+
<% end %>
|
141
|
+
<% if p.option2 && p.option2.strip.length > 0 %>
|
142
|
+
<% default = p.default2 ? p.default2 : p.variants[0].option2 %>
|
143
|
+
<select name='option2' id='option2'>
|
144
|
+
<optgroup label="Select a <%= p.option2 %>">
|
145
|
+
<% p.variants.where(:status => 'Active').collect{|v| v.option2}.compact.uniq.sort.each do |v| %>
|
146
|
+
<option value="<%= v %>"<%= raw v == default ? " selected='true'" : '' %>><%= v %></option>
|
147
|
+
<% end %>
|
148
|
+
</optgroup>
|
149
|
+
</select>
|
150
|
+
<br>
|
151
|
+
<% end %>
|
152
|
+
<% if p.option3 && p.option3.strip.length > 0 %>
|
153
|
+
<% default = p.default3 ? p.default3 : p.variants[0].option3 %>
|
154
|
+
<select name='option3' id='option3'>
|
155
|
+
<optgroup label="Select a <%= p.option3 %>">
|
156
|
+
<% p.variants.where(:status => 'Active').collect{|v| v.option3}.reject{|str| str.nil?}.uniq.sort.each do |v| %>
|
157
|
+
<option value="<%= v %>"<%= raw v == default ? " selected='true'" : '' %>><%= v %></option>
|
158
|
+
<% end %>
|
159
|
+
</optgroup>
|
160
|
+
</select>
|
161
|
+
<br>
|
162
|
+
<% end %>
|
163
|
+
<span id='variant_qty'></span>
|
164
|
+
</div>
|
165
|
+
<div class="span6">
|
166
|
+
<h4>$<span id="variant_price"><%= p.most_popular_variant.price %></span></h4>
|
167
|
+
<p id="add_cart_btn"><a href="#" class="btn btn-warning btn-large"><i class="icon-shopping-cart"></i> Add to Cart</a></p>
|
168
|
+
<p class="btn btn-warning btn-large" id="sold_out_btn" style="display:none;"><i class="icon-shopping-cart"></i> Sold Out</p>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
<br><br>
|
172
|
+
<p><%= strip_tags(p.description) %></p>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div class="row-fluid">
|
177
|
+
<div class="span12">
|
178
|
+
<div class="tabbable">
|
179
|
+
<ul class="nav nav-tabs">
|
180
|
+
<li class="active"><a href="#tab1" data-toggle="tab">Product Features</a></li>
|
181
|
+
<li class=""><a href="#tab2" data-toggle="tab">Recent Reviews</a></li>
|
182
|
+
<li class=""><a href="#tab3" data-toggle="tab">Related Items</a></li>
|
183
|
+
</ul>
|
184
|
+
<div class="tab-content">
|
185
|
+
<div class="tab-pane active" id="tab1">
|
186
|
+
<p><%= strip_tags(p.description) %></p>
|
187
|
+
</div>
|
188
|
+
<div class="tab-pane" id="tab2">
|
189
|
+
<ul>
|
190
|
+
<% if @reviews.present? %>
|
191
|
+
<% @reviews.each do |r| %>
|
192
|
+
<li class='product-review'>
|
193
|
+
<% if r.rating && r.rating != 0 %>
|
194
|
+
<div class="rateit" data-rateit-value="<%= r.rating %>" data-rateit-ispreset="true" data-rateit-readonly="true" style="margin-right:10px;"></div>
|
195
|
+
<% end %>
|
196
|
+
<span style="font-weight:bold;"><%= r.name %></span>
|
197
|
+
<p><%= r.content %></p>
|
198
|
+
</li>
|
199
|
+
<%
|
200
|
+
end # @reviews.each do |r|
|
201
|
+
%>
|
202
|
+
<% else %>
|
203
|
+
<p>No reviews yet.</p>
|
204
|
+
<%
|
205
|
+
end # if @reviews.present?
|
206
|
+
%>
|
207
|
+
</ul>
|
208
|
+
<span id="message"></span>
|
209
|
+
<div id="add-new-review">
|
210
|
+
<hr style="display:block !important;"/>
|
211
|
+
Submit Your Review
|
212
|
+
<br>
|
213
|
+
<div class="rateit" id="new-rating"></div>
|
214
|
+
<br>
|
215
|
+
<form id="new_review">
|
216
|
+
<textarea name="content" cols="90" rows="3"></textarea>
|
217
|
+
<input type="hidden" name="product_id" value='<%= p.id %>' />
|
218
|
+
</form>
|
219
|
+
<button id="submit_review">Submit</button>
|
220
|
+
<br>
|
221
|
+
<br>
|
222
|
+
</div>
|
223
|
+
<div id="login-section">
|
224
|
+
<p>To submit a review, please <a id='login-btn'>log in</a>.</p>
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
<div class="tab-pane" id="tab3">
|
228
|
+
<div class="row-fluid">
|
229
|
+
<% if p.related_items && p.related_items.count > 0 %>
|
230
|
+
<ul class="thumbnails">
|
231
|
+
<% p.related_items.each do |p2| %>
|
232
|
+
<li class="span4">
|
233
|
+
<div class="thumbnail">
|
234
|
+
<div class="caption-details">
|
235
|
+
<h5><%= p2.title %></h5>
|
236
|
+
<span class="price"><%= raw product_price(p2) %></span>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
</li>
|
240
|
+
<% end %>
|
241
|
+
</ul>
|
242
|
+
<% else %>
|
243
|
+
<p>This product doesn't have any related items yet.</p>
|
244
|
+
<% end %>
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
<!--break-->
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
<%= content_for :caboose_js do %>
|
258
|
+
<%= javascript_include_tag 'caboose/modules/cart' %>
|
259
|
+
<%= javascript_include_tag 'caboose/modules/product' %>
|
260
|
+
<script type='text/javascript'>
|
261
|
+
|
262
|
+
var option1 = <%= raw p.option1 ? p.option1.to_json : false %>;
|
263
|
+
var option2 = <%= raw p.option2 ? p.option2.to_json : false %>;
|
264
|
+
var option3 = <%= raw p.option3 ? p.option3.to_json : false %>;
|
265
|
+
var default1 = <%= raw p.default1 ? p.default1.to_json : false %>;
|
266
|
+
var default2 = <%= raw p.default2 ? p.default2.to_json : false %>;
|
267
|
+
var default3 = <%= raw p.default3 ? p.default3.to_json : false %>;
|
268
|
+
var variants = <%= raw Caboose.json(p.variants) %>;
|
269
|
+
|
270
|
+
var quantities = {};
|
271
|
+
|
272
|
+
function get_variant_for_options()
|
273
|
+
{
|
274
|
+
var v1 = option1 ? $('#option1').val() : false;
|
275
|
+
var v2 = option2 ? $('#option2').val() : false;
|
276
|
+
var v3 = option3 ? $('#option3').val() : false;
|
277
|
+
|
278
|
+
var variant = false;
|
279
|
+
$.each(variants, function(i, v) {
|
280
|
+
if (v.option1 == v1 && (!option2 || (v.option2 == v2 && (!option3 || v.option3 == v3))))
|
281
|
+
{
|
282
|
+
variant = v;
|
283
|
+
return false;
|
284
|
+
}
|
285
|
+
});
|
286
|
+
return variant;
|
287
|
+
}
|
288
|
+
|
289
|
+
function show_variant_image() {
|
290
|
+
var v = get_variant_for_options();
|
291
|
+
if (!v) return;
|
292
|
+
|
293
|
+
var rurl = "/variant-images/" + v.id;
|
294
|
+
$.ajax({
|
295
|
+
type: 'get',
|
296
|
+
url: rurl,
|
297
|
+
success: function(img) {
|
298
|
+
if(img) {
|
299
|
+
var image = "#img_" + img.id;
|
300
|
+
var thumb = "#thumb_" + img.id;
|
301
|
+
$(".item").removeClass("active");
|
302
|
+
$(".thumbnail").removeClass("active");
|
303
|
+
$(image).addClass("active");
|
304
|
+
$(thumb).addClass("active");
|
305
|
+
}
|
306
|
+
}
|
307
|
+
});
|
308
|
+
}
|
309
|
+
|
310
|
+
function set_status()
|
311
|
+
{
|
312
|
+
var v = get_variant_for_options();
|
313
|
+
if (!v || v.quantity_in_stock == 0)
|
314
|
+
{
|
315
|
+
$("#variant_qty").html("Sold Out").css("color","red");
|
316
|
+
$("#add_cart_btn").hide();
|
317
|
+
$("#sold_out_btn").show();
|
318
|
+
if (v && v.price > 0) $("#variant_price").html(v.price);
|
319
|
+
}
|
320
|
+
else
|
321
|
+
{
|
322
|
+
$("#variant_qty").html("In Stock").css("color","green");
|
323
|
+
$("#add_cart_btn").show();
|
324
|
+
$("#sold_out_btn").hide();
|
325
|
+
if (v && v.price > 0) $("#variant_price").html(v.price);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
function add_to_cart()
|
330
|
+
{
|
331
|
+
var v = get_variant_for_options();
|
332
|
+
if (!v) return;
|
333
|
+
|
334
|
+
$.colorbox({
|
335
|
+
href: '/cart/add/' + v.id,
|
336
|
+
iframe: true,
|
337
|
+
initialWidth: 400,
|
338
|
+
initialHeight: 200,
|
339
|
+
innerWidth: 400,
|
340
|
+
innerHeight: 200,
|
341
|
+
scrolling: false,
|
342
|
+
transition: 'fade',
|
343
|
+
closeButton: false,
|
344
|
+
onComplete: fix_colorbox,
|
345
|
+
opacity: 0.50
|
346
|
+
});
|
347
|
+
}
|
348
|
+
|
349
|
+
// Added to application footer
|
350
|
+
//function fix_colorbox() {
|
351
|
+
// var padding = 21; // 21 is default
|
352
|
+
// $("#cboxTopLeft" ).css('background', '#111');
|
353
|
+
// $("#cboxTopRight" ).css('background', '#111');
|
354
|
+
// $("#cboxBottomLeft" ).css('background', '#111');
|
355
|
+
// $("#cboxBottomRight" ).css('background', '#111');
|
356
|
+
// $("#cboxMiddleLeft" ).css('background', '#111');
|
357
|
+
// $("#cboxMiddleRight" ).css('background', '#111');
|
358
|
+
// $("#cboxTopCenter" ).css('background', '#111');
|
359
|
+
// $("#cboxBottomCenter" ).css('background', '#111');
|
360
|
+
// $("#cboxClose" ).hide();
|
361
|
+
//
|
362
|
+
// //var p = (padding-21)*2;
|
363
|
+
// //$("#cboxWrapper" ).css('padding', '0 ' + p + ' ' + p + ' 0');
|
364
|
+
// //$('#cboxLoadedContent').css('margin-bottom', 0);
|
365
|
+
// //h = $('#cboxLoadedContent').height();
|
366
|
+
// //$('#cboxLoadedContent').css('height', ''+(h+28)+'px');
|
367
|
+
//}
|
368
|
+
|
369
|
+
$(document).ready(function() {
|
370
|
+
show_variant_image();
|
371
|
+
if (option1) $('#option1').change(function() { set_status(); show_variant_image(); });
|
372
|
+
if (option2) $('#option2').change(function() { set_status(); show_variant_image(); });
|
373
|
+
if (option3) $('#option3').change(function() { set_status(); show_variant_image(); });
|
374
|
+
set_status();
|
375
|
+
$('.zoom-image').each( function() { $(this).easyZoom(); });
|
376
|
+
$('#add_cart_btn a').click(function(e) {
|
377
|
+
e.preventDefault();
|
378
|
+
add_to_cart();
|
379
|
+
});
|
380
|
+
});
|
381
|
+
|
382
|
+
|
383
|
+
</script>
|
384
|
+
|
385
|
+
<% if @is_logged_in %>
|
386
|
+
<script type='text/javascript'>
|
387
|
+
$("#login-section").hide();
|
388
|
+
$("#submit_review").click( function() {
|
389
|
+
var info = $("#new_review").serialize();
|
390
|
+
info += "&rating=" + $("#new-rating").rateit("value") + "&name=" + "<%= @first_name %>" + "+" + "<%= @last_name %>";
|
391
|
+
$.post("/reviews/add", info, function(data, status) { window.location.reload(true); });
|
392
|
+
$("#add-new-review").slideUp();
|
393
|
+
$("#message").html("<p class='note success'>Review added successfully</p>");
|
394
|
+
});
|
395
|
+
|
396
|
+
</script>
|
397
|
+
|
398
|
+
|
399
|
+
<% else %>
|
400
|
+
<script type='text/javascript'>
|
401
|
+
$("#add-new-review").hide();
|
402
|
+
$("#login-btn").click( function() {
|
403
|
+
open_colorbox();
|
404
|
+
});
|
405
|
+
|
406
|
+
function open_colorbox() {
|
407
|
+
$.colorbox({
|
408
|
+
href: '/login?return_url=/products/<%= p.id %>',
|
409
|
+
iframe: true,
|
410
|
+
innerWidth: 200,
|
411
|
+
innerHeight: 50,
|
412
|
+
scrolling: false,
|
413
|
+
transition: 'fade',
|
414
|
+
closeButton: false,
|
415
|
+
onComplete: fix_colorbox,
|
416
|
+
opacity: 0.50,
|
417
|
+
// onClosed: function() { open_colorbox(); }
|
418
|
+
});
|
419
|
+
}
|
420
|
+
|
421
|
+
function fix_colorbox() {
|
422
|
+
$("#cboxTopLeft" ).css('background', '#111');
|
423
|
+
$("#cboxTopRight" ).css('background', '#111');
|
424
|
+
$("#cboxBottomLeft" ).css('background', '#111');
|
425
|
+
$("#cboxBottomRight" ).css('background', '#111');
|
426
|
+
$("#cboxMiddleLeft" ).css('background', '#111');
|
427
|
+
$("#cboxMiddleRight" ).css('background', '#111');
|
428
|
+
$("#cboxTopCenter" ).css('background', '#111');
|
429
|
+
$("#cboxBottomCenter" ).css('background', '#111');
|
430
|
+
$("#cboxClose" ).hide();
|
431
|
+
}
|
432
|
+
|
433
|
+
</script>
|
434
|
+
<% end %>
|
435
|
+
|
436
|
+
|
437
|
+
<% end %>
|
438
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
<div id="catalogue">
|
3
|
+
<div class="container">
|
4
|
+
<div class="row-fluid">
|
5
|
+
<div class="span12">
|
6
|
+
<ul class="breadcrumb">
|
7
|
+
<li><a href="/">Home</a><span class="divider">/</span></li>
|
8
|
+
|
9
|
+
<% @category.ancestry.each do |c| %>
|
10
|
+
<% if c != @category %>
|
11
|
+
<li><a href="<%= c.url %>"><%= c.name %></a> <span class="divider">/</span></li>
|
12
|
+
<% else %>
|
13
|
+
<li><a href="<%= c.url %>"><%= c.name %></a></li>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="row-fluid">
|
21
|
+
<div class="span12">
|
22
|
+
<h2><%= @category.name %></h2>
|
23
|
+
<ul class="thumbs">
|
24
|
+
|
25
|
+
<% if @category.children && @category.children.count > 0 %>
|
26
|
+
<% @category.children.each do |cat| %>
|
27
|
+
<% if cat.id != 32 && cat.products != [] %>
|
28
|
+
<%= render partial: 'category_thumb', locals: {category: cat} %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if @category.products && @category.products.count > 0 %>
|
34
|
+
<% @category.products.each do |p| %>
|
35
|
+
<% if p.status == "Active" && p.variants != [] %>
|
36
|
+
<%= render partial: 'product_thumb', locals: {product: p} %>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|