enjoy_cms_catalog 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/enjoy_cms_catalog/enjoy_cms_catalog.coffee +0 -0
- data/app/assets/stylesheets/enjoy_cms_catalog/enjoy_cms_catalog.sass +0 -0
- data/app/controllers/enjoy/catalog/item_categories_controller.rb +5 -0
- data/app/controllers/enjoy/catalog/items_controller.rb +5 -0
- data/app/models/concerns/enjoy/catalog/decorators/item.rb +5 -0
- data/app/models/concerns/enjoy/catalog/decorators/item_category.rb +5 -0
- data/app/models/concerns/enjoy/catalog/decorators/item_category_image.rb +5 -0
- data/app/models/concerns/enjoy/catalog/decorators/item_image.rb +5 -0
- data/app/models/enjoy/catalog/item.rb +11 -0
- data/app/models/enjoy/catalog/item_category.rb +9 -0
- data/app/models/enjoy/catalog/item_category_image.rb +9 -0
- data/app/models/enjoy/catalog/item_image.rb +9 -0
- data/app/views/enjoy/catalog/item_categories/index.html.slim +29 -0
- data/app/views/enjoy/catalog/item_categories/show.html.slim +84 -0
- data/app/views/enjoy/catalog/items/index.html.slim +28 -0
- data/app/views/enjoy/catalog/items/show.html.slim +32 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config/initializers/rails_admin.rb +8 -0
- data/config/routes.rb +18 -0
- data/enjoy_cms_catalog.gemspec +42 -0
- data/lib/enjoy/catalog/admin.rb +6 -0
- data/lib/enjoy/catalog/admin/item.rb +91 -0
- data/lib/enjoy/catalog/admin/item_category.rb +141 -0
- data/lib/enjoy/catalog/admin/item_category_image.rb +15 -0
- data/lib/enjoy/catalog/admin/item_image.rb +15 -0
- data/lib/enjoy/catalog/configuration.rb +46 -0
- data/lib/enjoy/catalog/controllers/item_categories.rb +76 -0
- data/lib/enjoy/catalog/controllers/items.rb +61 -0
- data/lib/enjoy/catalog/engine.rb +7 -0
- data/lib/enjoy/catalog/models/item.rb +40 -0
- data/lib/enjoy/catalog/models/item_category.rb +49 -0
- data/lib/enjoy/catalog/models/item_category_image.rb +23 -0
- data/lib/enjoy/catalog/models/item_image.rb +23 -0
- data/lib/enjoy/catalog/models/mongoid/item.rb +41 -0
- data/lib/enjoy/catalog/models/mongoid/item_category.rb +33 -0
- data/lib/enjoy/catalog/models/mongoid/item_category_image.rb +25 -0
- data/lib/enjoy/catalog/models/mongoid/item_image.rb +26 -0
- data/lib/enjoy/catalog/version.rb +5 -0
- data/lib/enjoy_cms_catalog.rb +59 -0
- data/release.sh +7 -0
- metadata +210 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4243981635a0d70acfc976d1ab0216a82d3b4c62
|
4
|
+
data.tar.gz: a3b85a961758f78caca166f00fa75c7c39cf5ba3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6207886cba7ac460870b993f24f397885958e8ed36a02d6fafde5a94a60ec40d432d8f37c33e62822c5fe5bf23e05f736f3f53cac94d2313e57aec0425190ada
|
7
|
+
data.tar.gz: 9823c14688c6002a1a551dbb0e945333ee0775c20acc12b2aa923e2984f74c3baa25952745d0e85f42e237a1f236559d390cae3e3b5037d2a8bf49fd255ebf39
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
enjoy_cms_catalog
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.3
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Alexander Kiseliev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# EnjoyCMSCatalog
|
2
|
+
|
3
|
+
Item Catalog for [enjoy_cms](https://github.com/enjoycreative/enjoy_cms). Items, Categories, embedded image galleries.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'enjoy_cms_catalog'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install enjoy_cms_catalog
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/enjoycreative/enjoy_cms_catalog.
|
34
|
+
|
35
|
+
## TODO
|
36
|
+
|
37
|
+
* Do it more flexible.
|
38
|
+
* Documentation fixes.
|
39
|
+
* More configs (routes, paginations, views....)
|
40
|
+
* Find and fix bugs. I am sure, bugs are here.
|
41
|
+
* Add Search
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
File without changes
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Enjoy::Catalog
|
2
|
+
class ItemCategoryImage < Enjoy::EmbeddedGalleryImage
|
3
|
+
include Enjoy::Catalog::Models::ItemCategoryImage
|
4
|
+
|
5
|
+
include Enjoy::Catalog::Decorators::ItemCategoryImage
|
6
|
+
|
7
|
+
rails_admin &Enjoy::Catalog::Admin::ItemCategoryImage.config
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
= render partial: "blocks/seo_block"
|
2
|
+
|
3
|
+
.ic_content
|
4
|
+
//- @item_categories.each do |ic|
|
5
|
+
- unless @root_catalog.blank?
|
6
|
+
|
7
|
+
- @root_catalog.each do |ic|
|
8
|
+
|
9
|
+
.ic_block
|
10
|
+
|
11
|
+
= link_to enjoy_cms_catalog.item_category_path(ic), title: ic.name do
|
12
|
+
|
13
|
+
.ic_img_block
|
14
|
+
|
15
|
+
.ic_image_block
|
16
|
+
= image_tag ic.image.url(:main), alt: ic.name, title: ic.name
|
17
|
+
|
18
|
+
.ic_block_mask
|
19
|
+
.ic_block_mask-1
|
20
|
+
.ic_block_mask-2
|
21
|
+
|
22
|
+
.ic_text_block
|
23
|
+
h3.ic_title_block
|
24
|
+
= ic.name
|
25
|
+
//.ic_excerpt_block
|
26
|
+
== ic.excerpt
|
27
|
+
|
28
|
+
|
29
|
+
.cf{style="clear: both"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
= render partial: "blocks/seo_block_with_obj", locals: {obj: @item_category}
|
2
|
+
|
3
|
+
|
4
|
+
.ic_content
|
5
|
+
//- @item_categories.each do |ic|
|
6
|
+
//- root_catalog = ItemCategory.enabled.roots.sorted.all.to_a
|
7
|
+
//- unless root_catalog.blank?
|
8
|
+
|
9
|
+
//- root_catalog.each do |ic|
|
10
|
+
- label = @item_category.name
|
11
|
+
h3.icpage_title = label
|
12
|
+
|
13
|
+
- unless @item_category.content.blank?
|
14
|
+
.ic_description_block
|
15
|
+
== @item_category.content
|
16
|
+
- if @children.blank? or @items.blank?
|
17
|
+
hr
|
18
|
+
|
19
|
+
- unless @children.blank?
|
20
|
+
.icc_block
|
21
|
+
- @children.each do |icc|
|
22
|
+
|
23
|
+
.ic_block
|
24
|
+
|
25
|
+
= link_to enjoy_cms_catalog.item_category_path(icc), title: icc.name do
|
26
|
+
|
27
|
+
.ic_img_block
|
28
|
+
|
29
|
+
.ic_image_block
|
30
|
+
= image_tag icc.image.url(:main), alt: icc.name, title: icc.name
|
31
|
+
|
32
|
+
.ic_block_mask
|
33
|
+
.ic_block_mask-1
|
34
|
+
.ic_block_mask-2
|
35
|
+
|
36
|
+
.ic_text_block
|
37
|
+
h3.ic_title_block
|
38
|
+
= icc.name
|
39
|
+
//.ic_excerpt_block
|
40
|
+
== ic.excerpt
|
41
|
+
|
42
|
+
|
43
|
+
.cf{style="clear: both"}
|
44
|
+
br
|
45
|
+
- unless @items.blank?
|
46
|
+
hr
|
47
|
+
br
|
48
|
+
//- items = @item_category.items.enabled.sorted.all.to_a
|
49
|
+
- unless @items.blank?
|
50
|
+
.items_block
|
51
|
+
- @items.each do |i|
|
52
|
+
|
53
|
+
|
54
|
+
.item_block
|
55
|
+
= link_to enjoy_cms_catalog.item_path(i), title: i.name do
|
56
|
+
.i_block
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
.i_img_block
|
61
|
+
|
62
|
+
.i_image_block
|
63
|
+
= image_tag i.image.url(:main), alt: i.name, title: i.name
|
64
|
+
|
65
|
+
.i_block_mask
|
66
|
+
.i_block_mask-1
|
67
|
+
.i_block_mask-2
|
68
|
+
|
69
|
+
.i_text_block
|
70
|
+
h4.i_title_block
|
71
|
+
= i.name
|
72
|
+
/ h5.i_fullname
|
73
|
+
/ =i.full_name
|
74
|
+
hr
|
75
|
+
.i_excerpt_block
|
76
|
+
== i.excerpt
|
77
|
+
|
78
|
+
|
79
|
+
.cf{style="clear: both"}
|
80
|
+
|
81
|
+
|
82
|
+
/ - if @children.blank? and items.blank? and @item_category.content.blank?
|
83
|
+
.items_block
|
84
|
+
h3= Settings.ns('item_categories').empty_category(default: "Приносим свои извинения. Страница находится на стадии разработки.", label: "Сообщение об отсутсвии товаров в категории", kind: :text)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= render partial: "blocks/seo_block_with_obj", locals: {obj: @item}
|
2
|
+
|
3
|
+
|
4
|
+
.i_content
|
5
|
+
- unless @items.blank?
|
6
|
+
- @items.each do |i|
|
7
|
+
.item_block
|
8
|
+
= link_to enjoy_cms_catalog.item_path(i), title: i.name do
|
9
|
+
.i_block
|
10
|
+
|
11
|
+
|
12
|
+
.i_img_block
|
13
|
+
|
14
|
+
.i_image_block
|
15
|
+
= image_tag i.image.url(:main), alt: i.name, title: i.name
|
16
|
+
|
17
|
+
.i_block_mask
|
18
|
+
.i_block_mask-1
|
19
|
+
.i_block_mask-2
|
20
|
+
|
21
|
+
.i_text_block
|
22
|
+
h4.i_title_block
|
23
|
+
= i.name
|
24
|
+
/ h5.i_fullname
|
25
|
+
/ =i.full_name
|
26
|
+
hr
|
27
|
+
.i_excerpt_block
|
28
|
+
== i.excerpt
|
@@ -0,0 +1,32 @@
|
|
1
|
+
= render partial: "/blocks/seo_block_with_obj", locals: {obj: @item}
|
2
|
+
|
3
|
+
/ .item_fulltitle=@item.full_name
|
4
|
+
.item_title= @item.name
|
5
|
+
|
6
|
+
.item_photoblock
|
7
|
+
.item_image_block
|
8
|
+
= image_tag @item.image.url(:main), title: @item.name, alt: @item.name, data: {big_image_url: @item.image.url(:big)}
|
9
|
+
|
10
|
+
|
11
|
+
.item_block
|
12
|
+
= link_to enjoy_cms_catalog.item_path(@item), title: @item.name do
|
13
|
+
.i_block
|
14
|
+
|
15
|
+
|
16
|
+
.i_img_block
|
17
|
+
|
18
|
+
.i_image_block
|
19
|
+
= image_tag @item.image.url(:main), alt: @item.name, title: @item.name
|
20
|
+
|
21
|
+
.i_block_mask
|
22
|
+
.i_block_mask-1
|
23
|
+
.i_block_mask-2
|
24
|
+
|
25
|
+
.i_text_block
|
26
|
+
h4.i_title_block
|
27
|
+
= @item.name
|
28
|
+
/ h5.i_fullname
|
29
|
+
/ =@item.full_name
|
30
|
+
hr
|
31
|
+
.i_excerpt_block
|
32
|
+
== @item.excerpt
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ack_rocket_cms_catalog"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/config/routes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Enjoy::Catalog::Engine.routes.draw do
|
2
|
+
routes_config = Enjoy::Catalog.configuration.routes_config
|
3
|
+
|
4
|
+
if !routes_config or routes_config[:use_items_path]
|
5
|
+
resources :items, only: [:show] do
|
6
|
+
get '(/page/:page)', action: :index, on: :collection, as: ""
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
if !routes_config or routes_config[:use_item_categories_path]
|
11
|
+
resources :item_categories, only: [:index, :show] do
|
12
|
+
get 'items(/page/:page)', action: :items, on: :member, as: :items
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if !routes_config or routes_config[:use_catalog_path]
|
16
|
+
get 'catalog' => 'item_categories#index', as: :catalog
|
17
|
+
end
|
18
|
+
end
|