enjoy_cms_catalog 0.3.7 → 0.4.0.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/app/{models/concerns/enjoy/catalog/decorators/item_category.rb → controllers/concerns/enjoy/catalog/decorators/categories.rb} +1 -1
  4. data/app/controllers/enjoy/catalog/categories_controller.rb +7 -0
  5. data/app/{controllers/concerns/enjoy/catalog/decorators/item_categories.rb → models/concerns/enjoy/catalog/decorators/category.rb} +1 -1
  6. data/app/models/concerns/enjoy/catalog/decorators/{item_category_image.rb → category_image.rb} +1 -1
  7. data/app/models/enjoy/catalog/category.rb +12 -0
  8. data/app/models/enjoy/catalog/category_image.rb +16 -0
  9. data/app/models/enjoy/catalog/item_image.rb +12 -7
  10. data/app/views/enjoy/catalog/{item_categories → categories}/index.html.slim +4 -1
  11. data/app/views/enjoy/catalog/{item_categories → categories}/show.html.slim +9 -6
  12. data/app/views/enjoy/catalog/items/index.html.slim +4 -2
  13. data/app/views/enjoy/catalog/items/show.html.slim +3 -0
  14. data/config/initializers/enjoy_catalog.rb +88 -0
  15. data/config/locales/enjoy.catalog.ru.yml +11 -4
  16. data/config/locales/ru.kaminari.yml +17 -0
  17. data/enjoy_cms_catalog.gemspec +3 -3
  18. data/lib/enjoy/catalog/admin/{item_category.rb → category.rb} +22 -10
  19. data/lib/enjoy/catalog/admin/category_image.rb +31 -0
  20. data/lib/enjoy/catalog/admin/item.rb +16 -7
  21. data/lib/enjoy/catalog/admin/item_image.rb +28 -12
  22. data/lib/enjoy/catalog/admin.rb +0 -2
  23. data/lib/enjoy/catalog/configuration.rb +46 -26
  24. data/lib/enjoy/catalog/controllers/{item_categories.rb → categories.rb} +32 -21
  25. data/lib/enjoy/catalog/controllers/items.rb +25 -36
  26. data/lib/enjoy/catalog/models/category.rb +50 -0
  27. data/lib/enjoy/catalog/models/category_image.rb +22 -0
  28. data/lib/enjoy/catalog/models/item.rb +27 -4
  29. data/lib/enjoy/catalog/models/item_image.rb +8 -0
  30. data/lib/enjoy/catalog/models/mongoid/category.rb +32 -0
  31. data/lib/enjoy/catalog/models/mongoid/category_image.rb +20 -0
  32. data/lib/enjoy/catalog/models/mongoid/item.rb +5 -24
  33. data/lib/enjoy/catalog/models/mongoid/item_image.rb +0 -10
  34. data/lib/enjoy/catalog/routes.rb +57 -13
  35. data/lib/enjoy/catalog/version.rb +1 -1
  36. data/lib/enjoy_cms_catalog.rb +55 -48
  37. data/lib/generators/enjoy/catalog/all_generator.rb +2 -2
  38. data/lib/generators/enjoy/catalog/config/install_generator.rb +3 -3
  39. data/lib/generators/enjoy/catalog/config/templates/enjoy_catalog.erb +3 -3
  40. data/lib/generators/enjoy/catalog/controllers/all_generator.rb +1 -1
  41. data/lib/generators/enjoy/catalog/controllers/{item_category_generator.rb → category_generator.rb} +4 -4
  42. data/lib/generators/enjoy/catalog/controllers/item_generator.rb +3 -3
  43. data/lib/generators/enjoy/catalog/controllers/templates/{item_categories_controller.erb → categories_controller.erb} +2 -2
  44. data/lib/generators/enjoy/catalog/controllers/templates/items_controller.erb +2 -2
  45. data/lib/generators/enjoy/catalog/models/all_generator.rb +2 -2
  46. data/lib/generators/enjoy/catalog/models/{item_category_generator.rb → category_generator.rb} +9 -5
  47. data/lib/generators/enjoy/catalog/models/{item_category_image_generator.rb → category_image_generator.rb} +11 -7
  48. data/lib/generators/enjoy/catalog/models/item_image_generator.rb +5 -1
  49. data/lib/generators/enjoy/catalog/models/templates/category.erb +34 -0
  50. data/lib/generators/enjoy/catalog/models/templates/category_image.erb +30 -0
  51. data/lib/generators/enjoy/catalog/models/templates/item.erb +4 -3
  52. data/lib/generators/enjoy/catalog/models/templates/item_image.erb +3 -3
  53. metadata +37 -36
  54. data/app/controllers/enjoy/catalog/item_categories_controller.rb +0 -7
  55. data/app/models/enjoy/catalog/item_category.rb +0 -11
  56. data/app/models/enjoy/catalog/item_category_image.rb +0 -11
  57. data/config/initializers/rails_admin.rb +0 -8
  58. data/lib/enjoy/catalog/admin/item_category_image.rb +0 -15
  59. data/lib/enjoy/catalog/models/item_category.rb +0 -27
  60. data/lib/enjoy/catalog/models/item_category_image.rb +0 -14
  61. data/lib/enjoy/catalog/models/mongoid/item_category.rb +0 -51
  62. data/lib/enjoy/catalog/models/mongoid/item_category_image.rb +0 -29
  63. data/lib/generators/enjoy/catalog/models/templates/item_category.erb +0 -33
  64. data/lib/generators/enjoy/catalog/models/templates/item_category_image.erb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0117875d71ca0a24bdd0fcdec9fdcfe6260d3b0a
