c80_yax 0.1.0.17 → 0.1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/c80_yax/frontend/item_color_selector/app.js +4 -1
- data/app/assets/javascripts/c80_yax/frontend/item_color_selector/item_color_selector.js +8 -0
- data/app/assets/javascripts/c80_yax/frontend/item_options/app.js +15 -0
- data/app/assets/javascripts/c80_yax/frontend/item_options/item_options.js +41 -0
- data/app/assets/javascripts/c80_yax/frontend/item_quantity_picker/app.js +4 -1
- data/app/assets/javascripts/c80_yax.js.coffee +2 -1
- data/app/assets/stylesheets/c80_yax.scss +2 -1
- data/app/decorators/c80_yax/item_decorator.rb +1 -1
- data/app/helpers/c80_yax/items/shared/buy_options_helper.rb +6 -2
- data/app/helpers/c80_yax/items/shared/color_selector_helper.rb +2 -1
- data/app/helpers/c80_yax/items/shared/quantity_picker_helper.rb +2 -2
- data/app/views/c80_yax/items/_buy_options.html.erb +11 -9
- data/app/views/c80_yax/items/_color_selector.html.erb +1 -1
- data/app/views/c80_yax/items/_quantity_picker.html.erb +1 -1
- data/engines/co/README.md +79 -0
- data/engines/co/app/assets/javascripts/co/_service/co_modal.js +39 -0
- data/engines/co/app/assets/javascripts/co/_service/cookies_service.js +55 -0
- data/engines/co/app/assets/javascripts/co/add_to_cart/actions/add_row_to_cart.js +17 -0
- data/engines/co/app/assets/javascripts/co/add_to_cart/button_add_to_cart.js +35 -0
- data/engines/co/app/assets/javascripts/co/add_to_cart/data_order_row.js +16 -0
- data/engines/co/app/assets/javascripts/co/add_to_cart/service/collect_data_for_row.js +33 -0
- data/engines/co/app/assets/javascripts/co/add_to_cart/xapp.js +17 -0
- data/engines/co/app/assets/javascripts/co/app.js +7 -0
- data/engines/co/app/assets/javascripts/co/cart_page/app.js +8 -0
- data/engines/co/app/assets/javascripts/co/cart_page/cart_page.js +41 -0
- data/engines/co/app/assets/javascripts/co/cart_page/cart_table.js +49 -0
- data/engines/co/app/assets/javascripts/co/cart_page/support/row_maker.js +38 -0
- data/engines/co/app/assets/javascripts/co.coffee +1 -0
- data/engines/co/app/assets/stylesheets/co/cart_page/_cart_button.scss +13 -0
- data/engines/co/app/assets/stylesheets/co/cart_page/bottom_row.scss +47 -0
- data/engines/co/app/assets/stylesheets/co/cart_page/cart_table.scss +88 -0
- data/engines/co/app/assets/stylesheets/co/modals/double_modal.scss +16 -0
- data/engines/co/app/assets/stylesheets/co.scss +1 -0
- data/engines/co/app/helpers/co/cart_page_helper.rb +7 -0
- data/engines/co/app/helpers/co/modals_helper.rb +11 -0
- data/engines/co/app/views/co/_cart_page.html.erb +41 -0
- data/engines/co/app/views/co/modals/_double_modal.html.erb +23 -0
- data/engines/co/lib/co/engine.rb +23 -0
- data/engines/co/lib/co/version.rb +3 -0
- data/engines/co/lib/co.rb +5 -0
- data/lib/c80_yax/version.rb +1 -1
- data/lib/c80_yax.rb +1 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b913c8fef54a107aba57e59348d9ce469a96e02
|
4
|
+
data.tar.gz: d59d47ce6a4371c48f5c7e70ad7dd20fcdf114a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a68312e1c25af4fda7ede582dee1fb6eb697e331e43d13214288eab7df7c7fe399a747b81019ceb9422688659aa367c2e11895c594acad9eb7f842763ed228e
|
7
|
+
data.tar.gz: fe656f4d6f79951ad7eac7514b71fd8e9e856e39b434afb0448e068ebecaca0a7b2c0d95df52a74117f28e4934a571e4bba96be3646a89075f4759dd64345c5a
|
@@ -1,8 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var ITEM_COLOR_SELECTOR = {};
|
4
|
+
|
3
5
|
var _activate_color_selectors = function() {
|
4
6
|
$('.item_color_selector').each(function() {
|
5
|
-
|
7
|
+
ITEM_COLOR_SELECTOR[$(this).data('id')] =
|
8
|
+
new ItemColorSelector(this);
|
6
9
|
});
|
7
10
|
};
|
8
11
|
|
@@ -6,6 +6,10 @@ var ItemColorSelector = function(wrapper) {
|
|
6
6
|
var _$lic;
|
7
7
|
var _sel_color;
|
8
8
|
|
9
|
+
var _get_sel_color = function() {
|
10
|
+
return _sel_color;
|
11
|
+
};
|
12
|
+
|
9
13
|
var _set_sel_color = function(new_color) {
|
10
14
|
_sel_color = new_color;
|
11
15
|
};
|
@@ -36,4 +40,8 @@ var ItemColorSelector = function(wrapper) {
|
|
36
40
|
|
37
41
|
_fInit(wrapper);
|
38
42
|
|
43
|
+
return {
|
44
|
+
get_cur_val: _get_sel_color
|
45
|
+
}
|
46
|
+
|
39
47
|
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var ITEM_OPTIONS = {};
|
4
|
+
|
5
|
+
var _activate_item_options = function() {
|
6
|
+
$('.buy_options').each(function() {
|
7
|
+
ITEM_OPTIONS[$(this).data('id')] =
|
8
|
+
new ItemOptions(this);
|
9
|
+
});
|
10
|
+
};
|
11
|
+
|
12
|
+
$(document).ready(function() {
|
13
|
+
// alert(ItemQuantityPicker);
|
14
|
+
_activate_item_options();
|
15
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var ItemOptions = function (wrapper){
|
4
|
+
|
5
|
+
var _$wrapper;
|
6
|
+
var _cur_val = {
|
7
|
+
|
8
|
+
};
|
9
|
+
|
10
|
+
var _get_cur_val = function() {
|
11
|
+
return _cur_val;
|
12
|
+
};
|
13
|
+
|
14
|
+
var _fCollectOptions = function() {
|
15
|
+
_$wrapper.find('div.checkbox').each(function() {
|
16
|
+
var $t = $(this);
|
17
|
+
var tag = $t.data('tag');
|
18
|
+
var $inp = $t.find('input');
|
19
|
+
var val = $inp[0].checked;
|
20
|
+
_cur_val[tag] = val;
|
21
|
+
console.log('<_fCollectOptions> val = ' + val + ": " + tag);
|
22
|
+
});
|
23
|
+
console.log(_cur_val);
|
24
|
+
}
|
25
|
+
|
26
|
+
var _fInitBehaviour = function (){
|
27
|
+
_fCollectOptions();
|
28
|
+
};
|
29
|
+
|
30
|
+
var _fInit = function (wrapper){
|
31
|
+
_$wrapper = $(wrapper);
|
32
|
+
_fInitBehaviour();
|
33
|
+
};
|
34
|
+
|
35
|
+
_fInit(wrapper);
|
36
|
+
|
37
|
+
return {
|
38
|
+
get_cur_val: _get_cur_val
|
39
|
+
}
|
40
|
+
|
41
|
+
};
|
@@ -1,8 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var ITEM_QUANTITY_PICKERS = {};
|
4
|
+
|
3
5
|
var _activate_q_picker = function() {
|
4
6
|
$('.quantity_picker').each(function() {
|
5
|
-
|
7
|
+
ITEM_QUANTITY_PICKERS[$(this).data('id')] =
|
8
|
+
new ItemQuantityPicker(this);
|
6
9
|
});
|
7
10
|
};
|
8
11
|
|
@@ -1 +1,2 @@
|
|
1
|
-
#= require_tree ./c80_yax/frontend
|
1
|
+
#= require_tree ./c80_yax/frontend
|
2
|
+
#= require co
|
@@ -89,7 +89,7 @@ module C80Yax
|
|
89
89
|
res = ''
|
90
90
|
props[:titles].each_with_index do |title, i|
|
91
91
|
e = "<p data-title='#{title}' class='old'><span class='pvalue bold'>#{props[:values_old][i]}</span> <span class='puom'>#{_uom(props[:uoms][i])}</span></p>" # 1212,80 руб
|
92
|
-
e += "<p data-title='#{title}'><span class='pvalue bold'>#{props[:values][i]}</span> <span class='puom'>#{_uom(props[:uoms][i])}</span></p>" # 1212,80 руб
|
92
|
+
e += "<p data-title='#{title}' class='cur'><span class='pvalue bold'>#{props[:values][i]}</span> <span class='puom'>#{_uom(props[:uoms][i])}</span></p>" # 1212,80 руб
|
93
93
|
e = "<li>#{e}</li>"
|
94
94
|
res += e
|
95
95
|
end
|
@@ -3,29 +3,33 @@ module C80Yax
|
|
3
3
|
module Shared
|
4
4
|
module BuyOptionsHelper
|
5
5
|
|
6
|
-
def render_buy_options
|
6
|
+
def render_buy_options(item)
|
7
7
|
|
8
8
|
elems = [
|
9
9
|
{
|
10
10
|
label: 'Нестандартные цвета<br>(+20% к стоимости)',
|
11
|
+
tag: 'super_colors',
|
11
12
|
value: '1',
|
12
13
|
style: 'small'
|
13
14
|
},
|
14
15
|
{
|
15
16
|
label: 'Цвета с металлическим блеском<br>(+20% к стоимости)',
|
17
|
+
tag: 'metallic',
|
16
18
|
value: '2',
|
17
19
|
style: 'small'
|
18
20
|
},
|
19
21
|
{
|
20
22
|
label: 'Заказать доставку',
|
21
23
|
value: '3',
|
24
|
+
tag: 'delivery',
|
22
25
|
style: 'huge'
|
23
26
|
}
|
24
27
|
]
|
25
28
|
|
26
29
|
render :partial => 'c80_yax/items/buy_options',
|
27
30
|
:locals => {
|
28
|
-
elems: elems
|
31
|
+
elems: elems,
|
32
|
+
item: item
|
29
33
|
}
|
30
34
|
end
|
31
35
|
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<label>
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
<div class="buy_options" data-id="<%= item.id %>">
|
2
|
+
<% elems.each do |elem| %>
|
3
|
+
<div data-tag="<%=elem[:tag]%>" data-label="<%=elem[:label]%>" class="checkbox <%=elem[:style]%>">
|
4
|
+
<label>
|
5
|
+
<input type="checkbox" checked>
|
6
|
+
<span class="cr"><i class="cr-icon fa fa-check"></i></span>
|
7
|
+
<%= elem[:label].html_safe %>
|
8
|
+
</label>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#### При клике по кнопке "добавить в корзину":
|
2
|
+
* создаётся js объект, содержащий данные:
|
3
|
+
- id товара
|
4
|
+
- кол-во товара
|
5
|
+
- цвет
|
6
|
+
- цена
|
7
|
+
- путь до картинки
|
8
|
+
- путь до товара
|
9
|
+
- заказать доставку?
|
10
|
+
- нестандартные цвета?
|
11
|
+
- металлик?
|
12
|
+
* этот объект помещается в массив, который хранится в cookie
|
13
|
+
* текущий набор объектов в cookie есть список товаров *корзины*
|
14
|
+
- когда заказ оформляется, этот массив отправляется на сервер
|
15
|
+
as-is, сервер на основе их создает объекты модели *OrderRow*
|
16
|
+
* состояние формы заказа товара сбрасывается в начальное
|
17
|
+
* должно появиться оповещение о том, что в корзину добавлен товар
|
18
|
+
* в виджете-кнопке должно обновиться количество
|
19
|
+
|
20
|
+
#### При клике по виджету-кнопке "корзина":
|
21
|
+
* открывается новая страница, содержащая таблицу и форму.
|
22
|
+
* таблица:
|
23
|
+
- картинка-ссылка до товара, новое окно
|
24
|
+
- название
|
25
|
+
- цвет
|
26
|
+
- компонент выбора количества
|
27
|
+
- сумма
|
28
|
+
- кнопка "удалить"
|
29
|
+
* строка "итого"
|
30
|
+
* чекбокс "заказать доставку"
|
31
|
+
* кнопка "очистить корзину"
|
32
|
+
* форма:
|
33
|
+
* ФИО
|
34
|
+
* Мобильный
|
35
|
+
* Дата получения
|
36
|
+
* Населённый пункт
|
37
|
+
|
38
|
+
* когда нажимаем кнопку "отправить", уходит письмо с текстом вида:
|
39
|
+
|
40
|
+
```
|
41
|
+
Заказ:
|
42
|
+
* Снегозадержатель, цвет, кол-во, сумма (опции)
|
43
|
+
* Снегозадержатель, цвет, кол-во, сумма (опции)
|
44
|
+
- доставка?
|
45
|
+
- фио
|
46
|
+
- мобильный
|
47
|
+
- дата получения
|
48
|
+
- населённый пункт
|
49
|
+
```
|
50
|
+
|
51
|
+
* перед тем, как уходит письмо, создаётся Объект `order` содержащий `rows`
|
52
|
+
- [ ] создать модель Order
|
53
|
+
- [ ] создать модель Row
|
54
|
+
- [ ]
|
55
|
+
|
56
|
+
# Todo Добавить в Корзину
|
57
|
+
|
58
|
+
* [X] Лабаем js-класс `DataOrderRow`
|
59
|
+
* [ ] Вешаем js на клик по кнопке "Добавить в корзину". Он должен:
|
60
|
+
- [X] Собирать инфу с формы
|
61
|
+
- [X] id:
|
62
|
+
- [X] необходимо на моменте генерации страницы вшивать
|
63
|
+
куда-нибудь `id` товара
|
64
|
+
- [X] количество:
|
65
|
+
- [X] добавить в js-компонент `id` товара (среди множества виджетов необходимо распознать релевантный)
|
66
|
+
- [X] добавить и испытать метод, выдающий текущий `value`
|
67
|
+
- [X] цвет:
|
68
|
+
- [X] добавить в js-компонент `id` товара (среди множества виджетов необходимо распознать релевантный)
|
69
|
+
- [X] добавить и испытать метод, выдающий текущий `value`
|
70
|
+
- [X] опции:
|
71
|
+
- [X] реализовать js-компонент "опции"
|
72
|
+
- [X] добавить в js-компонент `id` товара (среди множества виджетов необходимо распознать релевантный)
|
73
|
+
- [X] добавить и испытать метод, выдающий текущий `value`
|
74
|
+
- [ ] На основе собранной инфы должен создавать объект `DataOrderRow` и помещать его в cookie.
|
75
|
+
- [ ] Находить на странице виджет-кнопку "корзина" и обновлять там количество `DataOrderRow` в корзине
|
76
|
+
- [ ] реализовать js-компонент 'корзина'
|
77
|
+
- [ ] Публичный setter: `set_count`
|
78
|
+
- [X] Должен появиться `bootstrap modal` с кнопками "продолжить покупки", "перейти в корзину"
|
79
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// показывает окна
|
4
|
+
|
5
|
+
var CoModal = function() {
|
6
|
+
|
7
|
+
var _modals = {};
|
8
|
+
|
9
|
+
var _init_modal = function(modal_name) {
|
10
|
+
var $modal;
|
11
|
+
|
12
|
+
// if (_modals[modal_name] === undefined) {
|
13
|
+
$modal = $('#' + modal_name + '_modal');
|
14
|
+
$modal.modal();
|
15
|
+
// _modals[modal_name] = $modal;
|
16
|
+
// $modal.on('hidden.bs.modal', function () {
|
17
|
+
// $modal.remove();
|
18
|
+
// });
|
19
|
+
// }
|
20
|
+
|
21
|
+
// $modal = _modals[modal_name];
|
22
|
+
|
23
|
+
return $modal;
|
24
|
+
};
|
25
|
+
|
26
|
+
// _double_modal.html.erb
|
27
|
+
this.showDouble = function(message) {
|
28
|
+
console.log('<showDouble> message: ' + message);
|
29
|
+
var $modal = _init_modal('double');
|
30
|
+
$modal.find('.modal-body').text(message);
|
31
|
+
$modal.find('.btn_close').on('click', function(e) {
|
32
|
+
$modal.modal('hide');
|
33
|
+
});
|
34
|
+
$modal.find('.btn_go_to_cart').on('click', function(e) {
|
35
|
+
window.location.href = '/cart';
|
36
|
+
});
|
37
|
+
$modal.show();
|
38
|
+
}
|
39
|
+
};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
var CookiesService = function() {
|
2
|
+
|
3
|
+
var _create_cookie = function(name, value, days) {
|
4
|
+
var expires = '';
|
5
|
+
|
6
|
+
if (days) {
|
7
|
+
var date = new Date();
|
8
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
9
|
+
expires = "; expires=" + date.toGMTString();
|
10
|
+
}
|
11
|
+
|
12
|
+
document.cookie = encodeURIComponent(name) + '=' + JSON.stringify(value) + expires + "; path=/";
|
13
|
+
|
14
|
+
};
|
15
|
+
|
16
|
+
var _read_cookie = function(name) {
|
17
|
+
// console.log('<CookiesService._read_cookie> name = ' + name);
|
18
|
+
var nameEQ = encodeURIComponent(name) + "=";
|
19
|
+
var ca = document.cookie.split(';');
|
20
|
+
for (var i = 0; i < ca.length; i++) {
|
21
|
+
var c = ca[i];
|
22
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
23
|
+
if (c.indexOf(nameEQ) === 0) {
|
24
|
+
var s = JSON.parse(c.substring(nameEQ.length, c.length));
|
25
|
+
// console.log('<CookiesService._read_cookie> subs: ' + s);
|
26
|
+
return s;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return null;
|
30
|
+
};
|
31
|
+
|
32
|
+
this.cart_push = function(row_as_hash) {
|
33
|
+
var cart = _read_cookie('cart3');
|
34
|
+
if (cart === null) cart = [];
|
35
|
+
cart.push(row_as_hash);
|
36
|
+
_create_cookie('cart3', cart, 256);
|
37
|
+
console.log('<CookiesService.cart_push>');
|
38
|
+
};
|
39
|
+
|
40
|
+
this.cart_get = function() {
|
41
|
+
var cart = _read_cookie('cart3');
|
42
|
+
return cart;
|
43
|
+
}
|
44
|
+
|
45
|
+
this.cart_clean = function() {
|
46
|
+
console.log('<cart_clean>');
|
47
|
+
var cart = _read_cookie('cart3');
|
48
|
+
if (cart === null) return;
|
49
|
+
cart = [];
|
50
|
+
_create_cookie('cart3', cart, 256);
|
51
|
+
};
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
// добавляет
|
4
|
+
var AddRowToCart = function(item_id) {
|
5
|
+
this.call = function() {
|
6
|
+
var row_as_hash = new CollectDataForRow(item_id).call();
|
7
|
+
console.log("<AddRowToCart.call> row_as_hash: " + row_as_hash);
|
8
|
+
console.log(row_as_hash);
|
9
|
+
|
10
|
+
coo.cart_push(row_as_hash);
|
11
|
+
|
12
|
+
return {
|
13
|
+
result: true,
|
14
|
+
message: row_as_hash['q'] + ' товаров добавлено в корзину.'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var ButtonAddToCart = function(selector) {
|
4
|
+
|
5
|
+
var _$btn;
|
6
|
+
var _item_id;
|
7
|
+
|
8
|
+
var _onClickBtn = function(e) {
|
9
|
+
console.log('<_onClickBtn>');
|
10
|
+
e.preventDefault();
|
11
|
+
var c = new AddRowToCart(_item_id).call();
|
12
|
+
if (c.result) {
|
13
|
+
// com.showDouble(c.message);
|
14
|
+
com.showDouble('Продолжить покупки?');
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
var _fInitBehaviour = function (){
|
19
|
+
if (_$btn.length <= 0) return;
|
20
|
+
_$btn.on('click', _onClickBtn);
|
21
|
+
};
|
22
|
+
|
23
|
+
/**
|
24
|
+
* selector = "add_to_bucket_#{item.id}"
|
25
|
+
* @param selector
|
26
|
+
*/
|
27
|
+
var _fInit = function (selector){
|
28
|
+
_$btn = $(selector);
|
29
|
+
_item_id = _$btn.data('id');
|
30
|
+
_fInitBehaviour();
|
31
|
+
};
|
32
|
+
|
33
|
+
_fInit(selector);
|
34
|
+
|
35
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
var DataOrderRow = function (){
|
2
|
+
data = {
|
3
|
+
id: 0,
|
4
|
+
title: '',
|
5
|
+
quantity: 0,
|
6
|
+
color: '#ffffff',
|
7
|
+
price: 0,
|
8
|
+
image_url: '',
|
9
|
+
item_url: '',
|
10
|
+
mark_order: true,
|
11
|
+
mark_metallic: false,
|
12
|
+
mark_super_colors: false
|
13
|
+
};
|
14
|
+
|
15
|
+
return data;
|
16
|
+
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// собирает данные с формы просмотра/заказа товара, на основе которых
|
2
|
+
// создастся row to cart
|
3
|
+
|
4
|
+
var CollectDataForRow = function(item_id) {
|
5
|
+
this.call = function() {
|
6
|
+
console.log("<CollectDataForRow.call> item_id = " + item_id);
|
7
|
+
|
8
|
+
var $item_show = $('.item_show_'+item_id);
|
9
|
+
|
10
|
+
var q = ITEM_QUANTITY_PICKERS[item_id].get_cur_val();
|
11
|
+
var price = q * Number($item_show.find('.price_props p.cur span.pvalue').text().split(',').join('.'));
|
12
|
+
var title = $item_show.data('title');
|
13
|
+
var color = ITEM_COLOR_SELECTOR[item_id].get_cur_val();
|
14
|
+
var options = ITEM_OPTIONS[item_id].get_cur_val();
|
15
|
+
|
16
|
+
return {
|
17
|
+
id: item_id,
|
18
|
+
title: title,
|
19
|
+
q: q,
|
20
|
+
color: color,
|
21
|
+
price: price,
|
22
|
+
image_url: $item_show.data('image_url'),
|
23
|
+
item_url: $item_show.data('item_url'),
|
24
|
+
options: {
|
25
|
+
mark_delivery: options['delivery'],
|
26
|
+
mark_super_colors: options['super_colors'],
|
27
|
+
mark_metallic: options['metallic']
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var $s;
|
4
|
+
|
5
|
+
var _activate_cart_button = function() {
|
6
|
+
$s.each(function() {
|
7
|
+
new ButtonAddToCart(this);
|
8
|
+
});
|
9
|
+
};
|
10
|
+
|
11
|
+
$(document).ready(function() {
|
12
|
+
$s = $('.add_to_bucket');
|
13
|
+
if ($s.length !== 0) {
|
14
|
+
// alert(ButtonAddToCart);
|
15
|
+
_activate_cart_button();
|
16
|
+
}
|
17
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var CartPage = function($cart_page) {
|
4
|
+
var _$cart_page;
|
5
|
+
var _cart_table;
|
6
|
+
var _$clear_btn;
|
7
|
+
var _$result_price_val;
|
8
|
+
var _fill_table = function() {
|
9
|
+
var cart = coo.cart_get();
|
10
|
+
for (var i = 0; i < cart.length; i++) {
|
11
|
+
_cart_table.add_row(cart[i]);
|
12
|
+
}
|
13
|
+
};
|
14
|
+
var _calc_result_price = function() {
|
15
|
+
var cart = coo.cart_get();
|
16
|
+
var result = 0;
|
17
|
+
for (var i = 0; i < cart.length; i++) {
|
18
|
+
result += Number(cart[i]['price']);
|
19
|
+
}
|
20
|
+
_$result_price_val.text(result);
|
21
|
+
};
|
22
|
+
var _on_click_clear = function(e) {
|
23
|
+
e.preventDefault();
|
24
|
+
_cart_table.clear();
|
25
|
+
coo.cart_clean();
|
26
|
+
};
|
27
|
+
var _fInitBehaviour = function (){
|
28
|
+
_fill_table();
|
29
|
+
_calc_result_price();
|
30
|
+
_$clear_btn.on('click', _on_click_clear);
|
31
|
+
|
32
|
+
};
|
33
|
+
var _fInit = function($cart_page) {
|
34
|
+
_$cart_page = $cart_page;
|
35
|
+
_cart_table = new CartTable(_$cart_page.find('table.cart_table'));
|
36
|
+
_$clear_btn = $cart_page.find('.clear_btn');
|
37
|
+
_$result_price_val = $cart_page.find('.bottom_row .result .val');
|
38
|
+
_fInitBehaviour();
|
39
|
+
};
|
40
|
+
_fInit($cart_page);
|
41
|
+
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var CartTable = function ($table){
|
4
|
+
|
5
|
+
var _rows;
|
6
|
+
var _$table;
|
7
|
+
var _$tbody;
|
8
|
+
var _support;
|
9
|
+
|
10
|
+
//<editor-fold desc="// Инициализация">
|
11
|
+
var _fInitBehaviour = function (){
|
12
|
+
};
|
13
|
+
var _fInit = function ($table){
|
14
|
+
_$table = $table;
|
15
|
+
_$tbody = _$table.find('tbody');
|
16
|
+
_support = new RowMaker();
|
17
|
+
_rows = [];
|
18
|
+
_fInitBehaviour();
|
19
|
+
};
|
20
|
+
_fInit($table);
|
21
|
+
//</editor-fold>
|
22
|
+
|
23
|
+
this.add_row = function(row_hash) {
|
24
|
+
_rows.push(row_hash);
|
25
|
+
var $row = $(_support.make_row_htmlstr(row_hash));
|
26
|
+
_$tbody.append($row);
|
27
|
+
_activate_q_picker();
|
28
|
+
};
|
29
|
+
|
30
|
+
this.clear = function() {
|
31
|
+
var i, n = _rows.length;
|
32
|
+
for (i = 0; i<n; i++) {
|
33
|
+
$('.tr_' + _rows[i]['id']).remove();
|
34
|
+
}
|
35
|
+
_rows = [];
|
36
|
+
};
|
37
|
+
|
38
|
+
this.remove_row = function(id) {
|
39
|
+
var i, n = _rows.length;
|
40
|
+
for (i = n; i>=0; i--) {
|
41
|
+
if (_rows[i]['id'] === id) {
|
42
|
+
_rows.splice(i, 1);
|
43
|
+
break;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
$('.tr_'+id).remove();
|
47
|
+
};
|
48
|
+
|
49
|
+
};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var RowMaker = function() {
|
4
|
+
|
5
|
+
var _ROW = '<tr class="tr_{{ id }}">' +
|
6
|
+
'<td class="image">' +
|
7
|
+
'<a class="lazy-image-wrapper" href=" {{ item_url }}" target="_blank" title="{{ title }}">' +
|
8
|
+
'<img data-original="{{ image_url }}" alt="{{ title }}">' +
|
9
|
+
'</a>' +
|
10
|
+
'</td>' +
|
11
|
+
'<td class="title">{{ title }}</td>' +
|
12
|
+
'<td class="color">' +
|
13
|
+
'<ul class="item_color_selector" data-id="{{ id }}">' +
|
14
|
+
'<li style="background-color:{{ color }}" class="c"></li>' +
|
15
|
+
'</ul>' +
|
16
|
+
'</td>' +
|
17
|
+
'<td class="q">' +
|
18
|
+
'<div class="quantity_picker" data-id="{{ id }}">' +
|
19
|
+
'<a href="#" class="l">-</a>' +
|
20
|
+
'<input name="val" id="val" value="{{ q }}">' +
|
21
|
+
'<a href="#" class="g">+</a>' +
|
22
|
+
'</div>' +
|
23
|
+
'</td>' +
|
24
|
+
'<td class="price">{{ price }}</td>' +
|
25
|
+
'<td class="actions"><a title="Удалить" class="del_action" data-id="{{ id }}">Удалить</a></td>' +
|
26
|
+
'</tr>';
|
27
|
+
|
28
|
+
this.make_row_htmlstr = function(obj) {
|
29
|
+
var res = _ROW;
|
30
|
+
var al;
|
31
|
+
for ( var key in obj ){
|
32
|
+
al = "{{ " + key + " }}";
|
33
|
+
res = res.split(al).join(obj[key]);
|
34
|
+
}
|
35
|
+
return res;
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
#= require_tree ./co
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@mixin cart_button {
|
2
|
+
@include color_button(#cccccc, #ffffff);
|
3
|
+
border: 1px solid #cccccc !important;
|
4
|
+
text-transform: uppercase;
|
5
|
+
padding: 10px 20px;
|
6
|
+
cursor: pointer;
|
7
|
+
|
8
|
+
&:hover {
|
9
|
+
background-color: #ffffff !important;
|
10
|
+
border: 1px solid #717171 !important;
|
11
|
+
color: #717171 !important;
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
div#cart_page {
|
2
|
+
div.bottom_row {
|
3
|
+
@include clearfix;
|
4
|
+
margin-bottom: 35px;
|
5
|
+
|
6
|
+
> * {
|
7
|
+
float: left;
|
8
|
+
margin-right: 67px;
|
9
|
+
|
10
|
+
&.result {
|
11
|
+
text-transform: uppercase;
|
12
|
+
font-size: 29px;
|
13
|
+
padding-top: 7px;
|
14
|
+
width: 245px;
|
15
|
+
|
16
|
+
.caption {
|
17
|
+
display: inline-block;
|
18
|
+
margin-right: 15px;
|
19
|
+
}
|
20
|
+
.val {
|
21
|
+
display: inline-block;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
&.make_order_chbx {
|
26
|
+
label {
|
27
|
+
font-size: 21px;
|
28
|
+
color: #a1a1a1;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
&.clear_the_cart {
|
33
|
+
padding-top: 7px;
|
34
|
+
margin-right: 0;
|
35
|
+
width: 643px;
|
36
|
+
|
37
|
+
a {
|
38
|
+
@include cart_button;
|
39
|
+
float: right;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
%col-image {
|
2
|
+
width: 290px;
|
3
|
+
}
|
4
|
+
%col-title {
|
5
|
+
width: 250px;
|
6
|
+
}
|
7
|
+
%col-color {
|
8
|
+
width: 130px;
|
9
|
+
}
|
10
|
+
%col-q {
|
11
|
+
width: 198px;
|
12
|
+
}
|
13
|
+
%col-price {
|
14
|
+
width: 190px;
|
15
|
+
}
|
16
|
+
%col-actions {
|
17
|
+
width: 233px;
|
18
|
+
}
|
19
|
+
|
20
|
+
table.cart_table {
|
21
|
+
margin-bottom: 25px;
|
22
|
+
|
23
|
+
th {
|
24
|
+
text-align: left;
|
25
|
+
background-color: #dfdddd;
|
26
|
+
padding: 15px 15px;
|
27
|
+
text-transform: uppercase;
|
28
|
+
color: #6e6e6e;
|
29
|
+
font-size: 17px;
|
30
|
+
font-weight: normal;
|
31
|
+
&.image {
|
32
|
+
@extend %col-image;
|
33
|
+
}
|
34
|
+
&.title {
|
35
|
+
@extend %col-title;
|
36
|
+
}
|
37
|
+
&.color {
|
38
|
+
@extend %col-color;
|
39
|
+
}
|
40
|
+
&.q {
|
41
|
+
@extend %col-q;
|
42
|
+
}
|
43
|
+
&.price {
|
44
|
+
@extend %col-price;
|
45
|
+
}
|
46
|
+
&.actions {
|
47
|
+
@extend %col-actions;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
td {
|
52
|
+
padding: 15px;
|
53
|
+
&.image {
|
54
|
+
@extend %col-image;
|
55
|
+
padding-left: 0;
|
56
|
+
|
57
|
+
a.lazy-image-wrapper {
|
58
|
+
display: block;
|
59
|
+
width: 290px;
|
60
|
+
height: 240px;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
&.title {
|
64
|
+
@extend %col-title;
|
65
|
+
font-size: 23px;
|
66
|
+
}
|
67
|
+
&.color {
|
68
|
+
@extend %col-color;
|
69
|
+
padding: 0 25px;
|
70
|
+
}
|
71
|
+
&.q {
|
72
|
+
@extend %col-q;
|
73
|
+
}
|
74
|
+
&.price {
|
75
|
+
@extend %col-price;
|
76
|
+
font-size: 32px;
|
77
|
+
color: #6a6969;
|
78
|
+
}
|
79
|
+
&.actions {
|
80
|
+
@extend %col-actions;
|
81
|
+
padding-right: 0;
|
82
|
+
a {
|
83
|
+
@include cart_button;
|
84
|
+
float: right;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'co/**/*';
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%# CartPageHelper#c80_yax_render_cart %>
|
2
|
+
|
3
|
+
<div id="cart_page">
|
4
|
+
<table class="cart_table">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th class="image">Товар</th>
|
8
|
+
<th class="title"> </th>
|
9
|
+
<th class="color">Цвет</th>
|
10
|
+
<th class="q">Кол-во</th>
|
11
|
+
<th class="price">Сумма</th>
|
12
|
+
<th class="actions"> </th>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody></tbody>
|
16
|
+
</table>
|
17
|
+
<div class="bottom_row">
|
18
|
+
<div class="result">
|
19
|
+
<span class="caption">Итого:</span>
|
20
|
+
<span class="val"></span>
|
21
|
+
</div>
|
22
|
+
<div class="make_order_chbx">
|
23
|
+
<div class="checkbox">
|
24
|
+
<label>
|
25
|
+
<input type="checkbox">
|
26
|
+
<span class="cr"><i class="cr-icon fa fa-check"></i></span>
|
27
|
+
Заказать доставку
|
28
|
+
</label>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="clear_the_cart">
|
32
|
+
<%= link_to 'Очистить корзину', '#', class: 'clear_btn' %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<%= render_image_link_lazy({
|
36
|
+
:alt_image => 'Корзина демо',
|
37
|
+
:image => image_url('demo_cart.jpg'),
|
38
|
+
:a_href => '#',
|
39
|
+
:a_rel => 'nofollow'
|
40
|
+
}) %>
|
41
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%# modals_helper.rb: render_double_modal %>
|
2
|
+
|
3
|
+
<%# render_ok_message %>
|
4
|
+
|
5
|
+
<div id="double_modal" class="modal fade">
|
6
|
+
<div class="modal-dialog">
|
7
|
+
<div class="modal-content">
|
8
|
+
<div class="modal-header">
|
9
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
10
|
+
<h4 class="modal-title medium" id="myModalLabel"> </h4>
|
11
|
+
</div>
|
12
|
+
<div class="modal-body regular">
|
13
|
+
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="modal-footer">
|
17
|
+
<button type="button" class="btn btn_close btn-danger">Да, продолжить</button>
|
18
|
+
<button type="button" class="btn btn_go_to_cart btn-danger">Перейти в корзину</button>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Co
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace Co
|
4
|
+
|
5
|
+
initializer :co_engine do
|
6
|
+
if defined?(ActiveAdmin)
|
7
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/**/"]
|
8
|
+
#ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/concerns/**/"]
|
9
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/ti/**/"]
|
10
|
+
# ActiveAdmin.application.load_paths += Dir["#{config.root}/app/jobs/**/"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
initializer :append_migrations do |app|
|
15
|
+
unless app.root.to_s.match root.to_s
|
16
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
17
|
+
app.config.paths['db/migrate'] << expanded_path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/c80_yax/version.rb
CHANGED
data/lib/c80_yax.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_yax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,6 +140,8 @@ files:
|
|
140
140
|
- app/assets/javascripts/c80_yax/backend/strsubcats.js
|
141
141
|
- app/assets/javascripts/c80_yax/frontend/item_color_selector/app.js
|
142
142
|
- app/assets/javascripts/c80_yax/frontend/item_color_selector/item_color_selector.js
|
143
|
+
- app/assets/javascripts/c80_yax/frontend/item_options/app.js
|
144
|
+
- app/assets/javascripts/c80_yax/frontend/item_options/item_options.js
|
143
145
|
- app/assets/javascripts/c80_yax/frontend/item_quantity_picker/app.js
|
144
146
|
- app/assets/javascripts/c80_yax/frontend/item_quantity_picker/item_quantity_picker.js
|
145
147
|
- app/assets/javascripts/c80_yax/frontend/more_items_list/app.js
|
@@ -254,6 +256,32 @@ files:
|
|
254
256
|
- db/migrate/20170625180000_create_c80_yax_join_table_colors_items.rb
|
255
257
|
- db/migrate/20170707060000_create_c80_yax_join_table_items_items_similar.rb
|
256
258
|
- db/seeds/c80_yax_01_fill_props.rb
|
259
|
+
- engines/co/README.md
|
260
|
+
- engines/co/app/assets/javascripts/co.coffee
|
261
|
+
- engines/co/app/assets/javascripts/co/_service/co_modal.js
|
262
|
+
- engines/co/app/assets/javascripts/co/_service/cookies_service.js
|
263
|
+
- engines/co/app/assets/javascripts/co/add_to_cart/actions/add_row_to_cart.js
|
264
|
+
- engines/co/app/assets/javascripts/co/add_to_cart/button_add_to_cart.js
|
265
|
+
- engines/co/app/assets/javascripts/co/add_to_cart/data_order_row.js
|
266
|
+
- engines/co/app/assets/javascripts/co/add_to_cart/service/collect_data_for_row.js
|
267
|
+
- engines/co/app/assets/javascripts/co/add_to_cart/xapp.js
|
268
|
+
- engines/co/app/assets/javascripts/co/app.js
|
269
|
+
- engines/co/app/assets/javascripts/co/cart_page/app.js
|
270
|
+
- engines/co/app/assets/javascripts/co/cart_page/cart_page.js
|
271
|
+
- engines/co/app/assets/javascripts/co/cart_page/cart_table.js
|
272
|
+
- engines/co/app/assets/javascripts/co/cart_page/support/row_maker.js
|
273
|
+
- engines/co/app/assets/stylesheets/co.scss
|
274
|
+
- engines/co/app/assets/stylesheets/co/cart_page/_cart_button.scss
|
275
|
+
- engines/co/app/assets/stylesheets/co/cart_page/bottom_row.scss
|
276
|
+
- engines/co/app/assets/stylesheets/co/cart_page/cart_table.scss
|
277
|
+
- engines/co/app/assets/stylesheets/co/modals/double_modal.scss
|
278
|
+
- engines/co/app/helpers/co/cart_page_helper.rb
|
279
|
+
- engines/co/app/helpers/co/modals_helper.rb
|
280
|
+
- engines/co/app/views/co/_cart_page.html.erb
|
281
|
+
- engines/co/app/views/co/modals/_double_modal.html.erb
|
282
|
+
- engines/co/lib/co.rb
|
283
|
+
- engines/co/lib/co/engine.rb
|
284
|
+
- engines/co/lib/co/version.rb
|
257
285
|
- engines/of/README.md
|
258
286
|
- engines/of/app/admin/ti/offers.rb
|
259
287
|
- engines/of/app/assets/javascripts/of.coffee
|