enjoy_cms_catalog 0.2.0.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/enjoy/catalog/decorators/item_categories.rb +5 -0
- data/app/controllers/concerns/enjoy/catalog/decorators/items.rb +5 -0
- data/app/controllers/enjoy/catalog/item_categories_controller.rb +2 -0
- data/app/controllers/enjoy/catalog/items_controller.rb +2 -0
- data/enjoy_cms_catalog.gemspec +1 -5
- data/lib/enjoy/catalog/admin/item.rb +2 -2
- data/lib/enjoy/catalog/admin/item_category.rb +14 -8
- data/lib/enjoy/catalog/controllers/items.rb +1 -1
- data/lib/enjoy/catalog/models/item.rb +0 -9
- data/lib/enjoy/catalog/models/item_category.rb +0 -17
- data/lib/enjoy/catalog/models/item_category_image.rb +0 -9
- data/lib/enjoy/catalog/models/item_image.rb +0 -9
- data/lib/enjoy/catalog/models/mongoid/item.rb +5 -4
- data/lib/enjoy/catalog/models/mongoid/item_category.rb +12 -2
- data/lib/enjoy/catalog/version.rb +1 -1
- metadata +8 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38d3f0bc0de2667ad75dfc5647106c3a83e6843c
|
4
|
+
data.tar.gz: 55f3ecc1ede6616068a73837e5289fbda08ab315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889ecc3bcb16e643ebc714c0234a919bfd974c576d1b580fbc7c8495dd93c8ae39ff84dad51818531627f902036f4cfd656aa83a4b161fda140017f884e69b8d
|
7
|
+
data.tar.gz: 22592e5f748586af88081a69d6b511f645f6b4fb77105d77a2427cd13fa158f9504c99783682143c8ecffeaa62f68e88a3b1ceed9434b3d14146b2b894741687
|
data/enjoy_cms_catalog.gemspec
CHANGED
@@ -31,12 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "bundler", "~> 1.10"
|
32
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
33
|
|
34
|
-
spec.add_dependency 'rails', '>= 4.1.0', '< 5.0'
|
35
|
-
|
36
34
|
spec.add_dependency 'money-rails'
|
37
35
|
spec.add_dependency 'mongoid_money_field'
|
38
36
|
|
39
|
-
spec.add_dependency 'enjoy_cms'
|
40
|
-
spec.add_dependency 'rails_admin_sort_embedded'
|
41
|
-
spec.add_dependency 'ack_rails_admin_jcrop'
|
37
|
+
spec.add_dependency 'enjoy_cms', "~> 0.3.0"
|
42
38
|
end
|
@@ -15,8 +15,10 @@ module Enjoy::Catalog
|
|
15
15
|
read_only true
|
16
16
|
|
17
17
|
pretty_value do
|
18
|
-
bindings[:object].items.to_a.map { |
|
19
|
-
|
18
|
+
bindings[:object].items.to_a.map { |i|
|
19
|
+
route = (bindings[:view] || bindings[:controller])
|
20
|
+
model_name = i.rails_admin_model
|
21
|
+
route.link_to(i.name, route.rails_admin.show_path(model_name: model_name, id: i.id), title: i.name)
|
20
22
|
}.join("<br>").html_safe
|
21
23
|
end
|
22
24
|
end
|
@@ -42,8 +44,8 @@ module Enjoy::Catalog
|
|
42
44
|
:image_jcrop_options
|
43
45
|
end
|
44
46
|
end
|
45
|
-
field :excerpt, :
|
46
|
-
field :content, :
|
47
|
+
field :excerpt, :enjoy_html
|
48
|
+
field :content, :enjoy_html
|
47
49
|
|
48
50
|
field :item_category_images
|
49
51
|
|
@@ -77,8 +79,10 @@ module Enjoy::Catalog
|
|
77
79
|
help 'Список товаров'
|
78
80
|
|
79
81
|
pretty_value do
|
80
|
-
bindings[:object].items.to_a.map { |
|
81
|
-
|
82
|
+
bindings[:object].items.to_a.map { |i|
|
83
|
+
route = (bindings[:view] || bindings[:controller])
|
84
|
+
model_name = i.rails_admin_model
|
85
|
+
route.link_to(i.name, route.rails_admin.show_path(model_name: model_name, id: i.id), title: i.name)
|
82
86
|
}.join("<br>").html_safe
|
83
87
|
end
|
84
88
|
end
|
@@ -108,8 +112,10 @@ module Enjoy::Catalog
|
|
108
112
|
read_only true
|
109
113
|
|
110
114
|
pretty_value do
|
111
|
-
|
112
|
-
|
115
|
+
bindings[:object].items.to_a.map { |i|
|
116
|
+
route = (bindings[:view] || bindings[:controller])
|
117
|
+
model_name = i.rails_admin_model
|
118
|
+
route.link_to(i.name, route.rails_admin.show_path(model_name: model_name, id: i.id), title: i.name)
|
113
119
|
}.join("<br>").html_safe
|
114
120
|
end
|
115
121
|
end
|
@@ -26,15 +26,6 @@ module Enjoy::Catalog
|
|
26
26
|
def clean_content
|
27
27
|
Rails::Html::FullSanitizer.new.sanitize(self.content.strip)
|
28
28
|
end
|
29
|
-
|
30
|
-
module ClassMethods
|
31
|
-
def rails_admin_add_fields
|
32
|
-
{}
|
33
|
-
end
|
34
|
-
|
35
|
-
def rails_admin_add_config(config)
|
36
|
-
end
|
37
|
-
end
|
38
29
|
end
|
39
30
|
end
|
40
31
|
end
|
@@ -27,23 +27,6 @@ module Enjoy::Catalog
|
|
27
27
|
Enjoy::Catalog::Item
|
28
28
|
end
|
29
29
|
|
30
|
-
def items
|
31
|
-
item_class.in(item_category_ids: self.id)
|
32
|
-
end
|
33
|
-
|
34
|
-
def all_items
|
35
|
-
item_class.any_in(item_category_ids: self.self_and_descendants.map(&:id))
|
36
|
-
end
|
37
|
-
|
38
|
-
module ClassMethods
|
39
|
-
def rails_admin_add_fields
|
40
|
-
{}
|
41
|
-
end
|
42
|
-
|
43
|
-
def rails_admin_add_config(config)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
30
|
end
|
48
31
|
end
|
49
32
|
end
|
@@ -5,9 +5,9 @@ module Enjoy::Catalog
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
include Enjoy::MongoidPaperclip
|
7
7
|
|
8
|
-
|
9
|
-
# default_scope -> { unscoped.any_of( {_type: nil}, {type: ""}, {_type: "Enjoy::Catalog::Item"} ) }
|
8
|
+
include Enjoy::HtmlField
|
10
9
|
|
10
|
+
included do
|
11
11
|
field :name, type: String, localize: Enjoy.configuration.localize, default: ""
|
12
12
|
|
13
13
|
enjoy_cms_mongoid_attached_file(:image,
|
@@ -18,10 +18,11 @@ module Enjoy::Catalog
|
|
18
18
|
acts_as_nested_set
|
19
19
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
|
22
|
+
enjoy_cms_html_field :content, type: String, localize: Enjoy.configuration.localize, default: ""
|
23
23
|
|
24
24
|
has_and_belongs_to_many :item_categories, class_name: "Enjoy::Catalog::ItemCategory", inverse_of: nil
|
25
|
+
alias :categories :item_categories
|
25
26
|
|
26
27
|
embeds_many :item_images, cascade_callbacks: true, class_name: "Enjoy::Catalog::ItemImage"
|
27
28
|
alias :images :item_images
|
@@ -5,6 +5,8 @@ module Enjoy::Catalog
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
include Enjoy::MongoidPaperclip
|
7
7
|
|
8
|
+
include Enjoy::HtmlField
|
9
|
+
|
8
10
|
included do
|
9
11
|
field :name, type: String, localize: Enjoy.configuration.localize, default: ""
|
10
12
|
|
@@ -16,14 +18,22 @@ module Enjoy::Catalog
|
|
16
18
|
acts_as_nested_set
|
17
19
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
|
22
|
+
enjoy_cms_html_field :content, type: String, localize: Enjoy.configuration.localize, default: ""
|
21
23
|
|
22
24
|
embeds_many :item_category_images, cascade_callbacks: true, class_name: "Enjoy::Catalog::ItemCategoryImage"
|
23
25
|
alias :images :item_category_images
|
24
26
|
accepts_nested_attributes_for :item_category_images, allow_destroy: true
|
25
27
|
end
|
26
28
|
|
29
|
+
def items
|
30
|
+
item_class.in(item_category_ids: self.id)
|
31
|
+
end
|
32
|
+
|
33
|
+
def all_items
|
34
|
+
item_class.any_in(item_category_ids: self.self_and_descendants.map(&:id))
|
35
|
+
end
|
36
|
+
|
27
37
|
def image_styles
|
28
38
|
Enjoy::Catalog.configuration.item_category_image_styles
|
29
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enjoy_cms_catalog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,26 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 4.1.0
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '5.0'
|
51
|
-
type: :runtime
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 4.1.0
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '5.0'
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
42
|
name: money-rails
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,44 +70,16 @@ dependencies:
|
|
90
70
|
name: enjoy_cms
|
91
71
|
requirement: !ruby/object:Gem::Requirement
|
92
72
|
requirements:
|
93
|
-
- - "
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: rails_admin_sort_embedded
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :runtime
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: ack_rails_admin_jcrop
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
73
|
+
- - "~>"
|
122
74
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
75
|
+
version: 0.3.0
|
124
76
|
type: :runtime
|
125
77
|
prerelease: false
|
126
78
|
version_requirements: !ruby/object:Gem::Requirement
|
127
79
|
requirements:
|
128
|
-
- - "
|
80
|
+
- - "~>"
|
129
81
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
82
|
+
version: 0.3.0
|
131
83
|
description: Items catalog with EnjoyCMS support.
|
132
84
|
email:
|
133
85
|
- dev@enjoycreate.ru
|
@@ -144,6 +96,8 @@ files:
|
|
144
96
|
- Rakefile
|
145
97
|
- app/assets/javascripts/enjoy_cms_catalog/enjoy_cms_catalog.coffee
|
146
98
|
- app/assets/stylesheets/enjoy_cms_catalog/enjoy_cms_catalog.sass
|
99
|
+
- app/controllers/concerns/enjoy/catalog/decorators/item_categories.rb
|
100
|
+
- app/controllers/concerns/enjoy/catalog/decorators/items.rb
|
147
101
|
- app/controllers/enjoy/catalog/item_categories_controller.rb
|
148
102
|
- app/controllers/enjoy/catalog/items_controller.rb
|
149
103
|
- app/models/concerns/enjoy/catalog/decorators/item.rb
|