4
- data.tar.gz: a53ecb5661763f15fca3c876919ff8bff15d585e
3
+ metadata.gz: b1c6044878fd5465b1096e04747894c1d1554fea
4
+ data.tar.gz: 99d7d3cfd1af087061147fcdd9d71ad4ec51bfd3
5
5
  SHA512:
6
- metadata.gz: 7653b0246035cc8f77f78a8a1f4c09199df29151b5ccb3c6d0b61baf4ab85be54e111e2780db2698624659fa2e0937fb202750d82b07dd49650210139ff6d83e
7
- data.tar.gz: 31daed42107fbdabf5fa43ab19a6a750963aa16ef497eb6dcd168788e060de5750ffa876be866e66704bd7d0218dd8dcad582b46cb97bcbcf0999a57ece5873a
6
+ metadata.gz: 1e1c13c7266507321c90287b13cf37b2e6aab6dc42fd88e0adb6aaec5f0f4670fb515531d3f890e652f2f93bdecd0a79cc6dd78d3dbebaca6470f90ea5a5db3b
7
+ data.tar.gz: 1f8b599684ab89b2b14607ac7128bc52905dd59bd9eed87860718dbbdf26351012043cadf63af06f990dabd8b4b058d00beb8c6dcd7deed1def127076d8286d1
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.1
@@ -1,5 +1,5 @@
1
1
  module Enjoy::Catalog::Decorators
2
- module ItemCategory
2
+ module Categories
3
3
  extend ActiveSupport::Concern
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ module Enjoy::Catalog
2
+ class CategoriesController < ApplicationController
3
+ include Enjoy::Catalog::Controllers::Categories
4
+
5
+ include Enjoy::Catalog::Decorators::Categories
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Enjoy::Catalog::Decorators
2
- module ItemCategories
2
+ module Category
3
3
  extend ActiveSupport::Concern
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Enjoy::Catalog::Decorators
2
- module ItemCategoryImage
2
+ module CategoryImage
3
3
  extend ActiveSupport::Concern
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ module Enjoy::Catalog
2
+ class Category
3
+ include Enjoy::Catalog::Models::Category
4
+
5
+ include Enjoy::Catalog::Decorators::Category
6
+
7
+ rails_admin(&Enjoy::Catalog::Admin::Category.config(rails_admin_add_fields) { |config|
8
+ # puts config.bindings.keys
9
+ rails_admin_add_config(config)
10
+ })
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ if Enjoy::Catalog.config.gallery_support
2
+ module Enjoy::Catalog
3
+ _parent_class = Enjoy::Gallery::Image if Enjoy::Catalog.active_record?
4
+ _parent_class = Enjoy::Gallery::EmbeddedImage if Enjoy::Catalog.mongoid?
5
+
6
+ class CategoryImage < _parent_class
7
+ include Enjoy::Catalog::Models::CategoryImage
8
+
9
+ include Enjoy::Catalog::Decorators::CategoryImage
10
+
11
+ rails_admin(&Enjoy::Catalog::Admin::CategoryImage.config(nil, rails_admin_add_fields) { |config|
12
+ rails_admin_add_config(config)
13
+ })
14
+ end
15
+ end
16
+ end
@@ -1,11 +1,16 @@
1
- module Enjoy::Catalog
2
- class ItemImage < Enjoy::EmbeddedGalleryImage
3
- include Enjoy::Catalog::Models::ItemImage
1
+ if Enjoy::Catalog.config.gallery_support
2
+ module Enjoy::Catalog
3
+ _parent_class = Enjoy::Gallery::Image if Enjoy::Catalog.active_record?
4
+ _parent_class = Enjoy::Gallery::EmbeddedImage if Enjoy::Catalog.mongoid?
4
5
 
