c80_yax 0.1.0.1 → 0.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +50 -13
- data/app/admin/c80_yax/cats.rb +47 -0
- data/app/admin/c80_yax/items.rb +36 -30
- data/app/admin/c80_yax/lib/custom_columns.rb +37 -0
- data/app/admin/c80_yax/prop_names.rb +13 -9
- data/app/admin/c80_yax/strsubcats.rb +114 -57
- data/app/admin/c80_yax/vendors.rb +39 -0
- data/app/assets/javascripts/backend/items.js +1 -1
- data/app/assets/javascripts/backend/strsubcats.js +26 -0
- data/app/assets/javascripts/c80_yax.js.coffee +3 -1
- data/app/assets/javascripts/lib_backend/custom_columns.js +73 -0
- data/app/assets/javascripts/lib_backend/init.js +28 -0
- data/app/assets/javascripts/lib_backend/loading.js +8 -0
- data/app/assets/stylesheets/c80_yax/_mixins/_colors.scss +1 -0
- data/app/assets/stylesheets/c80_yax/_mixins/color_button.scss +31 -0
- data/app/assets/stylesheets/c80_yax/_mixins/shdw.scss +10 -0
- data/app/assets/stylesheets/c80_yax/backend/active_admin/admin_items.scss +1 -1
- data/app/assets/stylesheets/c80_yax/backend/collapsed.scss +1 -1
- data/app/assets/stylesheets/c80_yax/elems/add_to_bucket.scss +11 -0
- data/app/assets/stylesheets/c80_yax/lib/bootstrap_checkboxes.scss +58 -0
- data/app/assets/stylesheets/c80_yax/lib_custom/bootstrap_checkboxes.scss +6 -0
- data/app/assets/stylesheets/c80_yax.scss +1 -0
- data/app/assets/stylesheets/c80_yax_backend.scss +2 -1
- data/app/helpers/c80_yax/items/asterix_helper.rb +13 -0
- data/app/helpers/c80_yax/items/buy_options_helper.rb +33 -0
- data/app/helpers/c80_yax/items/item_view_helper.rb +24 -0
- data/app/helpers/c80_yax/items/photos/item_photos_helper.rb +43 -0
- data/app/helpers/c80_yax/items/render_show_item_helper.rb +17 -0
- data/app/helpers/c80_yax/prop_name_helper.rb +11 -0
- data/app/helpers/c80_yax/strsubcats/props_helper.rb +81 -0
- data/app/helpers/c80_yax/uom_helper.rb +19 -0
- data/app/models/c80_yax/cat.rb +25 -0
- data/app/models/c80_yax/common_prop.rb +51 -0
- data/app/models/c80_yax/concerns/props/parsable.rb +129 -0
- data/app/models/c80_yax/item.rb +3 -1
- data/app/models/c80_yax/item_observer.rb +29 -0
- data/app/models/c80_yax/main_prop.rb +37 -0
- data/app/models/c80_yax/mixins/item/database/props.rb +66 -0
- data/app/models/c80_yax/mixins/strsubcat/database/prop_names_changed.rb +56 -0
- data/app/models/c80_yax/mixins/strsubcat/database/props.rb +37 -0
- data/app/models/c80_yax/prefix_prop.rb +35 -0
- data/app/models/c80_yax/price_prop.rb +47 -0
- data/app/models/c80_yax/prop_name.rb +4 -4
- data/app/models/c80_yax/strsubcat.rb +38 -23
- data/app/models/c80_yax/strsubcat_observer.rb +47 -0
- data/app/models/c80_yax/vendor.rb +16 -0
- data/app/views/admin/strsubcats/_view.html.erb +40 -0
- data/app/views/c80_yax/items/_buy_options.html.erb +9 -0
- data/c80_yax.gemspec +3 -0
- data/config/locales/ru.yml +33 -6
- data/db/migrate/20161030225354_create_c80_yax_items.rb +2 -0
- data/db/migrate/20170620111100_create_c80_yax_cats.rb +11 -0
- data/db/migrate/20170620111401_create_c80_yax_join_table_cats_strsubcats.rb +12 -0
- data/db/migrate/20170620164848_create_c80_yax_price_props.rb +9 -0
- data/db/migrate/20170620164949_create_c80_yax_join_table_price_props_prop_names.rb +12 -0
- data/db/migrate/20170620183838_create_c80_yax_main_props.rb +8 -0
- data/db/migrate/20170620195757_create_c80_yax_join_table_main_props_prop_names.rb +12 -0
- data/db/migrate/20170620200707_create_c80_yax_common_props.rb +8 -0
- data/db/migrate/20170620200808_create_c80_yax_join_table_common_props_prop_names.rb +12 -0
- data/db/migrate/20170621170202_create_c80_yax_prefix_props.rb +8 -0
- data/db/migrate/20170621170808_create_c80_yax_join_table_prefix_props_prop_names.rb +12 -0
- data/db/migrate/20170622193535_create_c80_yax_vendors.rb +11 -0
- data/db/migrate/20170622194040_create_c80_yax_join_table_items_vendors.rb +12 -0
- data/lib/c80_yax/engine.rb +2 -0
- data/lib/c80_yax/strsubcat_runtime_tables.rb +668 -0
- data/lib/c80_yax/version.rb +1 -1
- data/lib/c80_yax.rb +4 -2
- data/lib/generators/c80_yax/install_generator.rb +20 -0
- data/lib/generators/c80_yax/templates/app/helpers/c80_yax/items/show_item_helper.rb +21 -0
- metadata +98 -4
- data/app/assets/stylesheets/c80_yax/mixins.scss +0 -89
@@ -0,0 +1,40 @@
|
|
1
|
+
<table class="index_table">
|
2
|
+
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th colspan="3"><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_view_title') %></th>
|
6
|
+
</tr>
|
7
|
+
</thead>
|
8
|
+
|
9
|
+
<tbody>
|
10
|
+
<tr>
|
11
|
+
<td><%= I18n.t('activerecord.attributes.c80_yax/strsubcat.cats') %></td>
|
12
|
+
<td><%= cat_admin_title(s) %></td>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<td><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_all_props') %></td>
|
16
|
+
<td><%= all_props_list(s) %></td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_main_props',
|
20
|
+
img: image_url('samples/2017_06_20_item_main_props.jpg')).html_safe %></td>
|
21
|
+
<td><%= main_props_list(s) %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_price_props',
|
25
|
+
img: image_url('samples/2017_06_20_item_price_props.jpg')).html_safe %></td>
|
26
|
+
<td><%= price_props_list(s) %></td>
|
27
|
+
</tr>
|
28
|
+
<tr>
|
29
|
+
<td><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_common_props',
|
30
|
+
img: image_url('samples/2017_06_20_item_common_props.jpg')).html_safe %></td>
|
31
|
+
<td><%= common_props_list(s) %></td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<td><%= I18n.t('c80_yax.active_admin.pages.strsubcat.label_prefix_props',
|
35
|
+
img: image_url('samples/2017-06-21_item_prefix_props.jpg')).html_safe %></td>
|
36
|
+
<td><%= prefix_props_list(s) %></td>
|
37
|
+
</tr>
|
38
|
+
</tbody>
|
39
|
+
|
40
|
+
</table>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% elems.each do |elem| %>
|
2
|
+
<div class="checkbox <%=elem[:style]%>">
|
3
|
+
<label>
|
4
|
+
<input type="checkbox" value="<%=elem[:value]%>" checked>
|
5
|
+
<span class="cr"><i class="cr-icon fa fa-check"></i></span>
|
6
|
+
<%= elem[:label].html_safe %>
|
7
|
+
</label>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
data/c80_yax.gemspec
CHANGED
@@ -21,6 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.12"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rails", "~> 4.2"
|
25
|
+
spec.add_development_dependency "byebug"
|
24
26
|
spec.add_dependency 'activesupport', ['>= 3.0.0']
|
27
|
+
spec.add_dependency 'rails-observers'
|
25
28
|
|
26
29
|
end
|
data/config/locales/ru.yml
CHANGED
@@ -3,28 +3,54 @@ ru:
|
|
3
3
|
active_admin:
|
4
4
|
menu:
|
5
5
|
core_item: 'Каталог'
|
6
|
-
strsubcat: '
|
6
|
+
strsubcat: 'Подкатегории'
|
7
|
+
cat: 'Категории'
|
7
8
|
item: 'Товары'
|
9
|
+
pages:
|
10
|
+
strsubcat:
|
11
|
+
label_view_title: 'Настройки подкатегории'
|
12
|
+
label_all_props: 'Характеристики, которыми описываются товары из этой подкатегории'
|
13
|
+
label_main_props: 'Характеристки, которые выводятся на странице просмотра товара под заголовком (<a class="poiasn" href="%{img}" target="_blank">например</a>)'
|
14
|
+
label_price_props: 'Ценовые характеристики, которые выводятся на странице просмотра товара (<a class="poiasn" href="%{img}" target="_blank">пример</a>)'
|
15
|
+
label_common_props: 'Характеристки, которые выводятся на странице просмотра товара справа (<a class="poiasn" href="%{img}" target="_blank">например</a>)'
|
16
|
+
label_prefix_props: 'Префикс-характеристики (<a class="poiasn" href="%{img}" target="_blank">например</a>)'
|
8
17
|
activerecord:
|
9
18
|
models:
|
10
19
|
strsubcat:
|
20
|
+
one: 'подкатегорию'
|
21
|
+
other: 'Подкатегории'
|
22
|
+
cat:
|
11
23
|
one: 'категорию'
|
12
24
|
other: 'Категории'
|
13
25
|
item:
|
14
26
|
one: 'товар'
|
15
27
|
other: 'Товары'
|
28
|
+
prop_name:
|
29
|
+
one: 'Имя свойства'
|
30
|
+
other: 'Имена свойств'
|
16
31
|
# iphoto:
|
17
32
|
# one: 'Фотоm'
|
18
33
|
# other: 'Фотоr'
|
19
34
|
attributes:
|
35
|
+
c80_yax/prop_name:
|
36
|
+
title: 'Название'
|
37
|
+
uom: 'Ед. измерения'
|
20
38
|
c80_yax/strsubcat:
|
21
39
|
id: 'id'
|
22
40
|
ord: 'Порядковый №'
|
23
41
|
title: 'Название'
|
24
42
|
created_at: 'Дата создания'
|
25
43
|
updated_at: 'Обновлено'
|
26
|
-
|
27
|
-
|
44
|
+
cats: 'Принадлежит категории'
|
45
|
+
parent: 'Принадлежит подкатегории'
|
46
|
+
parent_id_in: 'Принадлежит подкатегории'
|
47
|
+
c80_yax/cat:
|
48
|
+
id: 'id'
|
49
|
+
ord: 'Порядковый №'
|
50
|
+
title: 'Название'
|
51
|
+
strsubcats: 'Подкатегории'
|
52
|
+
created_at: 'Дата создания'
|
53
|
+
updated_at: 'Обновлено'
|
28
54
|
c80_yax/item:
|
29
55
|
id: 'id'
|
30
56
|
title: 'Название'
|
@@ -36,7 +62,8 @@ ru:
|
|
36
62
|
is_gift: 'Подарочный набор'
|
37
63
|
is_starting: 'Стартовый набор'
|
38
64
|
is_available: 'В наличии'
|
39
|
-
strsubcat: '
|
65
|
+
strsubcat: 'Подкатегория'
|
66
|
+
cat: 'Категория'
|
40
67
|
related_parent: 'related_parent'
|
41
68
|
related_childs: 'related_childs'
|
42
69
|
iphotos: 'Фото'
|
@@ -46,7 +73,7 @@ ru:
|
|
46
73
|
c80_yax/strsubcat:
|
47
74
|
attributes:
|
48
75
|
title:
|
49
|
-
taken: '
|
50
|
-
blank: 'Укажите, пожалуйста, название
|
76
|
+
taken: 'Подкатегория с таким названием уже существует'
|
77
|
+
blank: 'Укажите, пожалуйста, название подкатегории'
|
51
78
|
too_short: 'Название слишком короткое'
|
52
79
|
too_long: 'Название слишком длинное'
|
@@ -3,6 +3,7 @@ class CreateC80YaxItems < ActiveRecord::Migration
|
|
3
3
|
create_table :c80_yax_items do |t|
|
4
4
|
t.string :title
|
5
5
|
t.string :slug
|
6
|
+
t.string :image
|
6
7
|
t.text :short_desc
|
7
8
|
t.text :full_desc
|
8
9
|
t.boolean :is_hit
|
@@ -11,6 +12,7 @@ class CreateC80YaxItems < ActiveRecord::Migration
|
|
11
12
|
t.boolean :is_gift
|
12
13
|
t.boolean :is_starting
|
13
14
|
t.boolean :is_available
|
15
|
+
t.boolean :is_ask_price
|
14
16
|
t.references :strsubcat, index: true
|
15
17
|
t.references :related_parent, index: true
|
16
18
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTableCatsStrsubcats < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_cats_strsubcats, :id => false do |t|
|
4
|
+
t.integer :cat_id, :null => false
|
5
|
+
t.integer :strsubcat_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_cats_strsubcats, [:cat_id, :strsubcat_id], :unique => true, :name => 'my_index_q'
|
9
|
+
add_index :c80_yax_cats_strsubcats, [:strsubcat_id, :cat_id], :unique => true, :name => 'my_index_w'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTablePricePropsPropNames < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_price_props_prop_names, :id => false do |t|
|
4
|
+
t.integer :price_prop_id, :null => false
|
5
|
+
t.integer :prop_name_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_price_props_prop_names, [:price_prop_id, :prop_name_id], name: 'too_long1'
|
9
|
+
add_index :c80_yax_price_props_prop_names, [:prop_name_id, :price_prop_id], name: 'too_long2'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTableMainPropsPropNames < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_main_props_prop_names, :id => false do |t|
|
4
|
+
t.integer :main_prop_id, :null => false
|
5
|
+
t.integer :prop_name_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_main_props_prop_names, [:main_prop_id, :prop_name_id], name: 'too_long3'
|
9
|
+
add_index :c80_yax_main_props_prop_names, [:prop_name_id, :main_prop_id], name: 'too_long4'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTableCommonPropsPropNames < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_common_props_prop_names, :id => false do |t|
|
4
|
+
t.integer :common_prop_id, :null => false
|
5
|
+
t.integer :prop_name_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_common_props_prop_names, [:common_prop_id, :prop_name_id], name: 'too_long5'
|
9
|
+
add_index :c80_yax_common_props_prop_names, [:prop_name_id, :common_prop_id], name: 'too_long6'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTablePrefixPropsPropNames < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_prefix_props_prop_names, :id => false do |t|
|
4
|
+
t.integer :prefix_prop_id, :null => false
|
5
|
+
t.integer :prop_name_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_prefix_props_prop_names, [:prefix_prop_id, :prop_name_id], name: 'too_long7'
|
9
|
+
add_index :c80_yax_prefix_props_prop_names, [:prop_name_id, :prefix_prop_id], name: 'too_long8'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateC80YaxVendors < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_vendors do |t|
|
4
|
+
t.string "title", limit: 255
|
5
|
+
t.text "short", limit: 65535
|
6
|
+
t.text "content", limit: 16777215
|
7
|
+
t.boolean "as_is", limit: 1
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateC80YaxJoinTableItemsVendors < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :c80_yax_items_vendors, :id => false do |t|
|
4
|
+
t.integer :item_id, :null => false
|
5
|
+
t.integer :vendor_id, :null => false
|
6
|
+
end
|
7
|
+
|
8
|
+
add_index :c80_yax_items_vendors, [:item_id, :vendor_id], name: 'too_long9'
|
9
|
+
add_index :c80_yax_items_vendors, [:vendor_id, :item_id], name: 'too_long10'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
data/lib/c80_yax/engine.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
module C80Yax
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
config.autoload_paths += %W(#{config.root}/app/models/c80_yax/concerns)
|
3
4
|
isolate_namespace C80Yax
|
4
5
|
|
5
6
|
initializer :c80_yax_engine do
|
6
7
|
if defined?(ActiveAdmin)
|
8
|
+
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/helpers/**/"]
|
7
9
|
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/**/"]
|
8
10
|
#ActiveAdmin.application.load_paths += Dir["#{config.root}/app/models/concerns/**/"]
|
9
11
|
ActiveAdmin.application.load_paths += Dir["#{config.root}/app/admin/c80_yax/**/"]
|