c80_yax 0.1.0.20 → 0.1.0.21
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/admin/c80_yax/items.rb +3 -0
- data/app/assets/images/c80_yax/item_hit.png +0 -0
- data/app/assets/javascripts/c80_yax/frontend/item_options/item_options.js +2 -2
- data/app/assets/javascripts/c80_yax/frontend/item_quantity_picker/item_quantity_picker.js +3 -3
- data/app/assets/javascripts/c80_yax/frontend/more_items_list/more_items_list.js +19 -8
- data/app/assets/stylesheets/c80_yax/elems/item_is_hit.scss +13 -0
- data/app/controllers/c80_yax/ajax_controller.rb +19 -1
- data/app/decorators/c80_yax/item_decorator.rb +6 -4
- data/app/views/c80_yax/ajax/fetch_items.js.erb +5 -1
- data/app/views/c80_yax/items/_index.html.erb +7 -1
- data/engines/co/app/assets/javascripts/co/_service/co_modal.js +1 -1
- data/engines/co/app/assets/javascripts/co/_service/cookies_service.js +2 -2
- data/engines/co/app/assets/javascripts/co/add_to_cart/button_add_to_cart.js +1 -1
- data/engines/co/app/assets/javascripts/co/add_to_cart/service/collect_data_for_row.js +1 -1
- data/engines/co/app/assets/javascripts/co/add_to_cart_sm/actions/add_row_to_cart_sm.js +2 -2
- data/engines/co/app/assets/javascripts/co/add_to_cart_sm/button_add_to_cart_sm.js +1 -1
- data/engines/co/app/assets/javascripts/co/add_to_cart_sm/service/collect_data_for_row_sm.js +1 -1
- data/engines/co/app/assets/javascripts/co/cart_page/cart_page.js +8 -4
- data/engines/co/app/assets/javascripts/co/cart_page/cart_table.js +1 -1
- data/engines/co/app/assets/javascripts/co/goto_cart/button_goto_cart.js +2 -2
- data/engines/co/app/assets/stylesheets/co/cart_page/form.scss +1 -15
- data/engines/co/app/views/co/cart/message_cart_order.js.erb +1 -0
- data/lib/c80_yax/strsubcat_runtime_tables.rb +6 -1
- data/lib/c80_yax/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37eb797db8500530c0fd5a0644f572fd1de2b711
|
4
|
+
data.tar.gz: 1332ff3cbba382552944f55c351ff3c020b613de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53dc2c10ae24ba09973c66ee990e7f403a6da0b049ee6bb34b680ed09ec29afe5b6a1897c95b7dcb0612a9ce59bb07477a9de4561d609d6ea39dcb5e97fe8d85
|
7
|
+
data.tar.gz: '0063757595dfec78bfe6a533d4e779d2069d469846ba27108b64c2745bbc5df965fc606defd88fb3fa8477fd652368a70598dd0392b0d5fde6188731a7631be2'
|
data/app/admin/c80_yax/items.rb
CHANGED
@@ -14,6 +14,7 @@ ActiveAdmin.register C80Yax::Item, as: 'Item' do
|
|
14
14
|
:is_main,
|
15
15
|
:is_gift,
|
16
16
|
:is_starting,
|
17
|
+
:is_ask_price,
|
17
18
|
:is_available,
|
18
19
|
:strsubcat_id,
|
19
20
|
:iphotos_attributes => [:id, :image, :_destroy],
|
@@ -44,6 +45,7 @@ ActiveAdmin.register C80Yax::Item, as: 'Item' do
|
|
44
45
|
|
45
46
|
column :title
|
46
47
|
column :strsubcat
|
48
|
+
column :is_ask_price
|
47
49
|
column :is_hit
|
48
50
|
column :is_sale
|
49
51
|
column :is_main
|
@@ -81,6 +83,7 @@ ActiveAdmin.register C80Yax::Item, as: 'Item' do
|
|
81
83
|
f.input :is_sale
|
82
84
|
f.input :is_main
|
83
85
|
f.input :is_gift
|
86
|
+
f.input :is_ask_price
|
84
87
|
f.input :is_starting
|
85
88
|
f.input :is_available
|
86
89
|
|
Binary file
|
@@ -18,9 +18,9 @@ var ItemOptions = function (wrapper){
|
|
18
18
|
var $inp = $t.find('input');
|
19
19
|
var val = $inp[0].checked;
|
20
20
|
_cur_val[tag] = val;
|
21
|
-
console.log('<_fCollectOptions> val = ' + val + ": " + tag);
|
21
|
+
// console.log('<_fCollectOptions> val = ' + val + ": " + tag);
|
22
22
|
});
|
23
|
-
console.log(_cur_val);
|
23
|
+
// console.log(_cur_val);
|
24
24
|
}
|
25
25
|
|
26
26
|
var _fInitBehaviour = function (){
|
@@ -38,14 +38,14 @@ var ItemQuantityPicker = function (wrapper){
|
|
38
38
|
};
|
39
39
|
|
40
40
|
var _onClickLess = function(e) {
|
41
|
-
console.log('<_onClickLess>');
|
41
|
+
// console.log('<_onClickLess>');
|
42
42
|
_set_cur_val(_cur_val - 1);
|
43
43
|
_afterClick();
|
44
44
|
e.preventDefault();
|
45
45
|
};
|
46
46
|
|
47
47
|
var _onClickGreat = function(e) {
|
48
|
-
console.log('<_onClickGreat>');
|
48
|
+
// console.log('<_onClickGreat>');
|
49
49
|
_set_cur_val(Number(_cur_val) + 1);
|
50
50
|
_afterClick();
|
51
51
|
e.preventDefault();
|
@@ -56,7 +56,7 @@ var ItemQuantityPicker = function (wrapper){
|
|
56
56
|
};
|
57
57
|
|
58
58
|
var _onChangeInput = function(e) {
|
59
|
-
console.log('<_onChangeInput>');
|
59
|
+
// console.log('<_onChangeInput>');
|
60
60
|
};
|
61
61
|
|
62
62
|
var _fInitBehaviour = function (){
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
/*
|
4
|
-
* <div class="container-fluid hits_widget more_items_list" data-type='hit|offer'>
|
4
|
+
* <div class="container-fluid hits_widget more_items_list" data-type='hit|offer|cat|strsubcat' data-slug="cat_slug|strsubcat_slug">
|
5
5
|
* <div class="container">
|
6
6
|
* <h2 class="yield_h2">Хиты продаж</h2>
|
7
7
|
* <div class="ajax_div">
|
@@ -64,18 +64,29 @@ var MoreItemsList = function (wrapper) {
|
|
64
64
|
e.preventDefault();
|
65
65
|
var $t = $(e.target);
|
66
66
|
var t = _$wrapper.data('type');
|
67
|
+
var slug = _$wrapper.data('slug');
|
67
68
|
var p = $t.attr('href').split('page=')[1];
|
68
|
-
|
69
|
+
p = p.split('&')[0];
|
70
|
+
// /fetch_items?_=1500959360965&ajax_items_div=.container-fluid.more_items_list+.ajax_div&page=3&per_page=16&slug=bezopasnost-krovli&type=cat
|
71
|
+
// console.log('<_fOnClickNext> type: ' + t + '; page: ' + p);
|
72
|
+
|
73
|
+
var dat = {
|
74
|
+
type: t,
|
75
|
+
page: p,
|
76
|
+
slug: slug,
|
77
|
+
ajax_items_div: "." + _$wrapper.attr('class').split(' ').join('.') + " .ajax_div"
|
78
|
+
};
|
79
|
+
|
80
|
+
//noinspection EqualityComparisonWithCoercionJS
|
81
|
+
if (_$wrapper.data('per_page') != undefined) {
|
82
|
+
dat['per_page'] = _$wrapper.data('per_page');
|
83
|
+
}
|
69
84
|
|
70
85
|
loading.show($t);
|
71
86
|
|
72
87
|
$.ajax({
|
73
88
|
url: "/fetch_items",
|
74
|
-
data:
|
75
|
-
type: t,
|
76
|
-
page: p,
|
77
|
-
ajax_items_div: "." + _$wrapper.attr('class').split(' ').join('.') + " .ajax_div"
|
78
|
-
},
|
89
|
+
data: dat,
|
79
90
|
dataType: "script",
|
80
91
|
type: 'GET'
|
81
92
|
}).done(function() {
|
@@ -88,7 +99,7 @@ var MoreItemsList = function (wrapper) {
|
|
88
99
|
|
89
100
|
// находим в нем next кнопку will paginate
|
90
101
|
_$next_btn = _$wrapper.find('a.next_page');
|
91
|
-
console.log('<_fSetNextPageBehaviour> ');
|
102
|
+
// console.log('<_fSetNextPageBehaviour> ');
|
92
103
|
|
93
104
|
if (_$next_btn.data('processed')) {
|
94
105
|
|
@@ -3,7 +3,13 @@ module C80Yax
|
|
3
3
|
|
4
4
|
def fetch_items
|
5
5
|
|
6
|
-
@params = _make_params
|
6
|
+
@params = _make_params
|
7
|
+
# params: {
|
8
|
+
# type:'hit',
|
9
|
+
# ajax_items: '.div_hot_items .ajax_items',
|
10
|
+
# page: 1,
|
11
|
+
# per_page: 4
|
12
|
+
# slug: ...
|
7
13
|
|
8
14
|
case @params[:type]
|
9
15
|
when 'hit'
|
@@ -18,6 +24,18 @@ module C80Yax
|
|
18
24
|
.includes(:iphotos)
|
19
25
|
.includes(:strsubcat)
|
20
26
|
.paginate(page: @params[:page], per_page: @params[:per_page])
|
27
|
+
when 'cat'
|
28
|
+
@itms = C80Yax::Item.includes(item_props: {prop_name: [:uom, :related]})
|
29
|
+
.includes(:iphotos)
|
30
|
+
.includes(strsubcat: :cats)
|
31
|
+
.where(c80_yax_cats: {slug: params[:slug] })
|
32
|
+
.paginate(page: @params[:page], per_page: @params[:per_page])
|
33
|
+
when 'strsubcat'
|
34
|
+
@itms = C80Yax::Item.includes(item_props: {prop_name: [:uom, :related]})
|
35
|
+
.includes(:iphotos)
|
36
|
+
.includes(:strsubcat)
|
37
|
+
.where(c80_yax_strsubcats: {slug: params[:slug] })
|
38
|
+
.paginate(page: @params[:page], per_page: @params[:per_page])
|
21
39
|
end
|
22
40
|
|
23
41
|
@items = ItemDecorator.decorate_collection(@itms)
|
@@ -110,10 +110,12 @@ module C80Yax
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def btn_order
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
unless model.is_ask_price
|
114
|
+
h.link_to '',
|
115
|
+
'#',
|
116
|
+
class: "add_to_bucket_sm add_to_bucket_sm_#{model.id}",
|
117
|
+
data: {id: model.id}
|
118
|
+
end
|
117
119
|
end
|
118
120
|
|
119
121
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<ul class="item_index">
|
2
2
|
<% items.each do |item| %>
|
3
|
-
<li class="li_item i_<%= item.id%>"
|
3
|
+
<li class="li_item i_<%= item.id%> is_hit_<%=item.is_hit%>"
|
4
4
|
data-item_url="<%= item.my_url %>"
|
5
5
|
data-title="<%= item.title %>"
|
6
6
|
data-image_url="<%= item.fetch_first_photo('thumb_md') %>">
|
@@ -18,3 +18,9 @@
|
|
18
18
|
:next_label => '>',
|
19
19
|
:inner_window => 3) unless without_paginator %>
|
20
20
|
</div>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
if (typeof refinePriceDecorator != 'undefined') {
|
24
|
+
refinePriceDecorator.init();
|
25
|
+
}
|
26
|
+
</script>
|
@@ -25,7 +25,7 @@ var CoModal = function() {
|
|
25
25
|
|
26
26
|
// _double_modal.html.erb
|
27
27
|
this.showDouble = function(message) {
|
28
|
-
console.log('<showDouble> message: ' + message);
|
28
|
+
// console.log('<showDouble> message: ' + message);
|
29
29
|
var $modal = _init_modal('double');
|
30
30
|
$modal.find('.modal-body').text(message);
|
31
31
|
$modal.find('.btn_close').on('click', function(e) {
|
@@ -76,7 +76,7 @@ var CookiesService = function() {
|
|
76
76
|
}
|
77
77
|
|
78
78
|
_create_cookie('cart3', cart, 256);
|
79
|
-
console.log('<CookiesService.cart_push>');
|
79
|
+
// console.log('<CookiesService.cart_push>');
|
80
80
|
};
|
81
81
|
|
82
82
|
this.cart_get = function() {
|
@@ -113,7 +113,7 @@ var CookiesService = function() {
|
|
113
113
|
row = cart[i];
|
114
114
|
if (row['id'] !== row_id) continue;
|
115
115
|
if (row['color'] !== color) continue;
|
116
|
-
console.log('<cart_remove_row> id: ' + row_id + ", color: " + color);
|
116
|
+
// console.log('<cart_remove_row> id: ' + row_id + ", color: " + color);
|
117
117
|
cart.splice(i,1);
|
118
118
|
_create_cookie('cart3', cart, 256);
|
119
119
|
return true;
|
@@ -4,8 +4,8 @@
|
|
4
4
|
var AddRowToCartSm = function(item_id) {
|
5
5
|
this.call = function() {
|
6
6
|
var row_as_hash = new CollectDataForRowSm(item_id).call();
|
7
|
-
console.log("<AddRowToCartSm.call> row_as_hash: " + row_as_hash);
|
8
|
-
console.log(row_as_hash);
|
7
|
+
// console.log("<AddRowToCartSm.call> row_as_hash: " + row_as_hash);
|
8
|
+
// console.log(row_as_hash);
|
9
9
|
|
10
10
|
coo.cart_push(row_as_hash);
|
11
11
|
|
@@ -29,7 +29,7 @@ var CartPage = function($cart_page) {
|
|
29
29
|
};
|
30
30
|
var _print_table_to_comment = function() {
|
31
31
|
var ss = _print_table();
|
32
|
-
console.log(ss);
|
32
|
+
// console.log(ss);
|
33
33
|
$cc.find('#mess_comment').val(ss);
|
34
34
|
}
|
35
35
|
var _calc_result_price = function() {
|
@@ -41,15 +41,18 @@ var CartPage = function($cart_page) {
|
|
41
41
|
_$result_price_val.text(result);
|
42
42
|
};
|
43
43
|
var _on_click_clear = function(e) {
|
44
|
-
e.preventDefault();
|
44
|
+
if (e != undefined) e.preventDefault();
|
45
45
|
_cart_table.clear();
|
46
46
|
coo.cart_clean();
|
47
47
|
_calc_result_price();
|
48
48
|
_print_table_to_comment();
|
49
49
|
ButtonGotoCart.refresh_count();
|
50
50
|
};
|
51
|
+
var _reset = function() {
|
52
|
+
_on_click_clear();
|
53
|
+
};
|
51
54
|
var _on_row_changed = function(row_id, color, obj_with_new_values) {
|
52
|
-
console.log('<_on_row_changed>');
|
55
|
+
// console.log('<_on_row_changed>');
|
53
56
|
coo.cart_update_row(row_id, color, obj_with_new_values);
|
54
57
|
_calc_result_price();
|
55
58
|
_print_table_to_comment();
|
@@ -72,6 +75,7 @@ var CartPage = function($cart_page) {
|
|
72
75
|
};
|
73
76
|
_fInit($cart_page);
|
74
77
|
return {
|
75
|
-
print_table_to_comment: _print_table_to_comment
|
78
|
+
print_table_to_comment: _print_table_to_comment,
|
79
|
+
reset: _reset
|
76
80
|
}
|
77
81
|
};
|
@@ -40,7 +40,7 @@ var CartTable = function ($table, on_changd){
|
|
40
40
|
_$tbody.append($row);
|
41
41
|
$row.find('.del_action').on('click', _on_click_delete_row);
|
42
42
|
_activate_q_picker(function(value_after_change) {
|
43
|
-
console.log('<value_after_change> ' + value_after_change);
|
43
|
+
// console.log('<value_after_change> ' + value_after_change);
|
44
44
|
var new_price = value_after_change * $row.data('price_per_item');
|
45
45
|
$row.find('td.price').text(new_price);
|
46
46
|
__on_changed($row.data('id'), $row.data('color'), {price: new_price, q:value_after_change });
|
@@ -19,7 +19,7 @@ var ButtonGotoCart = function(selector) {
|
|
19
19
|
//</editor-fold>
|
20
20
|
|
21
21
|
this.set_count = function(new_val) {
|
22
|
-
console.log('<ButtonGotoCart#set_count>');
|
22
|
+
// console.log('<ButtonGotoCart#set_count>');
|
23
23
|
_$counter.text(new_val);
|
24
24
|
}
|
25
25
|
|
@@ -27,7 +27,7 @@ var ButtonGotoCart = function(selector) {
|
|
27
27
|
|
28
28
|
ButtonGotoCart.instances = [];
|
29
29
|
ButtonGotoCart.refresh_count = function() {
|
30
|
-
console.log('<ButtonGotoCart.refresh_count>');
|
30
|
+
// console.log('<ButtonGotoCart.refresh_count>');
|
31
31
|
var cart = coo.cart_get();
|
32
32
|
var new_val = 0;
|
33
33
|
for (var i = 0; i < cart.length; i++) {
|
@@ -71,20 +71,6 @@ div.card_row {
|
|
71
71
|
|
72
72
|
.input_wrapper {
|
73
73
|
|
74
|
-
position: relative;
|
75
|
-
|
76
|
-
&:after {
|
77
|
-
content: "";
|
78
|
-
background: transparent url(image_path('stripe.png')) repeat 0 0; /*NOTE:: можно переопределить в custom классах */
|
79
|
-
opacity: 0.1;
|
80
|
-
top: 0;
|
81
|
-
left: 0;
|
82
|
-
bottom: 0;
|
83
|
-
right: 0;
|
84
|
-
position: absolute;
|
85
|
-
z-index: 0;
|
86
|
-
}
|
87
|
-
|
88
74
|
.form-control {
|
89
75
|
position: relative;
|
90
76
|
z-index: 1;
|
@@ -126,7 +112,7 @@ div.card_row {
|
|
126
112
|
margin-top: 15px;
|
127
113
|
|
128
114
|
input.btn {
|
129
|
-
|
115
|
+
|
130
116
|
}
|
131
117
|
|
132
118
|
}
|
@@ -551,6 +551,11 @@ class StrsubcatRuntimeTables
|
|
551
551
|
item_id = item_prop[3]
|
552
552
|
is_ask_price = item_prop[14]
|
553
553
|
|
554
|
+
# пригодится, если is_ask_price.to_i == 1
|
555
|
+
# is_price = PropName.find(prop_name_id).is_normal_price # не подходит, т.к. нужна только "цена за шт"
|
556
|
+
is_price = Proc.new { |pid|
|
557
|
+
C80Yax::PropName.find(pid).is_normal_price
|
558
|
+
}.call(prop_name_id)
|
554
559
|
|
555
560
|
# <editor-fold desc="# производим магические манипуляции с Производителем">
|
556
561
|
# если это свойство "бренд" -
|
@@ -596,7 +601,7 @@ class StrsubcatRuntimeTables
|
|
596
601
|
|
597
602
|
# кэшируем первый раз
|
598
603
|
unless hash_sql[item_id].present?
|
599
|
-
|
604
|
+
# Rails.logger.debug "\t new hash"
|
600
605
|
hash_sql[item_id] = {
|
601
606
|
prop_names_ids: %w'item_id item_title is_main is_hit is_sale strsubcat_id strsubcat_slug vendor_id full_desc image is_ask_price is_gift is_starting is_available',
|
602
607
|
values: [item_id,item_prop[4],item_prop[5],item_prop[6],item_prop[7],item_prop[8],item_prop[9],vendor_id,item_prop[12],item_prop[13], is_ask_price, item_prop[15], item_prop[16], item_prop[17]],
|
data/lib/c80_yax/version.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.21
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- app/admin/c80_yax/vendors.rb
|
134
134
|
- app/admin/c80_yax/x_c80_yax.rb
|
135
135
|
- app/assets/images/c80_yax/cart_icon_sm.png
|
136
|
+
- app/assets/images/c80_yax/item_hit.png
|
136
137
|
- app/assets/images/c80_yax/lo.gif
|
137
138
|
- app/assets/images/c80_yax/stripe.png
|
138
139
|
- app/assets/images/next_btn.png
|
@@ -165,6 +166,7 @@ files:
|
|
165
166
|
- app/assets/stylesheets/c80_yax/elems/cats_iconed_list.scss
|
166
167
|
- app/assets/stylesheets/c80_yax/elems/item_color_selector.scss
|
167
168
|
- app/assets/stylesheets/c80_yax/elems/item_images_no_main.scss
|
169
|
+
- app/assets/stylesheets/c80_yax/elems/item_is_hit.scss
|
168
170
|
- app/assets/stylesheets/c80_yax/elems/item_quantity_picker.scss
|
169
171
|
- app/assets/stylesheets/c80_yax/elems/more_items_list.scss
|
170
172
|
- app/assets/stylesheets/c80_yax/elems/more_items_list_loading.scss
|