5
- include Enjoy::Catalog::Decorators::ItemImage
6
+ class ItemImage < _parent_class
7
+ include Enjoy::Catalog::Models::ItemImage
6
8
 
7
- rails_admin(&Enjoy::Catalog::Admin::ItemImage.config(rails_admin_add_fields) { |config|
8
- rails_admin_add_config(config)
9
- })
9
+ include Enjoy::Catalog::Decorators::ItemImage
10
+
11
+ rails_admin(&Enjoy::Catalog::Admin::ItemImage.config(nil, rails_admin_add_fields) { |config|
12
+ rails_admin_add_config(config)
13
+ })
14
+ end
10
15
  end
11
16
  end
@@ -1,7 +1,10 @@
1
+ / - if Enjoy::Catalog.config.breadcrumbs_on_rails_support
2
+ / = render partial: "blocks/breadcrumbs"
3
+
1
4
  = render partial: "blocks/seo_block"
2
5
 
3
6
  .ic_content
4
- //- @item_categories.each do |ic|
7
+ //- @categories.each do |ic|
5
8
  - unless @root_catalog.blank?
6
9
 
7
10
  - @root_catalog.each do |ic|
@@ -1,16 +1,19 @@
1
- = render partial: "blocks/seo_block_with_obj", locals: {obj: @item_category}
1
+ / - if Enjoy::Catalog.config.breadcrumbs_on_rails_support
2
+ / = render partial: "blocks/breadcrumbs"
3
+
4
+ = render partial: "blocks/seo_block_with_obj", locals: {obj: @category}
2
5
 
3
6
 
4
7
  .ic_content
5
- //- @item_categories.each do |ic|
6
- //- root_catalog = ItemCategory.enabled.roots.sorted.all.to_a
8
+ //- @categories.each do |ic|
9
+ //- root_catalog = Enjoy::Catalog::Category.enabled.roots.sorted.all.to_a
7
10
  //- unless root_catalog.blank?
8
11
 
9
12
  //- root_catalog.each do |ic|
10
- - label = @item_category.name
13
+ - label = @category.name
11
14
  h3.icpage_title = label
12
15
 
13
- - unless @item_category.content.blank?
16
+ - unless @category.content.blank?
14
17
  .ic_description_block
15
18
  == @item_category.content
16
19
  - if @children.blank? or @items.blank?
@@ -81,4 +84,4 @@
81
84
 
82
85
  / - if @children.blank? and items.blank? and @item_category.content.blank?
83
86
  .items_block
84
- h3= Settings.ns('item_categories').empty_category(default: "Приносим свои извинения. Страница находится на стадии разработки.", label: "Сообщение об отсутсвии товаров в категории", kind: :text)
87
+ h3= Settings.ns('enjoy_catalog.categories').empty_category(default: "Приносим свои извинения. Страница находится на стадии разработки.", label: "Сообщение об отсутсвии товаров в категории", kind: :text)
@@ -1,5 +1,7 @@
1
- = render partial: "blocks/seo_block_with_obj", locals: {obj: @item}
2
-
1
+ / - if Enjoy::Catalog.config.breadcrumbs_on_rails_support
2
+ / = render partial: "blocks/breadcrumbs"
3
+
4
+ = render partial: "blocks/seo_block"
3
5
 
