c80_yax 0.1.0.9 → 0.1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/admin/c80_yax/items.rb +19 -10
- data/app/assets/stylesheets/c80_yax/backend/active_admin/admin_items.scss +24 -0
- data/app/assets/stylesheets/c80_yax/backend/collapsed.scss +1 -0
- data/app/helpers/c80_yax/frontend/catalog_index_helper.rb +15 -0
- data/app/helpers/c80_yax/items/shared/asterix_helper.rb +16 -0
- data/app/helpers/c80_yax/items/shared/buy_options_helper.rb +36 -0
- data/app/helpers/c80_yax/items/shared/item_view_helper.rb +27 -0
- data/app/models/c80_yax/item.rb +6 -0
- data/app/views/admin/items/_show.html.erb +11 -0
- data/db/migrate/20170707060000_create_c80_yax_join_table_items_items_similar.rb +17 -0
- data/lib/c80_yax/version.rb +1 -1
- metadata +7 -5
- data/app/helpers/c80_yax/items/asterix_helper.rb +0 -13
- data/app/helpers/c80_yax/items/buy_options_helper.rb +0 -33
- data/app/helpers/c80_yax/items/item_view_helper.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fcdb6220bde8af2b6e60f53d49af2d2d69550b0
|
4
|
+
data.tar.gz: a82fd9dd850ea34b2fcd12dafc621fcb37ed6390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1a8505b80c253e6a48bec20277f549215d03d0c814a725b5a78127c8bfdba88052955467db8ec375aa05c5c33eea9890ff7691fe70c67ae1b5ac9f769499fc
|
7
|
+
data.tar.gz: 77aac719f298b13fbf809eeafd47119acf3f421347afb364a30b27866d7db0cd20a8a1feccb79daecaf0d94da80925b5bd8aaa56e423a97b554eea2113bb6370
|
data/app/admin/c80_yax/items.rb
CHANGED
@@ -19,9 +19,10 @@ ActiveAdmin.register C80Yax::Item, as: 'Item' do
|
|
19
19
|
:iphotos_attributes => [:id, :image, :_destroy],
|
20
20
|
:item_props_attributes => [:value, :_destroy, :prop_name_id, :id],
|
21
21
|
:vendor_ids => [],
|
22
|
-
:color_ids => []
|
22
|
+
:color_ids => [],
|
23
|
+
:similar_item_ids => [],
|
24
|
+
:related_child_ids => []
|
23
25
|
# :gallery_ids => [],
|
24
|
-
# :related_child_ids => []
|
25
26
|
|
26
27
|
config.sort_order = 'id_asc'
|
27
28
|
|
@@ -119,19 +120,27 @@ ActiveAdmin.register C80Yax::Item, as: 'Item' do
|
|
119
120
|
|
120
121
|
end
|
121
122
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
f.inputs 'С этим товаром часто покупают', :class => 'collapsed' do
|
124
|
+
f.input :similar_items,
|
125
|
+
:as => :check_boxes,
|
126
|
+
:collection => C80Yax::Item.all
|
127
|
+
end
|
128
|
+
|
129
|
+
f.inputs "Укажите товары, которые будут выводиться в блоке 'Похожие товары'", :class => 'collapsed' do
|
130
|
+
f.input :related_childs,
|
131
|
+
:as => :check_boxes,
|
132
|
+
:collection => C80Yax::Item.all
|
133
|
+
# :collection => C80Yax::Item.joins(:strsubcat).where(c80_yax_strsubcat: {id: f.object.}
|
134
|
+
# :member_label => Proc.new { |p|
|
135
|
+
# p.title
|
136
|
+
# }
|
137
|
+
end
|
129
138
|
|
130
139
|
f.actions
|
131
140
|
end
|
132
141
|
|
133
142
|
show do
|
134
|
-
|
143
|
+
render 'show', { item: item.decorate }
|
135
144
|
end
|
136
145
|
|
137
146
|
end
|
@@ -1,3 +1,13 @@
|
|
1
|
+
%scrolling_checkboxes {
|
2
|
+
display: block;
|
3
|
+
height: 300px;
|
4
|
+
overflow-y: auto;
|
5
|
+
width: 80%;
|
6
|
+
overflow-x: hidden;
|
7
|
+
padding: 0px;
|
8
|
+
margin-left: 20%;
|
9
|
+
}
|
10
|
+
|
1
11
|
//---[ товары ]---------------------------------------------------------------------------------------------------------
|
2
12
|
|
3
13
|
body.admin_items {
|
@@ -119,6 +129,20 @@ body.admin_items {
|
|
119
129
|
|
120
130
|
}
|
121
131
|
|
132
|
+
// список чекбоксов в блоке "с этим товаром часто покупают"
|
133
|
+
li#item_similar_items_input {
|
134
|
+
ol.choices-group {
|
135
|
+
@extend %scrolling_checkboxes;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
// список чекбоксов в блоке "Похожие товары"
|
140
|
+
li#item_related_childs_input {
|
141
|
+
ol.choices-group {
|
142
|
+
@extend %scrolling_checkboxes;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
122
146
|
/*стилизуем чекбоксы*/
|
123
147
|
form fieldset > ol > li.boolean {
|
124
148
|
height: auto;
|
@@ -32,6 +32,21 @@ module C80Yax
|
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
+
def c80_yax_render_similar(item, thumb_size = 'thumb_md', count = 4)
|
36
|
+
itms = item.similar_items
|
37
|
+
.includes(item_props: {prop_name: [:uom, :related]})
|
38
|
+
.includes(:iphotos)
|
39
|
+
.includes(:strsubcat)
|
40
|
+
.limit(count)
|
41
|
+
items = ItemDecorator.decorate_collection(itms)
|
42
|
+
render partial: 'c80_yax/items/index',
|
43
|
+
locals: {
|
44
|
+
items: items,
|
45
|
+
without_paginator: true,
|
46
|
+
thumb_size: thumb_size
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
35
50
|
private
|
36
51
|
|
37
52
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module C80Yax
|
2
|
+
module Items
|
3
|
+
module Shared
|
4
|
+
module AsterixHelper
|
5
|
+
|
6
|
+
def render_asterix
|
7
|
+
# TODO-5:: перенести этот текст в базу, в свойства модуля
|
8
|
+
a = '*точная стоимость будет озвучена нашим менеджером при телефонном разговоре с клиентом'
|
9
|
+
"<p>#{a}</p>".html_safe
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module C80Yax
|
2
|
+
module Items
|
3
|
+
module Shared
|
4
|
+
module BuyOptionsHelper
|
5
|
+
|
6
|
+
def render_buy_options
|
7
|
+
|
8
|
+
elems = [
|
9
|
+
{
|
10
|
+
label: 'Нестандартные цвета<br>(+20% к стоимости)',
|
11
|
+
value: '1',
|
12
|
+
style: 'small'
|
13
|
+
},
|
14
|
+
{
|
15
|
+
label: 'Цвета с металлическим блеском<br>(+20% к стоимости)',
|
16
|
+
value: '2',
|
17
|
+
style: 'small'
|
18
|
+
},
|
19
|
+
{
|
20
|
+
label: 'Заказать доставку',
|
21
|
+
value: '3',
|
22
|
+
style: 'huge'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
|
26
|
+
render :partial => 'c80_yax/items/buy_options',
|
27
|
+
:locals => {
|
28
|
+
elems: elems
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module C80Yax
|
2
|
+
module Items
|
3
|
+
module Shared
|
4
|
+
module ItemViewHelper
|
5
|
+
|
6
|
+
# вывести первого попавшегося Производителя, назначенного Товару
|
7
|
+
def print_vendor(itm)
|
8
|
+
str = '-'
|
9
|
+
# noinspection RubyResolve
|
10
|
+
if itm.vendors.count > 0
|
11
|
+
str = itm.vendors.first.title
|
12
|
+
end
|
13
|
+
str
|
14
|
+
end
|
15
|
+
|
16
|
+
def item_print_full_desc(itm)
|
17
|
+
r = ''
|
18
|
+
# noinspection RubyResolve
|
19
|
+
r = itm.full_desc if itm.full_desc.present?
|
20
|
+
r.html_safe
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/app/models/c80_yax/item.rb
CHANGED
@@ -37,6 +37,12 @@ class C80Yax::Item < ActiveRecord::Base
|
|
37
37
|
has_many :related_childs, :class_name => 'C80Yax::Item', :foreign_key => 'related_parent_id'
|
38
38
|
belongs_to :related_parent, :class_name => 'C80Yax::Item'
|
39
39
|
|
40
|
+
has_and_belongs_to_many :similar_items,
|
41
|
+
class_name: 'C80Yax::Item',
|
42
|
+
join_table: 'c80_yax_items_similar',
|
43
|
+
foreign_key: 'item_id',
|
44
|
+
association_foreign_key: 'similar_item_id'
|
45
|
+
|
40
46
|
extend FriendlyId
|
41
47
|
friendly_id :slug_candidates, :use => :slugged
|
42
48
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render_show_item(item, false) %>
|
2
|
+
|
3
|
+
<div class="other_items">
|
4
|
+
<h2 class="yield_h2">Похожие товары</h2>
|
5
|
+
<%= c80_yax_render_related(item, 'thumb_md', 4) %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="similar_items">
|
9
|
+
<h2 class="yield_h2">С этим товаром часто покупают</h2>
|
10
|
+
<%= c80_yax_render_similar(item, 'thumb_md', 4) %>
|
11
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateC80YaxJoinTableItemsItemsSimilar < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :c80_yax_items_similar, id: false do |t|
|
4
|
+
t.integer :item_id
|
5
|
+
t.integer :similar_item_id
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index(:c80_yax_items_similar, [:item_id, :similar_item_id], :unique => true)
|
9
|
+
add_index(:c80_yax_items_similar, [:similar_item_id, :item_id], :unique => true)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
remove_index(:c80_yax_items_similar, [:similar_item_id, :item_id])
|
14
|
+
remove_index(:c80_yax_items_similar, [:item_id, :similar_item_id])
|
15
|
+
drop_table :c80_yax_items_similar
|
16
|
+
end
|
17
|
+
end
|
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.10
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,11 +164,11 @@ files:
|
|
164
164
|
- app/helpers/c80_yax/cats/cat_view_helper.rb
|
165
165
|
- app/helpers/c80_yax/data_helper.rb
|
166
166
|
- app/helpers/c80_yax/frontend/catalog_index_helper.rb
|
167
|
-
- app/helpers/c80_yax/items/asterix_helper.rb
|
168
|
-
- app/helpers/c80_yax/items/buy_options_helper.rb
|
169
|
-
- app/helpers/c80_yax/items/item_view_helper.rb
|
170
167
|
- app/helpers/c80_yax/items/photos/item_photos_helper.rb
|
171
168
|
- app/helpers/c80_yax/items/render_show_item_helper.rb
|
169
|
+
- app/helpers/c80_yax/items/shared/asterix_helper.rb
|
170
|
+
- app/helpers/c80_yax/items/shared/buy_options_helper.rb
|
171
|
+
- app/helpers/c80_yax/items/shared/item_view_helper.rb
|
172
172
|
- app/helpers/c80_yax/prop_name_helper.rb
|
173
173
|
- app/helpers/c80_yax/strsubcats/props_helper.rb
|
174
174
|
- app/helpers/c80_yax/uom_helper.rb
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- app/models/c80_yax/vendor.rb
|
196
196
|
- app/uploaders/c80_yax/icat_uploader.rb
|
197
197
|
- app/uploaders/c80_yax/iphoto_uploader.rb
|
198
|
+
- app/views/admin/items/_show.html.erb
|
198
199
|
- app/views/admin/strsubcats/_view.html.erb
|
199
200
|
- app/views/c80_yax/cats/_cats_iconed_list.html.erb
|
200
201
|
- app/views/c80_yax/items/_buy_options.html.erb
|
@@ -232,6 +233,7 @@ files:
|
|
232
233
|
- db/migrate/20170622194040_create_c80_yax_join_table_items_vendors.rb
|
233
234
|
- db/migrate/20170625175353_create_c80_yax_colors.rb
|
234
235
|
- db/migrate/20170625180000_create_c80_yax_join_table_colors_items.rb
|
236
|
+
- db/migrate/20170707060000_create_c80_yax_join_table_items_items_similar.rb
|
235
237
|
- db/seeds/c80_yax_01_fill_props.rb
|
236
238
|
- engines/pack/README.md
|
237
239
|
- engines/pack/app/admin/pack/suites.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module C80Yax
|
2
|
-
module Items
|
3
|
-
module AsterixHelper
|
4
|
-
|
5
|
-
def render_asterix
|
6
|
-
# TODO-5:: перенести этот текст в базу, в свойства модуля
|
7
|
-
a = '*точная стоимость будет озвучена нашим менеджером при телефонном разговоре с клиентом'
|
8
|
-
"<p>#{a}</p>".html_safe
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module C80Yax
|
2
|
-
module Items
|
3
|
-
module BuyOptionsHelper
|
4
|
-
|
5
|
-
def render_buy_options
|
6
|
-
|
7
|
-
elems = [
|
8
|
-
{
|
9
|
-
label: 'Нестандартные цвета<br>(+20% к стоимости)',
|
10
|
-
value: '1',
|
11
|
-
style: 'small'
|
12
|
-
},
|
13
|
-
{
|
14
|
-
label: 'Цвета с металлическим блеском<br>(+20% к стоимости)',
|
15
|
-
value: '2',
|
16
|
-
style: 'small'
|
17
|
-
},
|
18
|
-
{
|
19
|
-
label: 'Заказать доставку',
|
20
|
-
value: '3',
|
21
|
-
style: 'huge'
|
22
|
-
}
|
23
|
-
]
|
24
|
-
|
25
|
-
render :partial => 'c80_yax/items/buy_options',
|
26
|
-
:locals => {
|
27
|
-
elems: elems
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module C80Yax
|
2
|
-
module Items
|
3
|
-
module ItemViewHelper
|
4
|
-
|
5
|
-
# вывести первого попавшегося Производителя, назначенного Товару
|
6
|
-
def print_vendor(itm)
|
7
|
-
str = '-'
|
8
|
-
# noinspection RubyResolve
|
9
|
-
if itm.vendors.count > 0
|
10
|
-
str = itm.vendors.first.title
|
11
|
-
end
|
12
|
-
str
|
13
|
-
end
|
14
|
-
|
15
|
-
def item_print_full_desc(itm)
|
16
|
-
r = ''
|
17
|
-
# noinspection RubyResolve
|
18
|
-
r = itm.full_desc if itm.full_desc.present?
|
19
|
-
r.html_safe
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|