caboose-cms 0.9.193 → 0.9.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/main.js +35 -34
- data/app/assets/stylesheets/caboose/login.scss +95 -0
- data/app/controllers/caboose/application_controller.rb +1 -1
- data/app/controllers/caboose/block_type_categories_controller.rb +25 -2
- data/app/controllers/caboose/block_types_controller.rb +34 -35
- data/app/controllers/caboose/login_controller.rb +33 -37
- data/app/controllers/caboose/pages_controller.rb +2 -7
- data/app/controllers/caboose/register_controller.rb +12 -14
- data/app/controllers/caboose/users_controller.rb +40 -46
- data/app/mailers/caboose/login_mailer.rb +3 -2
- data/app/models/caboose/authenticator.rb +2 -2
- data/app/models/caboose/block_type_category.rb +4 -2
- data/app/models/caboose/schema.rb +4 -2
- data/app/views/caboose/block_type_categories/admin_edit.html.erb +43 -0
- data/app/views/caboose/block_type_categories/admin_index.html.erb +23 -0
- data/app/{assets/javascripts/caboose/testing.js → views/caboose/block_type_categories/admin_new.html.erb} +0 -0
- data/app/views/caboose/block_types/admin_edit.html.erb +8 -8
- data/app/views/caboose/extras/error.html.erb +1 -1
- data/app/views/caboose/login/forgot_password_form.html.erb +38 -51
- data/app/views/caboose/login/index.html.erb +41 -64
- data/app/views/caboose/login/reset_password_form.html.erb +35 -35
- data/app/views/caboose/register/index.html.erb +51 -44
- data/lib/caboose/version.rb +1 -1
- metadata +6 -8
- data/app/assets/javascripts/caboose/cart_old.js +0 -184
- data/app/assets/javascripts/caboose/checkout_old.js +0 -151
- data/app/assets/javascripts/caboose/product_new.js +0 -306
- data/app/assets/javascripts/caboose/product_old.js +0 -324
- data/app/assets/stylesheets/caboose/login.css +0 -134
@@ -1,324 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// Product
|
3
|
-
//
|
4
|
-
|
5
|
-
Caboose.Store.Modules.Product = (function() {
|
6
|
-
var self = {
|
7
|
-
templates: {
|
8
|
-
images: JST['caboose/product/images'],
|
9
|
-
options: JST['caboose/product/options']
|
10
|
-
}
|
11
|
-
};
|
12
|
-
|
13
|
-
//
|
14
|
-
// Initialize
|
15
|
-
//
|
16
|
-
|
17
|
-
self.initialize = function() {
|
18
|
-
self.$product = $('#product');
|
19
|
-
self.$price = self.$product.find('#product-price');
|
20
|
-
$("<span id='percent-off'></span").insertAfter(self.$price);
|
21
|
-
$("<span id='sale-price'></span").insertBefore(self.$price);
|
22
|
-
if (!self.$product.length) return false;
|
23
|
-
|
24
|
-
$.get('/products/' + self.$product.data('id') + '/info', function(response) {
|
25
|
-
self.product = response.product;
|
26
|
-
self.option1_values = response.option1_values;
|
27
|
-
self.option2_values = response.option2_values;
|
28
|
-
self.option3_values = response.option3_values;
|
29
|
-
self.render();
|
30
|
-
self.bind_events();
|
31
|
-
self.set_variant(self.get_initial_variant());
|
32
|
-
self.set_options_from_variant(self.variant);
|
33
|
-
});
|
34
|
-
|
35
|
-
};
|
36
|
-
|
37
|
-
//
|
38
|
-
// Render
|
39
|
-
//
|
40
|
-
self.render = function() {
|
41
|
-
var render_functions = [];
|
42
|
-
render_functions.push(self.render_images);
|
43
|
-
render_functions.push(self.render_options);
|
44
|
-
|
45
|
-
_.each(render_functions, function(render_function, index) {
|
46
|
-
var finished = index == (render_functions.length - 1);
|
47
|
-
|
48
|
-
render_function(function() {
|
49
|
-
if (finished) self.$product.removeClass('loading');
|
50
|
-
});
|
51
|
-
});
|
52
|
-
};
|
53
|
-
|
54
|
-
self.initalize_zoom = function(image_url) {
|
55
|
-
var big_image = $("#product-images").children("figure").first();
|
56
|
-
big_image.data("zoom-image",image_url);
|
57
|
-
big_image.elevateZoom();
|
58
|
-
}
|
59
|
-
|
60
|
-
self.render_images = function(callback) {
|
61
|
-
self.$images = $('#product-images', self.$product);
|
62
|
-
if (!self.$images.length) return false;
|
63
|
-
self.$images.empty().html(self.templates.images({ images: self.product.images }));
|
64
|
-
if (callback) callback();
|
65
|
-
};
|
66
|
-
|
67
|
-
self.render_options = function(callback) {
|
68
|
-
self.$options = $('#product-options', self.$options);
|
69
|
-
if (!self.$options.length) return false;
|
70
|
-
self.$options.empty().html(self.templates.options({ options: self.get_options_with_all_values() }));
|
71
|
-
if (callback) callback();
|
72
|
-
};
|
73
|
-
|
74
|
-
//
|
75
|
-
// Out of Stock
|
76
|
-
//
|
77
|
-
|
78
|
-
self.out_of_stock = function() {
|
79
|
-
self.$product.find('#add-to-cart').after($('<p/>').addClass('message error').text('Out of Stock')).remove();
|
80
|
-
};
|
81
|
-
|
82
|
-
//
|
83
|
-
// Events
|
84
|
-
//
|
85
|
-
|
86
|
-
self.bind_events = function() {
|
87
|
-
self.$images.find('ul > li > figure').on('click', self.thumb_click_handler);
|
88
|
-
self.$images.children('figure').on('click', self.image_click_handler);
|
89
|
-
self.$options.find('ul').on('click', 'li', self.option_click_handler);
|
90
|
-
};
|
91
|
-
|
92
|
-
self.thumb_click_handler = function(event) {
|
93
|
-
self.$images.children('figure').css('background-image', 'url(' + $(event.target).data('url-large') + ')');
|
94
|
-
self.initalize_zoom($(event.target).data('url-large').replace('large','huge'));
|
95
|
-
};
|
96
|
-
|
97
|
-
self.image_click_handler = function(event) {
|
98
|
-
window.location = $(event.target).css('background-image').match(/^url\("(.*)"\)$/)[1];
|
99
|
-
};
|
100
|
-
|
101
|
-
self.option_click_handler = function(event) {
|
102
|
-
var $target_option = $(event.delegateTarget)
|
103
|
-
var $target_value = $(event.target);
|
104
|
-
|
105
|
-
if ($target_value.hasClass('selected')) {
|
106
|
-
$target_value.removeClass('selected');
|
107
|
-
$target_value = $();
|
108
|
-
} else {
|
109
|
-
$target_value.addClass('selected').siblings().removeClass('selected');
|
110
|
-
|
111
|
-
self.$options.find('ul').not($target_option).each(function(index, element) {
|
112
|
-
var $currentOption = $(element)
|
113
|
-
, $currentValue = $currentOption.children('.selected')
|
114
|
-
, $otherOption = self.$options.find('ul').not($target_option.add($currentOption))
|
115
|
-
, $otherValue = $otherOption.children('.selected')
|
116
|
-
, options = [];
|
117
|
-
|
118
|
-
if (!$currentValue.length) return true;
|
119
|
-
|
120
|
-
options.push({ name: $currentOption.data('name'), value: $currentValue.data('value') });
|
121
|
-
options.push({ name: $target_option.data('name'), value: $target_value.data('value') });
|
122
|
-
|
123
|
-
if (!!!self.get_variant_from_options(options)) {
|
124
|
-
$currentValue.removeClass('selected');
|
125
|
-
} else if ($otherOption.length && $otherValue.length) {
|
126
|
-
options.push({ name: $otherOption.data('name'), value: $otherValue.data('value') });
|
127
|
-
if (!!!self.get_variant_from_options(options)) $otherValue.removeClass('selected');
|
128
|
-
}
|
129
|
-
});
|
130
|
-
|
131
|
-
$target_option.children().each(function(index, element) {
|
132
|
-
var $currentOption = $target_option
|
133
|
-
, $currentValue = $(element)
|
134
|
-
, $otherOption = self.$options.find('ul').not($target_option).first()
|
135
|
-
, $otherValue = $otherOption.children('.selected')
|
136
|
-
, $otherOtherOption = self.$options.find('ul').not($target_option.add($otherOption))
|
137
|
-
, $otherOtherValue = $otherOtherOption.children('.selected')
|
138
|
-
, options = [];
|
139
|
-
|
140
|
-
options.push({ name: $currentOption.data('name'), value: $currentValue.data('value') });
|
141
|
-
if ($otherOption.length && $otherValue.length) options.push({ name: $otherOption.data('name'), value: $otherValue.data('value') });
|
142
|
-
if ($otherOtherOption.length && $otherOtherValue.length) options.push({ name: $otherOtherOption.data('name'), value: $otherOtherValue.data('value') });
|
143
|
-
self.toggle_option_value($currentValue, !!self.get_variant_from_options(options));
|
144
|
-
});
|
145
|
-
}
|
146
|
-
|
147
|
-
self.$options.find('ul').not($target_option).each(function(index, element) {
|
148
|
-
var $currentOption = $(element);
|
149
|
-
|
150
|
-
$currentOption.children().each(function(index, element) {
|
151
|
-
var $currentValue = $(element)
|
152
|
-
, $otherOption = self.$options.find('ul').not($target_option.add($currentOption))
|
153
|
-
, $otherValue = $otherOption.children('.selected')
|
154
|
-
, options = [];
|
155
|
-
|
156
|
-
options.push({ name: $currentOption.data('name'), value: $currentValue.data('value') });
|
157
|
-
if ($target_option.length && $target_value.length) options.push({ name: $target_option.data('name'), value: $target_value.data('value') });
|
158
|
-
if ($otherOption.length && $otherValue.length) options.push({ name: $otherOption.data('name'), value: $otherValue.data('value') });
|
159
|
-
self.toggle_option_value($currentValue, !!self.get_variant_from_options(options));
|
160
|
-
});
|
161
|
-
});
|
162
|
-
|
163
|
-
self.set_variant(self.get_variant_from_options(self.get_current_options()));
|
164
|
-
};
|
165
|
-
|
166
|
-
//
|
167
|
-
// Option Methods
|
168
|
-
//
|
169
|
-
|
170
|
-
self.get_options_from_product = function() {
|
171
|
-
return _.compact([
|
172
|
-
self.product.option1 ? self.product.option1 : undefined,
|
173
|
-
self.product.option2 ? self.product.option2 : undefined,
|
174
|
-
self.product.option3 ? self.product.option3 : undefined
|
175
|
-
]);
|
176
|
-
};
|
177
|
-
|
178
|
-
|
179
|
-
self.get_options_from_variant = function(variant) {
|
180
|
-
return _.compact([
|
181
|
-
self.product.option1 ? { name: self.product.option1, value: variant.option1 } : undefined,
|
182
|
-
self.product.option2 ? { name: self.product.option2, value: variant.option2 } : undefined,
|
183
|
-
self.product.option3 ? { name: self.product.option3, value: variant.option3 } : undefined
|
184
|
-
]);
|
185
|
-
};
|
186
|
-
|
187
|
-
self.get_options_with_all_values = function() {
|
188
|
-
var options = [];
|
189
|
-
if (self.product.option1) options.push({ name: self.product.option1, values: self.option1_values });
|
190
|
-
if (self.product.option2) options.push({ name: self.product.option2, values: self.option2_values });
|
191
|
-
if (self.product.option3) options.push({ name: self.product.option3, values: self.option3_values });
|
192
|
-
return options;
|
193
|
-
};
|
194
|
-
|
195
|
-
self.get_option_attribute = function(option) {
|
196
|
-
optionName = _.isObject(option) ? option.name : option;
|
197
|
-
|
198
|
-
if (self.product.option1 == optionName) {
|
199
|
-
return 'option1';
|
200
|
-
} else if (self.product.option2 == optionName) {
|
201
|
-
return 'option2';
|
202
|
-
} else if (self.product.option3 == optionName) {
|
203
|
-
return 'option3';
|
204
|
-
}
|
205
|
-
};
|
206
|
-
|
207
|
-
self.get_current_options = function() {
|
208
|
-
var options = [];
|
209
|
-
|
210
|
-
self.$options.children('ul').each(function(index, element) {
|
211
|
-
var $option = $(element);
|
212
|
-
|
213
|
-
options.push({
|
214
|
-
name: $option.data('name'),
|
215
|
-
value: $option.children('.selected').first().data('value')
|
216
|
-
});
|
217
|
-
});
|
218
|
-
|
219
|
-
return options;
|
220
|
-
};
|
221
|
-
|
222
|
-
self.toggle_option_value = function($value, on) {
|
223
|
-
if (on) {
|
224
|
-
$value.addClass('available').removeClass('unavailable');
|
225
|
-
} else {
|
226
|
-
$value.addClass('unavailable').removeClass('available selected');
|
227
|
-
}
|
228
|
-
};
|
229
|
-
|
230
|
-
//
|
231
|
-
// Variant Methods
|
232
|
-
//
|
233
|
-
|
234
|
-
self.get_initial_variant = function () {
|
235
|
-
var variant = _.find(self.product.variants, function(variant) {
|
236
|
-
return variant.quantity_in_stock > 0;
|
237
|
-
});
|
238
|
-
|
239
|
-
if (!variant) {
|
240
|
-
variant = _.first(self.product.variants);
|
241
|
-
self.out_of_stock();
|
242
|
-
}
|
243
|
-
|
244
|
-
return variant;
|
245
|
-
};
|
246
|
-
|
247
|
-
self.get_variant_from_options = function(options) {
|
248
|
-
if (_.find(options, function(option) { return option.value == undefined })) return false;
|
249
|
-
|
250
|
-
var attributes = _.object(_.map(options, function(option) {
|
251
|
-
return [self.get_option_attribute(option.name), option.value.toString()]
|
252
|
-
}));
|
253
|
-
|
254
|
-
var variants = _.sortBy(_.where(self.product.variants, attributes), function(variant) { return variant.price });
|
255
|
-
return _.find(variants, function(variant) { return variant.quantity_in_stock > 0 });
|
256
|
-
};
|
257
|
-
|
258
|
-
self.set_options_from_variant = function(variant) {
|
259
|
-
if (variant.option1) $('#option1 li[data-value="' + variant.option1 + '"]', self.$options).click();
|
260
|
-
if (variant.option1) $('#option2 li[data-value="' + variant.option2 + '"]', self.$options).click();
|
261
|
-
if (variant.option1) $('#option3 li[data-value="' + variant.option3 + '"]', self.$options).click();
|
262
|
-
};
|
263
|
-
|
264
|
-
self.set_variant = function(variant) {
|
265
|
-
self.variant = variant;
|
266
|
-
Caboose.Store.Modules.Cart.set_variant(variant);
|
267
|
-
if (variant) self.set_image_from_variant(variant);
|
268
|
-
if (variant && self.$price.length) self.$price.empty().text('$' + parseFloat((variant.price * 100) / 100).toFixed(2));
|
269
|
-
if (variant && self.variant_on_sale(variant)) {
|
270
|
-
self.$price.addClass("on-sale");
|
271
|
-
var percent = 100 - ((variant.sale_price / variant.price) * 100).toFixed(0);
|
272
|
-
$("#percent-off").text("SALE! Save " + percent + "%");
|
273
|
-
$("#sale-price").text('$' + parseFloat((variant.sale_price * 100) / 100).toFixed(2));
|
274
|
-
}
|
275
|
-
else {
|
276
|
-
self.$price.removeClass("on-sale");
|
277
|
-
$("#percent-off").text('');
|
278
|
-
$("#sale-price").text('');
|
279
|
-
}
|
280
|
-
};
|
281
|
-
|
282
|
-
self.variant_on_sale = function(variant) {
|
283
|
-
var is_on_sale = false;
|
284
|
-
if (variant.sale_price != "" && variant.sale_price != 0) {
|
285
|
-
var d = new Date();
|
286
|
-
if (variant.date_sale_starts && d < variant.date_sale_starts) {
|
287
|
-
is_on_sale = false;
|
288
|
-
}
|
289
|
-
else if (variant.date_sale_ends && d > variant.date_sale_ends) {
|
290
|
-
is_on_sale = false;
|
291
|
-
}
|
292
|
-
else {
|
293
|
-
is_on_sale = true;
|
294
|
-
}
|
295
|
-
}
|
296
|
-
return is_on_sale;
|
297
|
-
}
|
298
|
-
|
299
|
-
self.get_variant = function(id) {
|
300
|
-
return _.find(self.product.variants, function(variant) { return variant.id == (id || self.variant.id) });
|
301
|
-
};
|
302
|
-
|
303
|
-
//
|
304
|
-
// Image Methods
|
305
|
-
//
|
306
|
-
|
307
|
-
self.set_image_from_variant = function(variant) {
|
308
|
-
if (!variant || !variant.images || variant.images.length == 0 || !variant.images[0]) return;
|
309
|
-
self.$product.trigger('variant:updated');
|
310
|
-
|
311
|
-
var $figure = self.$images.children('figure');
|
312
|
-
if (variant.images && variant.images.length > 0 && variant.images[0]) {
|
313
|
-
$figure.css('background-image', 'url(' + variant.images[0].urls.large + ')');
|
314
|
-
self.initalize_zoom(variant.images[0].urls.huge);
|
315
|
-
} else if ($figure.css('background-image').toLowerCase() == 'none') {
|
316
|
-
$figure.css('background-image', 'url(' + _.first(self.product.images).urls.large + ')');
|
317
|
-
self.initalize_zoom(_.first(self.product.images).urls.huge);
|
318
|
-
}
|
319
|
-
|
320
|
-
};
|
321
|
-
|
322
|
-
return self;
|
323
|
-
}).call(Caboose.Store);
|
324
|
-
|
@@ -1,134 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Login
|
3
|
-
*/
|
4
|
-
|
5
|
-
#modal_content { margin: 0 auto; }
|
6
|
-
|
7
|
-
#login-form {
|
8
|
-
box-sizing: content-box;
|
9
|
-
max-width: 100%;
|
10
|
-
overflow: hidden;
|
11
|
-
padding: 12px 0;
|
12
|
-
position: relative;
|
13
|
-
width: 100%;
|
14
|
-
padding-bottom: 0;
|
15
|
-
}
|
16
|
-
|
17
|
-
#login-form .header {
|
18
|
-
width: 100%;
|
19
|
-
text-align: center;
|
20
|
-
}
|
21
|
-
|
22
|
-
#login-form .header h1 {
|
23
|
-
position: relative;
|
24
|
-
bottom: 7px;
|
25
|
-
margin-bottom: 0;
|
26
|
-
}
|
27
|
-
#login-form .header p {
|
28
|
-
margin: 0;
|
29
|
-
position: relative;
|
30
|
-
bottom: 8px;
|
31
|
-
font-style: italic;
|
32
|
-
font-size: 14px;
|
33
|
-
margin-bottom: 10px;
|
34
|
-
}
|
35
|
-
|
36
|
-
@media all and (max-width: 400px) {
|
37
|
-
#login-form {
|
38
|
-
width: 400px;
|
39
|
-
margin: 0 auto;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
#login-form #login-options {
|
44
|
-
margin: 0;
|
45
|
-
padding: 0;
|
46
|
-
float: right;
|
47
|
-
list-style-type: none;
|
48
|
-
position: relative;
|
49
|
-
right: 13px;
|
50
|
-
}
|
51
|
-
#login-options li {
|
52
|
-
text-align: right;
|
53
|
-
}
|
54
|
-
|
55
|
-
#login-options li a {
|
56
|
-
color: #387a8f;
|
57
|
-
font-size: 0.9em;
|
58
|
-
border-bottom: 0;
|
59
|
-
}
|
60
|
-
|
61
|
-
#login-form input#username {
|
62
|
-
background-image: url('/assets/caboose/login_image.png');
|
63
|
-
background-position: 8px center;
|
64
|
-
}
|
65
|
-
#login-form input#password {
|
66
|
-
background-image: url('/assets/caboose/password_image.png');
|
67
|
-
background-position: 12px center;
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
#login-form input#username,
|
72
|
-
#login-form input#password {
|
73
|
-
font-size: 18px;
|
74
|
-
margin: 0 auto;
|
75
|
-
max-width: 100%;
|
76
|
-
display: block;
|
77
|
-
margin-bottom: 12px;
|
78
|
-
padding: 7px;
|
79
|
-
width: 315px;
|
80
|
-
background-repeat: no-repeat;
|
81
|
-
padding-left: 42px;
|
82
|
-
}
|
83
|
-
|
84
|
-
#login-form label {
|
85
|
-
cursor: pointer;
|
86
|
-
display: block;
|
87
|
-
float: left;
|
88
|
-
position: relative;
|
89
|
-
left: 13px;
|
90
|
-
font-size: 0.9em;
|
91
|
-
color: #a58a32;
|
92
|
-
bottom: 18px;
|
93
|
-
}
|
94
|
-
|
95
|
-
p.buttons {
|
96
|
-
clear: both;
|
97
|
-
margin-top: 80px;
|
98
|
-
overflow: auto;
|
99
|
-
padding: 0 16px;
|
100
|
-
margin-bottom: 0;
|
101
|
-
}
|
102
|
-
|
103
|
-
#login-form input[type=checkbox] { top: 8px; }
|
104
|
-
|
105
|
-
#login-form .btn {
|
106
|
-
font-size: 18px;
|
107
|
-
display: block;
|
108
|
-
width: 48%;
|
109
|
-
padding: 13px 1%;
|
110
|
-
height: auto;
|
111
|
-
border: 0;
|
112
|
-
border-radius: 4px;
|
113
|
-
cursor: pointer;
|
114
|
-
}
|
115
|
-
|
116
|
-
#login-form input.btn[type=button] {
|
117
|
-
background: #d34f46;
|
118
|
-
float: left;
|
119
|
-
}
|
120
|
-
|
121
|
-
#login-form input.btn[type=button]:hover {
|
122
|
-
background: #b53c34;
|
123
|
-
}
|
124
|
-
|
125
|
-
#login-form input[type=submit] {
|
126
|
-
background: #1c9a7f;
|
127
|
-
float: right;
|
128
|
-
}
|
129
|
-
|
130
|
-
#login-form input[type=submit]:hover {
|
131
|
-
background: #096652;
|
132
|
-
}
|
133
|
-
|
134
|
-
|