4
6
  .i_content
5
7
  - unless @items.blank?
@@ -1,3 +1,6 @@
1
+ / - if Enjoy::Catalog.config.breadcrumbs_on_rails_support
2
+ / = render partial: "blocks/breadcrumbs"
3
+
1
4
  = render partial: "/blocks/seo_block_with_obj", locals: {obj: @item}
2
5
 
3
6
  / .item_fulltitle=@item.full_name
@@ -0,0 +1,88 @@
1
+ Enjoy.rails_admin_configure do |config|
2
+ config.action_visible_for :nested_set, 'Enjoy::Catalog::Item'
3
+ config.action_visible_for :nested_set, 'Enjoy::Catalog::Category'
4
+
5
+ if Enjoy::Catalog.active_record?
6
+ config.action_visible_for :nested_set, 'Enjoy::Catalog::ItemImage'
7
+ config.action_visible_for :nested_set, 'Enjoy::Catalog::CategoryImage'
8
+ elsif Enjoy::Catalog.mongoid?
9
+ config.action_visible_for :sort_embedded, 'Enjoy::Catalog::Item'
10
+ config.action_visible_for :sort_embedded, 'Enjoy::Catalog::Category'
11
+ end
12
+
13
+ if defined?(RailsAdminComments)
14
+ config.action_visible_for :comments, 'Enjoy::Catalog::Item'
15
+ config.action_visible_for :comments, 'Enjoy::Catalog::Category'
16
+ config.action_visible_for :model_comments, 'Enjoy::Catalog::Item'
17
+ config.action_visible_for :model_comments, 'Enjoy::Catalog::Category'
18
+ if Enjoy::Catalog.active_record?
19
+ config.action_visible_for :comments, 'Enjoy::Catalog::ItemImage'
20
+ config.action_visible_for :comments, 'Enjoy::Catalog::CategoryImage'
21
+ config.action_visible_for :model_comments, 'Enjoy::Catalog::ItemImage'
22
+ config.action_visible_for :model_comments, 'Enjoy::Catalog::CategoryImage'
23
+ end
24
+ end
25
+
26
+ if defined?(RailsAdminMultipleFileUpload)
27
+ if Enjoy::Catalog.mongoid?
28
+ config.action_visible_for :multiple_file_upload, 'Enjoy::Catalog::Item'
29
+ config.action_visible_for :multiple_file_upload, 'Enjoy::Catalog::Category'
30
+ end
31
+ end
32
+ end
33
+
34
+ Enjoy.configure do |config|
35
+ _actions = [:new, :create, :edit, :update, :nested_set, :multiple_file_upload, :sort_embedded]
36
+ if Enjoy::Catalog.active_record?
37
+ _actions.delete(:multiple_file_upload)
38
+ _actions.delete(:sort_embedded)
39
+ end
40
+
41
+ config.ability_manager_config ||= []
42
+ config.ability_manager_config << {
43
+ method: :can,
44
+ model: Enjoy::Catalog::Item,
45
+ actions: _actions
46
+ }
47
+ config.ability_manager_config << {
48
+ method: :can,
49
+ model: Enjoy::Catalog::Category,
50
+ actions: _actions
51
+ }
52
+ if Enjoy::Catalog.active_record?
53
+ config.ability_manager_config << {
54
+ method: :can,
55
+ model: Enjoy::Catalog::ItemImage,
56
+ actions: _actions
57
+ }
58
+ config.ability_manager_config << {
59
+ method: :can,
60
+ model: Enjoy::Catalog::CategoryImage,
61
+ actions: _actions
62
+ }
63
+ end
64
+
65
+ config.ability_admin_config ||= []
66
+ config.ability_admin_config << {
67
+ method: :can,
68
+ model: Enjoy::Catalog::Item,
69
+ actions: :manage
70
+ }
71
+ config.ability_admin_config << {
72
+ method: :can,
73
+ model: Enjoy::Catalog::Category,
74
+ actions: :manage
75
+ }
76
+ if Enjoy::Catalog.active_record?
77
+ config.ability_admin_config << {
78
+ method: :can,
79
+ model: Enjoy::Catalog::ItemImage,
80
+ actions: :manage
81
+ }
82
+ config.ability_admin_config << {
83
+ method: :can,
84
+ model: Enjoy::Catalog::CategoryImage,
85
+ actions: :manage
86
+ }
87
+ end
88
+ end
@@ -1,16 +1,23 @@
1
1
  ru:
