enjoy_cms_catalog 0.3.7 → 0.4.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/app/{models/concerns/enjoy/catalog/decorators/item_category.rb → controllers/concerns/enjoy/catalog/decorators/categories.rb} +1 -1
- data/app/controllers/enjoy/catalog/categories_controller.rb +7 -0
- data/app/{controllers/concerns/enjoy/catalog/decorators/item_categories.rb → models/concerns/enjoy/catalog/decorators/category.rb} +1 -1
- data/app/models/concerns/enjoy/catalog/decorators/{item_category_image.rb → category_image.rb} +1 -1
- data/app/models/enjoy/catalog/category.rb +12 -0
- data/app/models/enjoy/catalog/category_image.rb +16 -0
- data/app/models/enjoy/catalog/item_image.rb +12 -7
- data/app/views/enjoy/catalog/{item_categories → categories}/index.html.slim +4 -1
- data/app/views/enjoy/catalog/{item_categories → categories}/show.html.slim +9 -6
- data/app/views/enjoy/catalog/items/index.html.slim +4 -2
- data/app/views/enjoy/catalog/items/show.html.slim +3 -0
- data/config/initializers/enjoy_catalog.rb +88 -0
- data/config/locales/enjoy.catalog.ru.yml +11 -4
- data/config/locales/ru.kaminari.yml +17 -0
- data/enjoy_cms_catalog.gemspec +3 -3
- data/lib/enjoy/catalog/admin/{item_category.rb → category.rb} +22 -10
- data/lib/enjoy/catalog/admin/category_image.rb +31 -0
- data/lib/enjoy/catalog/admin/item.rb +16 -7
- data/lib/enjoy/catalog/admin/item_image.rb +28 -12
- data/lib/enjoy/catalog/admin.rb +0 -2
- data/lib/enjoy/catalog/configuration.rb +46 -26
- data/lib/enjoy/catalog/controllers/{item_categories.rb → categories.rb} +32 -21
- data/lib/enjoy/catalog/controllers/items.rb +25 -36
- data/lib/enjoy/catalog/models/category.rb +50 -0
- data/lib/enjoy/catalog/models/category_image.rb +22 -0
- data/lib/enjoy/catalog/models/item.rb +27 -4
- data/lib/enjoy/catalog/models/item_image.rb +8 -0
- data/lib/enjoy/catalog/models/mongoid/category.rb +32 -0
- data/lib/enjoy/catalog/models/mongoid/category_image.rb +20 -0
- data/lib/enjoy/catalog/models/mongoid/item.rb +5 -24
- data/lib/enjoy/catalog/models/mongoid/item_image.rb +0 -10
- data/lib/enjoy/catalog/routes.rb +57 -13
- data/lib/enjoy/catalog/version.rb +1 -1
- data/lib/enjoy_cms_catalog.rb +55 -48
- data/lib/generators/enjoy/catalog/all_generator.rb +2 -2
- data/lib/generators/enjoy/catalog/config/install_generator.rb +3 -3
- data/lib/generators/enjoy/catalog/config/templates/enjoy_catalog.erb +3 -3
- data/lib/generators/enjoy/catalog/controllers/all_generator.rb +1 -1
- data/lib/generators/enjoy/catalog/controllers/{item_category_generator.rb → category_generator.rb} +4 -4
- data/lib/generators/enjoy/catalog/controllers/item_generator.rb +3 -3
- data/lib/generators/enjoy/catalog/controllers/templates/{item_categories_controller.erb → categories_controller.erb} +2 -2
- data/lib/generators/enjoy/catalog/controllers/templates/items_controller.erb +2 -2
- data/lib/generators/enjoy/catalog/models/all_generator.rb +2 -2
- data/lib/generators/enjoy/catalog/models/{item_category_generator.rb → category_generator.rb} +9 -5
- data/lib/generators/enjoy/catalog/models/{item_category_image_generator.rb → category_image_generator.rb} +11 -7
- data/lib/generators/enjoy/catalog/models/item_image_generator.rb +5 -1
- data/lib/generators/enjoy/catalog/models/templates/category.erb +34 -0
- data/lib/generators/enjoy/catalog/models/templates/category_image.erb +30 -0
- data/lib/generators/enjoy/catalog/models/templates/item.erb +4 -3
- data/lib/generators/enjoy/catalog/models/templates/item_image.erb +3 -3
- metadata +37 -36
- data/app/controllers/enjoy/catalog/item_categories_controller.rb +0 -7
- data/app/models/enjoy/catalog/item_category.rb +0 -11
- data/app/models/enjoy/catalog/item_category_image.rb +0 -11
- data/config/initializers/rails_admin.rb +0 -8
- data/lib/enjoy/catalog/admin/item_category_image.rb +0 -15
- data/lib/enjoy/catalog/models/item_category.rb +0 -27
- data/lib/enjoy/catalog/models/item_category_image.rb +0 -14
- data/lib/enjoy/catalog/models/mongoid/item_category.rb +0 -51
- data/lib/enjoy/catalog/models/mongoid/item_category_image.rb +0 -29
- data/lib/generators/enjoy/catalog/models/templates/item_category.erb +0 -33
- data/lib/generators/enjoy/catalog/models/templates/item_category_image.erb +0 -30
@@ -1,29 +0,0 @@
|
|
1
|
-
module Enjoy::Catalog
|
2
|
-
module Models
|
3
|
-
module Mongoid
|
4
|
-
module ItemCategoryImage
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
# include Enjoy::MongoidPaperclip
|
7
|
-
|
8
|
-
included do
|
9
|
-
embedded_in :item, class_name: "Enjoy::Catalog::ItemCategory"
|
10
|
-
end
|
11
|
-
|
12
|
-
include ::Mongoid::EmbeddedFindable
|
13
|
-
module ClassMethods
|
14
|
-
def find(id)
|
15
|
-
find_through(Enjoy::Catalog::ItemCategory, 'item_category_images', id)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def image_styles
|
20
|
-
Enjoy::Catalog.configuration.item_category_images_image_styles
|
21
|
-
end
|
22
|
-
|
23
|
-
def image_jcrop_options
|
24
|
-
{}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,33 +0,0 @@
|
|
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
|
-
def routes_namespace
|
18
|
-
:main_app # or nil
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
############# rails_admin ##############
|
23
|
-
def self.rails_admin_add_fields
|
24
|
-
{}
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.rails_admin_add_config(config)
|
28
|
-
end
|
29
|
-
|
30
|
-
rails_admin(&Enjoy::Catalog::Admin::ItemCategory.config(rails_admin_add_fields) { |config|
|
31
|
-
rails_admin_add_config(config)
|
32
|
-
})
|
33
|
-
end
|
@@ -1,30 +0,0 @@
|
|
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
|