enjoy_cms_catalog 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/enjoy_cms_catalog.gemspec +1 -1
- data/lib/enjoy/catalog/admin/item.rb +1 -11
- data/lib/enjoy/catalog/admin/item_category.rb +4 -12
- data/lib/enjoy/catalog/controllers/items.rb +1 -1
- data/lib/enjoy/catalog/models/item.rb +0 -12
- data/lib/enjoy/catalog/models/item_category.rb +0 -8
- data/lib/enjoy/catalog/models/mongoid/item.rb +5 -1
- data/lib/enjoy/catalog/models/mongoid/item_category.rb +5 -1
- data/lib/enjoy/catalog/models/mongoid/item_category_image.rb +4 -0
- data/lib/enjoy/catalog/models/mongoid/item_image.rb +4 -0
- data/lib/enjoy/catalog/version.rb +1 -1
- data/lib/generators/enjoy/catalog/all_generator.rb +17 -0
- data/lib/generators/enjoy/catalog/config/install_generator.rb +13 -0
- data/lib/generators/enjoy/catalog/config/templates/enjoy_catalog.erb +18 -0
- data/lib/generators/enjoy/catalog/controllers/all_generator.rb +28 -0
- data/lib/generators/enjoy/catalog/controllers/item_category_generator.rb +43 -0
- data/lib/generators/enjoy/catalog/controllers/item_generator.rb +43 -0
- data/lib/generators/enjoy/catalog/controllers/templates/item_categories_controller.erb +10 -0
- data/lib/generators/enjoy/catalog/controllers/templates/items_controller.erb +10 -0
- data/lib/generators/enjoy/catalog/models/all_generator.rb +38 -0
- data/lib/generators/enjoy/catalog/models/item_category_generator.rb +39 -0
- data/lib/generators/enjoy/catalog/models/item_category_image_generator.rb +39 -0
- data/lib/generators/enjoy/catalog/models/item_generator.rb +34 -0
- data/lib/generators/enjoy/catalog/models/item_image_generator.rb +39 -0
- data/lib/generators/enjoy/catalog/models/templates/item.erb +32 -0
- data/lib/generators/enjoy/catalog/models/templates/item_category.erb +30 -0
- data/lib/generators/enjoy/catalog/models/templates/item_category_image.erb +30 -0
- data/lib/generators/enjoy/catalog/models/templates/item_image.erb +30 -0
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dcc9e6dfe4bfb5b628d62e0a3d674ae894ecc02
|
4
|
+
data.tar.gz: 4df60483663fa45698f4565ac340e5784421f67d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f854240f5feb44f8fa235874c06bfec9d7d7820792aa3f7be35a7ffb716998520503d14625144b41c31854ed6a14ac18828fe243752ed4390cb565e18854b63
|
7
|
+
data.tar.gz: 73199aff546f1a80c32a75e9248e0a0c181e0a4f144c6170d6b27cc05f94e7617a2fe9c52c6661fee822e8b415bb21999490cdf0fd45d8ef2b009ac2a65a88ab
|
data/enjoy_cms_catalog.gemspec
CHANGED
@@ -51,17 +51,7 @@ module Enjoy::Catalog
|
|
51
51
|
|
52
52
|
field :item_images
|
53
53
|
|
54
|
-
|
55
|
-
if type.nil?
|
56
|
-
field name
|
57
|
-
else
|
58
|
-
if type.is_a?(Array)
|
59
|
-
field name, type[0], &type[1]
|
60
|
-
else
|
61
|
-
field name, type
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
54
|
+
Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
|
65
55
|
|
66
56
|
group :seo do
|
67
57
|
active false
|
@@ -28,6 +28,7 @@ module Enjoy::Catalog
|
|
28
28
|
field :enabled, :toggle
|
29
29
|
field :name
|
30
30
|
group :URL do
|
31
|
+
active false
|
31
32
|
field :slugs, :enum do
|
32
33
|
enum_method do
|
33
34
|
:slugs
|
@@ -55,17 +56,7 @@ module Enjoy::Catalog
|
|
55
56
|
|
56
57
|
field :item_category_images
|
57
58
|
|
58
|
-
|
59
|
-
if type.nil?
|
60
|
-
field name
|
61
|
-
else
|
62
|
-
if type.is_a?(Array)
|
63
|
-
field name, type[0], &type[1]
|
64
|
-
else
|
65
|
-
field name, type
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
59
|
+
Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
|
69
60
|
|
70
61
|
group :seo do
|
71
62
|
active false
|
@@ -99,7 +90,6 @@ module Enjoy::Catalog
|
|
99
90
|
|
100
91
|
show do
|
101
92
|
field :name
|
102
|
-
field :sidebar_title
|
103
93
|
field :slugs, :enum do
|
104
94
|
enum_method do
|
105
95
|
:slugs
|
@@ -117,6 +107,8 @@ module Enjoy::Catalog
|
|
117
107
|
field :excerpt
|
118
108
|
field :content
|
119
109
|
|
110
|
+
Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
|
111
|
+
|
120
112
|
field :items do
|
121
113
|
read_only true
|
122
114
|
|
@@ -13,18 +13,6 @@ module Enjoy::Catalog
|
|
13
13
|
|
14
14
|
included do
|
15
15
|
manual_slug :name
|
16
|
-
|
17
|
-
rails_admin(&Enjoy::Catalog::Admin::Item.config(rails_admin_add_fields) { |config|
|
18
|
-
rails_admin_add_config(config)
|
19
|
-
})
|
20
|
-
end
|
21
|
-
|
22
|
-
def clean_excerpt
|
23
|
-
Rails::Html::FullSanitizer.new.sanitize(self.excerpt.strip)
|
24
|
-
end
|
25
|
-
|
26
|
-
def clean_content
|
27
|
-
Rails::Html::FullSanitizer.new.sanitize(self.content.strip)
|
28
16
|
end
|
29
17
|
end
|
30
18
|
end
|
@@ -15,14 +15,6 @@ module Enjoy::Catalog
|
|
15
15
|
manual_slug :name
|
16
16
|
end
|
17
17
|
|
18
|
-
def clean_excerpt
|
19
|
-
Rails::Html::FullSanitizer.new.sanitize(self.excerpt.strip)
|
20
|
-
end
|
21
|
-
|
22
|
-
def clean_content
|
23
|
-
Rails::Html::FullSanitizer.new.sanitize(self.content.strip)
|
24
|
-
end
|
25
|
-
|
26
18
|
def item_class
|
27
19
|
Enjoy::Catalog::Item
|
28
20
|
end
|
@@ -11,7 +11,7 @@ module Enjoy::Catalog
|
|
11
11
|
if defined?(RailsAdminComments)
|
12
12
|
include RailsAdminComments::Commentable
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
field :name, type: String, localize: Enjoy.configuration.localize, default: ""
|
16
16
|
|
17
17
|
enjoy_cms_mongoid_attached_file(:image,
|
@@ -40,6 +40,10 @@ module Enjoy::Catalog
|
|
40
40
|
def image_styles
|
41
41
|
Enjoy::Catalog.configuration.item_image_styles
|
42
42
|
end
|
43
|
+
|
44
|
+
def image_jcrop_options
|
45
|
+
{}
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
@@ -11,7 +11,7 @@ module Enjoy::Catalog
|
|
11
11
|
if defined?(RailsAdminComments)
|
12
12
|
include RailsAdminComments::Commentable
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
field :name, type: String, localize: Enjoy.configuration.localize, default: ""
|
16
16
|
|
17
17
|
enjoy_cms_mongoid_attached_file(:image,
|
@@ -41,6 +41,10 @@ module Enjoy::Catalog
|
|
41
41
|
def image_styles
|
42
42
|
Enjoy::Catalog.configuration.item_category_image_styles
|
43
43
|
end
|
44
|
+
|
45
|
+
def image_jcrop_options
|
46
|
+
{}
|
47
|
+
end
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog
|
4
|
+
class AllGenerator < Rails::Generators::Base
|
5
|
+
argument :class_name, type: :string
|
6
|
+
|
7
|
+
desc 'Enjoy::Catalog Controllers generator'
|
8
|
+
def all
|
9
|
+
generate "enjoy:catalog:config:install"
|
10
|
+
|
11
|
+
generate "enjoy:catalog:models:all #{class_name}"
|
12
|
+
|
13
|
+
generate "enjoy:catalog:controllers:all #{class_name}"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Config
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
7
|
+
desc 'Enjoy::Catalog Config generator'
|
8
|
+
def install
|
9
|
+
template 'enjoy_catalog.erb', "config/initializers/enjoy_catalog.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Enjoy::Catalog.configure do |config|
|
2
|
+
##### defaults #####
|
3
|
+
# config.item_image_styles = {}
|
4
|
+
# config.item_per_page = 10
|
5
|
+
#
|
6
|
+
# config.item_images_image_styles = {}
|
7
|
+
#
|
8
|
+
# config.item_category_image_styles = {}
|
9
|
+
# config.item_category_per_page = 10
|
10
|
+
#
|
11
|
+
# config.item_category_images_image_styles = {}
|
12
|
+
#
|
13
|
+
# config.routes_config = {
|
14
|
+
# use_items_path: true,
|
15
|
+
# use_item_categories_path: true,
|
16
|
+
# use_catalog_path: true
|
17
|
+
# }
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Controllers
|
4
|
+
class AllGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :category_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog Controllers generator'
|
10
|
+
def all
|
11
|
+
generate "enjoy:catalog:controllers:item #{camelcased_class_name}"
|
12
|
+
generate "enjoy:catalog:controllers:item_category #{category_class_name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def capitalized_class_name
|
17
|
+
class_name.capitalize
|
18
|
+
end
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def category_class_name
|
24
|
+
category_class_name_arg.blank? ? "#{camelcased_class_name}Category" : category_class_name_arg
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Controllers
|
4
|
+
class ItemCategoryGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :item_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog ItemCategory Controller generator'
|
10
|
+
def item_category
|
11
|
+
template 'item_categories_controller.erb', "app/controllers/#{file_name}_controller.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def capitalized_class_name
|
16
|
+
class_name.capitalize
|
17
|
+
end
|
18
|
+
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def camelcased_pluralized_class_name
|
24
|
+
camelcased_class_name.pluralize
|
25
|
+
end
|
26
|
+
|
27
|
+
def file_name
|
28
|
+
underscored_pluralized_class_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscored_class_name
|
32
|
+
camelcased_class_name.underscore
|
33
|
+
end
|
34
|
+
|
35
|
+
def underscored_pluralized_class_name
|
36
|
+
underscored_class_name.pluralize
|
37
|
+
end
|
38
|
+
|
39
|
+
def item_class_name
|
40
|
+
item_class_name_arg.blank? ? camelcased_class_name.sub(/Category$/, "") : item_class_name_arg
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Controllers
|
4
|
+
class ItemGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :item_category_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog Item Controller generator'
|
10
|
+
def item
|
11
|
+
template 'items_controller.erb', "app/controllers/#{file_name}_controller.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def capitalized_class_name
|
16
|
+
class_name.capitalize
|
17
|
+
end
|
18
|
+
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def camelcased_pluralized_class_name
|
24
|
+
camelcased_class_name.pluralize
|
25
|
+
end
|
26
|
+
|
27
|
+
def file_name
|
28
|
+
underscored_pluralized_class_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscored_class_name
|
32
|
+
camelcased_class_name.underscore
|
33
|
+
end
|
34
|
+
|
35
|
+
def underscored_pluralized_class_name
|
36
|
+
underscored_class_name.pluralize
|
37
|
+
end
|
38
|
+
|
39
|
+
def item_category_class_name
|
40
|
+
item_category_class_name_arg.blank? ? "#{camelcased_class_name}Category" : item_category_class_name_arg
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Models
|
4
|
+
class AllGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :category_class_name_arg, type: :string, default: ""
|
8
|
+
argument :image_class_name_arg, type: :string, default: ""
|
9
|
+
argument :category_image_class_name_arg, type: :string, default: ""
|
10
|
+
|
11
|
+
desc 'Enjoy::Catalog Models generator'
|
12
|
+
def all
|
13
|
+
generate "enjoy:catalog:models:item #{camelcased_class_name}"
|
14
|
+
generate "enjoy:catalog:models:item_category #{category_class_name}"
|
15
|
+
generate "enjoy:catalog:models:item_image #{image_class_name}"
|
16
|
+
generate "enjoy:catalog:models:item_category_image #{category_image_class_name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def capitalized_class_name
|
21
|
+
class_name.capitalize
|
22
|
+
end
|
23
|
+
def camelcased_class_name
|
24
|
+
class_name.camelcase
|
25
|
+
end
|
26
|
+
|
27
|
+
def category_class_name
|
28
|
+
category_class_name_arg.blank? ? "#{camelcased_class_name}Category" : category_class_name_arg
|
29
|
+
end
|
30
|
+
def image_class_name
|
31
|
+
image_class_name_arg.blank? ? "#{camelcased_class_name}Image" : image_class_name_arg
|
32
|
+
end
|
33
|
+
def category_image_class_name
|
34
|
+
category_image_class_name_arg.blank? ? "#{camelcased_class_name}CategoryImage" : category_image_class_name_arg
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Models
|
4
|
+
class ItemCategoryGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :item_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog ItemCategory Model generator'
|
10
|
+
def item_category
|
11
|
+
template 'item_category.erb', "app/models/#{file_name}.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def capitalized_class_name
|
16
|
+
class_name.capitalize
|
17
|
+
end
|
18
|
+
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def file_name
|
24
|
+
underscored_class_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def underscored_class_name
|
28
|
+
camelcased_class_name.underscore
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscored_pluralized_class_name
|
32
|
+
underscored_class_name.pluralize
|
33
|
+
end
|
34
|
+
|
35
|
+
def item_class_name
|
36
|
+
item_class_name_arg.blank? ? camelcased_class_name.sub(/Category$/, "") : item_class_name_arg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Models
|
4
|
+
class ItemCategoryImageGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :item_category_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog ItemCategoryImage Model generator'
|
10
|
+
def item_category_image
|
11
|
+
template 'item_category_image.erb', "app/models/#{file_name}.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def capitalized_class_name
|
16
|
+
class_name.capitalize
|
17
|
+
end
|
18
|
+
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def file_name
|
24
|
+
underscored_class_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def underscored_class_name
|
28
|
+
camelcased_class_name.underscore
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscored_pluralized_class_name
|
32
|
+
underscored_class_name.pluralize
|
33
|
+
end
|
34
|
+
|
35
|
+
def item_category_class_name
|
36
|
+
item_category_class_name_arg.blank? ? camelcased_class_name.sub(/Image$/, "") : item_category_class_name_arg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Models
|
4
|
+
class ItemGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
|
8
|
+
desc 'Enjoy::Catalog Item Model generator'
|
9
|
+
def item
|
10
|
+
template 'item.erb', "app/models/#{file_name}.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def capitalized_class_name
|
15
|
+
class_name.capitalize
|
16
|
+
end
|
17
|
+
|
18
|
+
def camelcased_class_name
|
19
|
+
class_name.camelcase
|
20
|
+
end
|
21
|
+
|
22
|
+
def file_name
|
23
|
+
underscored_class_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def underscored_class_name
|
27
|
+
camelcased_class_name.underscore
|
28
|
+
end
|
29
|
+
|
30
|
+
def underscored_pluralized_class_name
|
31
|
+
underscored_class_name.pluralize
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Enjoy::Catalog::Models
|
4
|
+
class ItemImageGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
argument :class_name, type: :string
|
7
|
+
argument :item_class_name_arg, type: :string, default: ""
|
8
|
+
|
9
|
+
desc 'Enjoy::Catalog ItemImage Model generator'
|
10
|
+
def item_image
|
11
|
+
template 'item_image.erb', "app/models/#{file_name}.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def capitalized_class_name
|
16
|
+
class_name.capitalize
|
17
|
+
end
|
18
|
+
|
19
|
+
def camelcased_class_name
|
20
|
+
class_name.camelcase
|
21
|
+
end
|
22
|
+
|
23
|
+
def file_name
|
24
|
+
underscored_class_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def underscored_class_name
|
28
|
+
camelcased_class_name.underscore
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscored_pluralized_class_name
|
32
|
+
underscored_class_name.pluralize
|
33
|
+
end
|
34
|
+
|
35
|
+
def item_class_name
|
36
|
+
item_class_name_arg.blank? ? camelcased_class_name.sub(/Image$/, "") : item_class_name_arg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class <%= camelcased_class_name %> < Enjoy::Catalog::Item
|
2
|
+
|
3
|
+
has_and_belongs_to_many :item_categories, class_name: "<%= camelcased_class_name %>Category", inverse_of: nil
|
4
|
+
alias :<%= underscored_class_name %>_categories :item_categories
|
5
|
+
|
6
|
+
embeds_many :item_images, cascade_callbacks: true, class_name: "<%= camelcased_class_name %>Image"
|
7
|
+
alias :<%= underscored_class_name %>_images :item_images
|
8
|
+
|
9
|
+
has_and_belongs_to_many :related_items, :class_name => "<%= camelcased_class_name %>", :inverse_of => :related_items
|
10
|
+
alias :related_<%= underscored_pluralized_class_name %> :related_items
|
11
|
+
|
12
|
+
def image_styles
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
|
16
|
+
def image_jcrop_options
|
17
|
+
{}
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
############# rails_admin ##############
|
22
|
+
def self.rails_admin_add_fields
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.rails_admin_add_config(config)
|
27
|
+
end
|
28
|
+
|
29
|
+
rails_admin(&Enjoy::Catalog::Admin::Item.config(rails_admin_add_fields) { |config|
|
30
|
+
rails_admin_add_config(config)
|
31
|
+
})
|
32
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class <%= camelcased_class_name %> < Enjoy::Catalog::ItemCategory
|
2
|
+
|
3
|
+
embeds_many :item_category_images, cascade_callbacks: true, class_name: "<%= camelcased_class_name %>Image"
|
4
|
+
alias :<%= underscored_class_name %>_images :item_category_images
|
5
|
+
|
6
|
+
def image_styles
|
7
|
+
{}
|
8
|
+
end
|
9
|
+
|
10
|
+
def image_jcrop_options
|
11
|
+
{}
|
12
|
+
end
|
13
|
+
|
14
|
+
def item_class
|
15
|
+
<%= item_class_name %>
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
############# rails_admin ##############
|
20
|
+
def self.rails_admin_add_fields
|
21
|
+
{}
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.rails_admin_add_config(config)
|
25
|
+
end
|
26
|
+
|
27
|
+
rails_admin(&Enjoy::Catalog::Admin::ItemCategory.config(rails_admin_add_fields) { |config|
|
28
|
+
rails_admin_add_config(config)
|
29
|
+
})
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class <%= camelcased_class_name %> < Enjoy::Catalog::ItemCategoryImage
|
2
|
+
embedded_in :item_category, class_name: "<%= item_category_class_name %>"
|
3
|
+
alias :<%= underscored_class_name %>_category :item_category
|
4
|
+
|
5
|
+
def self.find(id)
|
6
|
+
find_through(<%= item_category_class_name %>, 'item_category_images', id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def image_styles
|
10
|
+
{}
|
11
|
+
end
|
12
|
+
|
13
|
+
def image_jcrop_options
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
############# rails_admin ##############
|
19
|
+
def self.rails_admin_add_fields
|
20
|
+
{}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.rails_admin_add_config(config)
|
24
|
+
end
|
25
|
+
|
26
|
+
rails_admin(&Enjoy::Catalog::Admin::ItemCategoryImage.config(rails_admin_add_fields) { |config|
|
27
|
+
rails_admin_add_config(config)
|
28
|
+
})
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class <%= camelcased_class_name %> < Enjoy::Catalog::ItemImage
|
2
|
+
embedded_in :item, class_name: "<%= item_class_name %>"
|
3
|
+
alias :<%= underscored_class_name %> :item
|
4
|
+
|
5
|
+
def self.find(id)
|
6
|
+
find_through(<%= item_class_name %>, 'item_images', id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def image_styles
|
10
|
+
{}
|
11
|
+
end
|
12
|
+
|
13
|
+
def image_jcrop_options
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
############# rails_admin ##############
|
19
|
+
def self.rails_admin_add_fields
|
20
|
+
{}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.rails_admin_add_config(config)
|
24
|
+
end
|
25
|
+
|
26
|
+
rails_admin(&Enjoy::Catalog::Admin::ItemImage.config(rails_admin_add_fields) { |config|
|
27
|
+
rails_admin_add_config(config)
|
28
|
+
})
|
29
|
+
|
30
|
+
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.3.
|
4
|
+
version: 0.3.3
|
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-03-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.
|
75
|
+
version: 0.3.3
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.3.
|
82
|
+
version: 0.3.3
|
83
83
|
description: Items catalog with EnjoyCMS support.
|
84
84
|
email:
|
85
85
|
- dev@enjoycreate.ru
|
@@ -136,6 +136,23 @@ files:
|
|
136
136
|
- lib/enjoy/catalog/models/mongoid/item_image.rb
|
137
137
|
- lib/enjoy/catalog/version.rb
|
138
138
|
- lib/enjoy_cms_catalog.rb
|
139
|
+
- lib/generators/enjoy/catalog/all_generator.rb
|
140
|
+
- lib/generators/enjoy/catalog/config/install_generator.rb
|
141
|
+
- lib/generators/enjoy/catalog/config/templates/enjoy_catalog.erb
|
142
|
+
- lib/generators/enjoy/catalog/controllers/all_generator.rb
|
143
|
+
- lib/generators/enjoy/catalog/controllers/item_category_generator.rb
|
144
|
+
- lib/generators/enjoy/catalog/controllers/item_generator.rb
|
145
|
+
- lib/generators/enjoy/catalog/controllers/templates/item_categories_controller.erb
|
146
|
+
- lib/generators/enjoy/catalog/controllers/templates/items_controller.erb
|
147
|
+
- lib/generators/enjoy/catalog/models/all_generator.rb
|
148
|
+
- lib/generators/enjoy/catalog/models/item_category_generator.rb
|
149
|
+
- lib/generators/enjoy/catalog/models/item_category_image_generator.rb
|
150
|
+
- lib/generators/enjoy/catalog/models/item_generator.rb
|
151
|
+
- lib/generators/enjoy/catalog/models/item_image_generator.rb
|
152
|
+
- lib/generators/enjoy/catalog/models/templates/item.erb
|
153
|
+
- lib/generators/enjoy/catalog/models/templates/item_category.erb
|
154
|
+
- lib/generators/enjoy/catalog/models/templates/item_category_image.erb
|
155
|
+
- lib/generators/enjoy/catalog/models/templates/item_image.erb
|
139
156
|
- release.sh
|
140
157
|
homepage: https://github.com/enjoycreative/enjoy_cms_catalog
|
141
158
|
licenses:
|