2
+ enjoy:
3
+ catalog: Каталог
4
+ breadcrumbs:
5
+ catalog: Каталог
6
+ categories: Категории
7
+ items: Товары
8
+
2
9
  mongoid:
3
10
  models:
4
11
  enjoy/catalog/item: Товары
5
- enjoy/catalog/item_category: Разделы
12
+ enjoy/catalog/category: Разделы
6
13
  attributes:
7
14
  enjoy/catalog/item:
8
15
  price: Цена
9
16
  connected_pages: Страницы в меню
10
- item_categories: Разделы
17
+ categories: Разделы
11
18
  item_images: Галерея
12
19
  related_items: Похожие товары
13
- enjoy/catalog/item_category:
20
+ enjoy/catalog/category:
14
21
  connected_pages: Страницы в меню
15
22
  items: Товары
16
- item_category_images: Галерея
23
+ category_images: Галерея
@@ -0,0 +1,17 @@
1
+ ru:
2
+ views:
3
+ pagination:
4
+ first: "&laquo; Начало"
5
+ last: "Конец &raquo;"
6
+ previous: "&lsaquo; Предыдущая"
7
+ next: "Следующая &rsaquo;"
8
+ truncate: "&hellip;"
9
+ helpers:
10
+ page_entries_info:
11
+ one_page:
12
+ display_entries:
13
+ zero: "%{entry_name} не найдены"
14
+ one: "Показано <b>1</b> %{entry_name}"
15
+ other: "Показаны <b>все %{count}</b> %{entry_name}"
16
+ more_pages:
17
+ display_entries: "Показаны %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> из <b>%{total}</b>"
@@ -31,8 +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 'enjoy_cms_gallery', "~> 0.4.0.beta3"
35
+
34
36
  spec.add_dependency 'money-rails'
35
- spec.add_dependency 'mongoid_money_field'
36
-
37
- spec.add_dependency 'enjoy_cms', "~> 0.3.7"
37
+ spec.add_dependency 'mongoid_money_field', '~> 5.0.0'
38
38
  end
@@ -1,8 +1,9 @@
1
1
  module Enjoy::Catalog
2
2
  module Admin
3
- module ItemCategory
3
+ module Category
4
4
  def self.config(fields = {})
5
5
  Proc.new {
6
+ navigation_label I18n.t("enjoy.catalog")
6
7
 
7
8
  list do
8
9
  scopes [:sorted, :enabled, nil]
@@ -13,13 +14,24 @@ module Enjoy::Catalog
13
14
  field :name do
14
15
  searchable true
15
16
  end
16
- field :connected_pages, :enjoy_connectable
17
+ if Enjoy::Catalog.config.pages_support and Enjoy::Catalog.configuration.can_connect_category_with_pages
18
+ field :connected_pages, :enjoy_connectable
19
+ end
17
20
  end
18
21
 
19
22
  edit do
20
23
  field :enabled, :toggle
21
24
  field :name
22
- field :connected_pages, :enjoy_connectable
25
+ if Enjoy::Catalog.config.pages_support and Enjoy::Catalog.configuration.can_connect_category_with_pages
26
+ group :connected_pages do
27
+ active false
28
+ field :connected_pages, :enjoy_connectable do
29
+ read_only do
30
+ !bindings[:view].current_user.admin?
31
+ end
32
+ end
33
+ end
34
+ end
23
35
  group :URL do
24
36
  active false
25
37
  field :slugs, :enum do
@@ -44,7 +56,7 @@ module Enjoy::Catalog
44
56
  :image_jcrop_options
45
57
  end
46
58
  end
47
- field :item_category_images
59
+ field :category_images
48
60
  end
49
61
 
50
62
  group :content do
@@ -110,10 +122,10 @@ module Enjoy::Catalog
110
122
  read_only true
111
123
 
112
124
  pretty_value do
113
- bindings[:object].items.to_a.map { |i|
114
- route = (bindings[:view] || bindings[:controller])
115
- model_name = i.rails_admin_model
116
- route.link_to(i.name, route.rails_admin.show_path(model_name: model_name, id: i.id), title: i.name)
125
+ bindings[:object].items.to_a.map { |i|
126
+ route = (bindings[:view] || bindings[:controller])
127
+ model_name = i.rails_admin_model
128
+ route.link_to(i.name, route.rails_admin.show_path(model_name: model_name, id: i.id), title: i.name)
117
129
  }.join("<br>").html_safe
118
130
  end
119
131
  end
@@ -123,14 +135,14 @@ module Enjoy::Catalog
123
135
 
124
136
  sort_embedded(
125
137
  {
126
- fields: [:item_category_images]
138
+ fields: [:category_images]
127
139
  }
128
140
  )
129
141
 
130
142
  if defined?(RailsAdminMultipleFileUpload)
131
143
  multiple_file_upload(
132
144
  {
133
- fields: [:item_category_images]
145
+ fields: [:category_images]
134
146
  }
135
147
  )
136
148
  end
@@ -0,0 +1,31 @@
1
+ module Enjoy::Catalog
2
+ module Admin
3
+ module CategoryImage
4
+ def self.config(nav_label = nil, fields = {})
5
+ if Enjoy::Catalog.config.gallery_support
6
+ if Enjoy::Catalog.mongoid?
7
+ if block_given?
8
+ Enjoy::Gallery::Admin::EmbeddedImage.config(fields) do |config|
9
+ yield config
10
+ end
11
+ else
12
+ Enjoy::Gallery::Admin::EmbeddedImage.config(fields)
13
+ end
14
+
15
+ else
16
+ nav_label ||= I18n.t('enjoy.catalog')
17
+ if block_given?
18
+ Enjoy::Gallery::Admin::Image.config(nav_label, fields) do |config|
19
+ yield config
20
+ end
21
+ else
22
+ Enjoy::Gallery::Admin::Image.config(nav_label,fields)
23
+ end
24
+ end #if Enjoy::Catalog.mongoid?
25
+ end #if Enjoy::Catalog.config.gallery_support
26
+
27
+ end #def self.config(fields = {})
28
+
29
+ end #module CategoryImage
30
+ end #module Admin
31
+ end #module Enjoy::Catalog
@@ -3,6 +3,8 @@ module Enjoy::Catalog
3
3
  module Item
4
4
  def self.config(fields = {})
5
5
  Proc.new {
6
+ navigation_label I18n.t("enjoy.catalog")
7
+
6
8
  list do
7
9
  scopes [:sorted, :enabled, nil]
8
10
 
@@ -12,24 +14,31 @@ module Enjoy::Catalog
12
14
  field :name do
13
15
  searchable true
14
16
  end
15
- field :item_categories do
17
+ field :categories do
16
18
  searchable :name
17
19
  end
18
- field :connected_pages, :enjoy_connectable
20
+ if Enjoy::Catalog.config.pages_support and Enjoy::Catalog.configuration.can_connect_items_with_pages
21
+ field :connected_pages, :enjoy_connectable
22
+ end
19
23
  end
20
24
 
21
25
  edit do
22
26
  field :enabled, :toggle
23
27
  field :name
24
- field :connected_pages, :enjoy_connectable do
25
- read_only do
26
- !bindings[:view].current_user.admin?
28
+ if Enjoy::Catalog.config.pages_support and Enjoy::Catalog.configuration.can_connect_items_with_pages
29
+ group :connected_pages do
30
+ active false
31
+ field :connected_pages, :enjoy_connectable do
32
+ read_only do
33
+ !bindings[:view].current_user.admin?
34
+ end
35
+ end
27
36
  end
28
37
  end
29
- field :item_categories do
38
+ field :categories do
30
39
  searchable :name
31
40
  end
32
- field :price
41
+ field :price, :string
33
42
 
34
43
  group :URL do
35
44
  active false
@@ -1,15 +1,31 @@
1
1
  module Enjoy::Catalog
2
2
  module Admin
3
3
  module ItemImage
4
- def self.config(fields = {})
5
- if block_given?
6
- Enjoy::Admin::EmbeddedGalleryImage.config(fields) do |config|
7
- yield config
8
- end
9
- else
10
- Enjoy::Admin::EmbeddedGalleryImage.config(fields)
11
- end
12
- end
13
- end
14
- end
15
- end
4
+ def self.config(nav_label = nil, fields = {})
5
+ if Enjoy::Catalog.config.gallery_support
6
+ if Enjoy::Catalog.mongoid?
7
+ if block_given?
8
+ Enjoy::Gallery::Admin::EmbeddedImage.config(fields) do |config|
9
+ yield config
10
+ end
11
+ else
12
+ Enjoy::Gallery::Admin::EmbeddedImage.config(fields)
13
+ end
14
+
15
+ else
16
+ nav_label ||= I18n.t('enjoy.catalog')
17
+ if block_given?
18
+ Enjoy::Gallery::Admin::Image.config(nav_label, fields) do |config|
19
+ yield config
20
+ end
21
+ else
22
+ Enjoy::Gallery::Admin::Image.config(nav_label, fields)
23
+ end
24
+ end #if Enjoy::Catalog.mongoid?
25
+ end #if Enjoy::Catalog.config.gallery_support
26
+
27
+ end #def self.config(fields = {})
28
+
29
+ end #module ItemImage
30
+ end #module Admin
31
+ end #module Enjoy::Catalog
@@ -1,6 +1,4 @@
1
1
  module Enjoy::Catalog
2
2
  module Admin
3
- class << self
4
- end
5
3
  end
6
4
  end
@@ -1,38 +1,58 @@
1
- module Enjoy
2
- module Catalog
3
- def self.configuration
4
- @configuration ||= Configuration.new
5
- end
6
- def self.config
7
- @configuration ||= Configuration.new
8
- end
1
+ module Enjoy::Catalog
2
+ def self.configuration
3
+ @configuration ||= Configuration.new
4
+ end
5
+ def self.config
6
+ @configuration ||= Configuration.new
7
+ end
9
8
 
10
- def self.configure
11
- yield configuration
12
- end
9
+ def self.configure
10
+ yield configuration
11
+ end
12
+
13
+ class Configuration
14
+ attr_accessor :item_image_styles
15
+ attr_accessor :item_per_page
16
+
17
+ attr_accessor :item_images_image_styles
18
+
19
+ attr_accessor :category_image_styles
20
+ attr_accessor :category_per_page
21
+
22
+ attr_accessor :category_images_image_styles
23
+
24
+ attr_accessor :gallery_support
25
+ attr_accessor :seo_support
26
+ attr_accessor :pages_support
27
+
28
+ attr_accessor :breadcrumbs_on_rails_support
29
+
30
+ attr_accessor :can_connect_items_with_pages
31
+ attr_accessor :can_connect_category_with_pages
32
+
33
+ attr_accessor :localize
13
34
 
14
- class Configuration
15
- attr_accessor :item_image_styles
16
- attr_accessor :item_per_page
35
+ def initialize
36
+ @item_image_styles = {}
37
+ @item_per_page = 10
17
38
 
18
- attr_accessor :item_images_image_styles
39
+ @item_images_image_styles = {}
19
40
 
20
- attr_accessor :item_category_image_styles
21
- attr_accessor :item_category_per_page
41
+ @category_image_styles = {}
42
+ @category_per_page = 10
22
43
 
23
- attr_accessor :item_category_images_image_styles
44
+ @category_images_image_styles = {}
24
45
 
25
- def initialize
26
- @item_image_styles = {}
27
- @item_per_page = 10
46
+ @gallery_support = defined?(Enjoy::Gallery)
47
+ @seo_support = defined?(Enjoy::Seo)
48
+ @pages_support = defined?(Enjoy::Pages)
28
49
 
29
- @item_images_image_styles = {}
50
+ @breadcrumbs_on_rails_support = defined?(BreadcrumbsOnRails)
30
51
 
31
- @item_category_image_styles = {}
32
- @item_category_per_page = 10
52
+ @can_connect_items_with_pages = true
53
+ @can_connect_category_with_pages = true
33
54
 
34
- @item_category_images_image_styles = {}
35
- end
55
+ @localize = Enjoy.config.localize
36
56
  end
37
57
  end
38
58
  end