enjoy_cms_pages 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 (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +40 -0
  9. data/Rakefile +1 -0
  10. data/app/assets/javascripts/enjoy/pages/init.coffee +2 -0
  11. data/app/assets/javascripts/enjoy/pages/scrolling.coffee +55 -0
  12. data/app/assets/javascripts/enjoy/pages.coffee +6 -0
  13. data/app/controllers/concerns/enjoy/pages/blocksetable.rb +81 -0
  14. data/app/controllers/concerns/enjoy/pages/decorators/pages_controller.rb +5 -0
  15. data/app/controllers/concerns/enjoy/pages/nav_menu.rb +91 -0
  16. data/app/controllers/concerns/enjoy/pages/seo_pages.rb +90 -0
  17. data/app/controllers/enjoy/pages/pages_controller.rb +7 -0
  18. data/app/helpers/enjoy/pages/canonical_helper.rb +13 -0
  19. data/app/helpers/enjoy/pages/pages_helpers.rb +2 -0
  20. data/app/models/concerns/enjoy/pages/canonicalable.rb +22 -0
  21. data/app/models/concerns/enjoy/pages/connectable.rb +36 -0
  22. data/app/models/concerns/enjoy/pages/decorators/block.rb +5 -0
  23. data/app/models/concerns/enjoy/pages/decorators/blockset.rb +5 -0
  24. data/app/models/concerns/enjoy/pages/decorators/menu.rb +5 -0
  25. data/app/models/concerns/enjoy/pages/decorators/page.rb +5 -0
  26. data/app/models/enjoy/pages/block.rb +13 -0
  27. data/app/models/enjoy/pages/blockset.rb +13 -0
  28. data/app/models/enjoy/pages/menu.rb +16 -0
  29. data/app/models/enjoy/pages/page.rb +16 -0
  30. data/app/views/enjoy/pages/pages/show.html.slim +1 -0
  31. data/app/views/rails_admin/main/_enjoy_connectable.html.slim +56 -0
  32. data/bin/console +14 -0
  33. data/bin/setup +7 -0
  34. data/config/initializers/enjoy_pages.rb +85 -0
  35. data/config/locales/ru.enjoy.pages.yml +44 -0
  36. data/enjoy_cms_pages.gemspec +36 -0
  37. data/lib/enjoy/pages/admin/block.rb +67 -0
  38. data/lib/enjoy/pages/admin/blockset.rb +53 -0
  39. data/lib/enjoy/pages/admin/menu.rb +27 -0
  40. data/lib/enjoy/pages/admin/page.rb +98 -0
  41. data/lib/enjoy/pages/admin.rb +4 -0
  42. data/lib/enjoy/pages/configuration.rb +32 -0
  43. data/lib/enjoy/pages/controllers/pages.rb +26 -0
  44. data/lib/enjoy/pages/engine.rb +5 -0
  45. data/lib/enjoy/pages/models/active_record/block.rb +16 -0
  46. data/lib/enjoy/pages/models/active_record/blockset.rb +19 -0
  47. data/lib/enjoy/pages/models/active_record/menu.rb +20 -0
  48. data/lib/enjoy/pages/models/active_record/page.rb +22 -0
  49. data/lib/enjoy/pages/models/block.rb +89 -0
  50. data/lib/enjoy/pages/models/blockset.rb +17 -0
  51. data/lib/enjoy/pages/models/menu.rb +23 -0
  52. data/lib/enjoy/pages/models/mongoid/block.rb +32 -0
  53. data/lib/enjoy/pages/models/mongoid/blockset.rb +16 -0
  54. data/lib/enjoy/pages/models/mongoid/menu.rb +16 -0
  55. data/lib/enjoy/pages/models/mongoid/page.rb +43 -0
  56. data/lib/enjoy/pages/models/page.rb +106 -0
  57. data/lib/enjoy/pages/rails_admin_ext/enjoy_connectable.rb +33 -0
  58. data/lib/enjoy/pages/rails_admin_ext/menu.rb +147 -0
  59. data/lib/enjoy/pages/routes.rb +46 -0
  60. data/lib/enjoy/pages/version.rb +5 -0
  61. data/lib/enjoy_cms_pages.rb +70 -0
  62. data/lib/generators/enjoy/pages/migration_generator.rb +18 -0
  63. data/lib/generators/enjoy/pages/templates/migration_blocks.rb +42 -0
  64. data/lib/generators/enjoy/pages/templates/migration_pages.rb +48 -0
  65. data/release.sh +7 -0
  66. metadata +164 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c30ae742f626fdcc649fc07499b27d09f201bada
4
+ data.tar.gz: ff2cbc54810ff1ad186158ae2a5e2c1675e9cfff
5
+ SHA512:
6
+ metadata.gz: 99a0a69bb49147c94899f0a3a262a6d81ca656e0a9fd7ca50f02d959d351cf7622dc452817cab6bb367f0f29a3174e7b9f73b42206f7b2efd7e79f1826bbebfc
7
+ data.tar.gz: 6962d982df0dacadbb4cdfbb01e182ca41727e853bded0f4a49d43c9363b0154f38f82e27a4727ee945d63bfd66aa5215b846e2c25303b3b68cb99a4617a759e
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ enjoy_cms_pages
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in enjoy_pages.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 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,40 @@
1
+ # EnjoyCmsPages
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/enjoy_pages`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'enjoy_cms_pages'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install enjoy_cms_pages
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/enjoy_cms_pages.
36
+
37
+
38
+ ## License
39
+
40
+ 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"
@@ -0,0 +1,2 @@
1
+ window.enjoy_cms ||= {}
2
+ window.enjoy_cms.pages ||= {}
@@ -0,0 +1,55 @@
1
+ window.enjoy_cms.pages.scrolling_menu_for = ( menu_selector = "#main_menu",
2
+ menu_item_selector = "#main_menu a",
3
+ header_height = 100,
4
+ px_per_ms = 4,
5
+ set_block_to_center = true,
6
+ time_for_animate = 1000)->
7
+ $(window).scroll ->
8
+ y = $(this).scrollTop()
9
+ $(menu_item_selector).each (event) ->
10
+ _target = $($(this).attr('href'))
11
+ if set_block_to_center
12
+ _target_position = _target.offset().top - ($(window).height() / 2)
13
+ else
14
+ _target_position = _target.offset().top
15
+
16
+ _target_position = 0 if _target_position < 0
17
+ if _target.length > 0 and y >= _target_position - header_height
18
+ $(menu_item_selector).not(this).removeClass 'active'
19
+ $(this).addClass 'active'
20
+
21
+
22
+ $(document).delegate menu_item_selector, 'click', (e)->
23
+ e.preventDefault()
24
+ _menu = $(e.currentTarget)
25
+ window.history.pushState({}, (document.title = _menu.data('history-title')), e.currentTarget.href)
26
+
27
+ if location.pathname.replace(/^\//, '') == @pathname.replace(/^\//, '') and location.hostname == @hostname
28
+ target = $(@hash)
29
+ target = if target.length then target else $('[name=' + @hash.slice(1) + ']')
30
+ target = if target.length then target else $(_menu.data('pageblock-selector'))
31
+
32
+ if target.length > 0
33
+ if px_per_ms and px_per_ms > 0
34
+ if set_block_to_center
35
+ target_top = target.offset().top - ($(window).height() / 2) + header_height
36
+ else
37
+ target_top = target.offset().top + header_height
38
+
39
+ current_top = window.scrollY
40
+ animate_length = Math.abs(target_top - current_top)
41
+ time_for_animate = animate_length / px_per_ms
42
+
43
+ $('html,body').animate { scrollTop: target_top }, time_for_animate
44
+ return false
45
+
46
+
47
+
48
+ load = ->
49
+ if window.location.hash
50
+ $(menu_item_selector).filter("[href='" + window.location.hash + "']").click()
51
+
52
+ $(window).load ->
53
+ load()
54
+ $(document).bind "page:load", ->
55
+ load()
@@ -0,0 +1,6 @@
1
+ #= require ./pages/init
2
+ #= require ./pages/form
3
+
4
+ #= require_self
5
+
6
+ window.enjoy_cms.pages.scrolling_menu_for()
@@ -0,0 +1,81 @@
1
+ module Enjoy::Pages::Blocksetable
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ helper_method :render_blockset
5
+ helper_method :blockset_navigation
6
+ end
7
+
8
+ private
9
+ def blockset_navigation(type)
10
+ Proc.new do |primary|
11
+ SimpleNavigation.config.autogenerate_item_ids = false
12
+ begin
13
+ blockset_nav_extra_data_before(type, primary)
14
+ all_items = blockset_nav_get_menu_items(type)
15
+ items = all_items#.select { |i| i.parent_id.nil? && !i.name.blank? && i.enabled }
16
+ items.each do |item|
17
+ # render_with_subs(all_items, primary, item)
18
+ blockset_navigation_item(primary, item)
19
+ end
20
+ blockset_nav_extra_data_after(type, primary)
21
+ rescue Exception => exception
22
+ Rails.logger.error exception.message
23
+ Rails.logger.error exception.backtrace.join("\n")
24
+ puts exception.message
25
+ puts exception.backtrace.join("\n")
26
+ capture_exception(exception) if respond_to?(:capture_exception)
27
+ items || []
28
+ end
29
+ end
30
+ end
31
+
32
+ def render_blockset(view, type)
33
+ ret = []
34
+ begin
35
+ blocks = blockset_get_blocks(type)
36
+ blocks.each do |block|
37
+ ret << block.render_or_content_html(view)
38
+ end
39
+ rescue Exception => exception
40
+ Rails.logger.error exception.message
41
+ Rails.logger.error exception.backtrace.join("\n")
42
+ puts exception.message
43
+ puts exception.backtrace.join("\n")
44
+ capture_exception(exception) if respond_to?(:capture_exception)
45
+ # ret << blocks || []
46
+ end
47
+ ret.join.html_safe
48
+ end
49
+
50
+ def blockset_get_blocks(type)
51
+ blockset = blockset_class.find(type.to_s)
52
+ blockset.blocks.enabled.show_in_menu.sorted.to_a if blockset
53
+ end
54
+
55
+ def blockset_class_name
56
+ "Enjoy::Pages::Blockset"
57
+ end
58
+ def blockset_class
59
+ blockset_class_name.constantize
60
+ end
61
+
62
+ def blockset_navigation_item(primary, item, block=nil)
63
+ url = item.pageblock_selector.blank? ? item.slug : item.pageblock_selector #"javascript:;"
64
+ content = item.menu_link_content.blank? ? item.name : item.menu_link_content.html_safe
65
+ if block.nil?
66
+ primary.item(item.slug, content, url, item.nav_options)
67
+ else
68
+ primary.item(item.slug, content, url, item.nav_options, &block)
69
+ end
70
+ end
71
+
72
+ def blockset_nav_get_menu_items(type)
73
+ blockset_get_blocks(type)
74
+ end
75
+ def blockset_nav_extra_data_before(type, primary)
76
+ # override for additional config or items
77
+ end
78
+ def blockset_nav_extra_data_after(type, primary)
79
+ # override for additional config or items
80
+ end
81
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Pages::Decorators
2
+ module PagesController
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,91 @@
1
+ module Enjoy::Pages::NavMenu
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ helper_method :navigation
5
+ end
6
+
7
+ private
8
+ def render_with_subs(items, primary, item)
9
+ subs = items.select { |i| i.parent_id == item.id && !i.name.blank? && i.enabled }
10
+ if subs.empty?
11
+ block = nil
12
+ else
13
+ block = Proc.new do |sub_nav|
14
+ subs.each { |sub|
15
+ render_with_subs(items, sub_nav, sub)
16
+ }
17
+ end
18
+ end
19
+ # cr = item.clean_regexp
20
+ navigation_item(primary, item, block)
21
+ end
22
+
23
+ def navigation_item(primary, item, block=nil)
24
+ url = nav_get_url(item)
25
+ if block.nil?
26
+ primary.item(item.slug, item.name, url, item.nav_options)
27
+ else
28
+ primary.item(item.slug, item.name, url, item.nav_options, &block)
29
+ end
30
+ end
31
+
32
+ def navigation(type)
33
+ Proc.new do |primary|
34
+ SimpleNavigation.config.autogenerate_item_ids = false
35
+ begin
36
+ nav_extra_data_before(type, primary)
37
+ all_items = nav_get_menu_items(type)
38
+ items = all_items.select { |i| i.parent_id.nil? && !i.name.blank? && i.enabled }
39
+ items.each do |item|
40
+ render_with_subs(all_items, primary, item)
41
+ end
42
+ nav_extra_data_after(type, primary)
43
+ rescue Exception => exception
44
+ Rails.logger.error exception.message
45
+ Rails.logger.error exception.backtrace.join("\n")
46
+ puts exception.message
47
+ puts exception.backtrace.join("\n")
48
+ capture_exception(exception) if respond_to?(:capture_exception)
49
+ items || []
50
+ end
51
+ end
52
+ end
53
+
54
+ def nav_get_url(item)
55
+ _connectable = item.connectable
56
+ if _connectable and _connectable.enabled
57
+ begin
58
+ _routes_namespace = _connectable.respond_to?(:routes_namespace) ? _connectable.routes_namespace : :main_app
59
+ _url = send(_routes_namespace.to_sym).url_for([_connectable, {only_path: true}])
60
+ _url
61
+ rescue Exception => exception
62
+ Rails.logger.error exception.message
63
+ Rails.logger.error exception.backtrace.join("\n")
64
+ puts exception.message
65
+ puts exception.backtrace.join("\n")
66
+ capture_exception(exception) if respond_to?(:capture_exception)
67
+
68
+ item.redirect.blank? ? item.fullpath : item.redirect
69
+ end
70
+ else
71
+ item.redirect.blank? ? item.fullpath : item.redirect
72
+ end
73
+ end
74
+ def nav_get_menu_items(type)
75
+ menu = menu_class.find(type.to_s)
76
+ menu.pages.enabled.sorted.to_a if menu
77
+ end
78
+ def nav_extra_data_before(type, primary)
79
+ # override for additional config or items
80
+ end
81
+ def nav_extra_data_after(type, primary)
82
+ # override for additional config or items
83
+ end
84
+
85
+ def menu_class_name
86
+ "Enjoy::Pages::Menu"
87
+ end
88
+ def menu_class
89
+ menu_class_name.constantize
90
+ end
91
+ end
@@ -0,0 +1,90 @@
1
+ module Enjoy::Pages::SeoPages
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ before_filter :find_page
5
+ end
6
+
7
+ private
8
+ def find_page
9
+ return if rails_admin?
10
+ @seo_page = find_seo_page request.path
11
+ if !@seo_page.nil? && !@seo_page.redirect.blank?
12
+ redirect_to @seo_page.redirect, status: :moved_permanently
13
+ end
14
+ end
15
+
16
+ def find_seo_page(path)
17
+ do_redirect = false
18
+ if path[0] != '/'
19
+ path = '/' + path
20
+ end
21
+ if path.length > 1 && path[-1] == '/'
22
+ path = path[0..-2]
23
+ do_redirect = true
24
+ end
25
+ page = page_class.enabled.where(fullpath: path).first
26
+
27
+ if page.nil? && !params[:slug].blank?
28
+ page = page_class.enabled.where(fullpath: "/" + params[:slug]).first
29
+ end
30
+
31
+ if page.nil?
32
+ page = find_seo_extra(path)
33
+ end
34
+
35
+ if page.nil?
36
+ do_redirect = true
37
+ spath = path.chomp(File.extname(path))
38
+ if spath != path
39
+ page = page_class.enabled.where(fullpath: spath).first
40
+ end
41
+ end
42
+
43
+ if !page.nil? && do_redirect
44
+ redirect_to path, status: :moved_permanently
45
+ end
46
+
47
+ page
48
+ end
49
+
50
+ def find_seo_page_with_redirect(path)
51
+ do_redirect = false
52
+ if path[0] != '/'
53
+ path = '/' + path
54
+ end
55
+ if path.length > 1 && path[-1] == '/'
56
+ path = path[0..-2]
57
+ do_redirect = true
58
+ end
59
+
60
+ page = page_class.enabled.any_of({fullpath: path}, {redirect: path}).first
61
+ if page.nil?
62
+ do_redirect = true
63
+ spath = path.chomp(File.extname(path))
64
+ if spath != path
65
+ page = page_class.enabled.any_of({fullpath: spath}, {redirect: spath}).first
66
+ end
67
+ end
68
+ if !page.nil? && do_redirect
69
+ redirect_to path, status: :moved_permanently
70
+ end
71
+
72
+ page
73
+
74
+ end
75
+
76
+ def find_seo_extra(path)
77
+ nil
78
+ end
79
+
80
+ def page_class_name
81
+ "Enjoy::Pages::Page"
82
+ end
83
+ def page_class
84
+ page_class_name.constantize
85
+ end
86
+
87
+ def rails_admin?
88
+ self.is_a?(RailsAdmin::ApplicationController) || self.is_a?(RailsAdmin::MainController)
89
+ end
90
+ end
@@ -0,0 +1,7 @@
1
+ module Enjoy::Pages
2
+ class PagesController < ApplicationController
3
+ include Enjoy::Pages::Controllers::Pages
4
+
5
+ include Enjoy::Pages::Decorators::PagesController
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ module Enjoy::Pages::CanonicalHelper
2
+ def enjoy_canonical_tag(url = "")
3
+ return if url.blank?
4
+ tag(:link, href: url, rel: :canonical)
5
+ end
6
+
7
+ def enjoy_canonical_tag_for(obj)
8
+ return if obj.use_enjoy_canonicalable
9
+ url = obj.enjoy_canonicalable_url
10
+ url = url_for(obj.enjoy_canonicalable) if !url.blank? and obj.enjoy_canonicalable
11
+ enjoy_canonical_tag(url) if url.blank?
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ module Enjoy::Pages::PagesHelper
2
+ end
@@ -0,0 +1,22 @@
1
+ module Enjoy::Pages::Canonicalable
2
+ extend ActiveSupport::Concern
3
+
4
+ module ClassMethods
5
+ def enjoy_canonical_fields(default = true)
6
+ if Enjoy::Pages.mongoid?
7
+ field :use_enjoy_canonicalable, type: Mongoid::Boolean, default: default
8
+ belongs_to :enjoy_canonicalable, polymorphic: true
9
+ field :enjoy_canonicalable_url, type: String, default: ""
10
+ end
11
+ end
12
+ end
13
+
14
+ included do
15
+ enjoy_canonical_fields
16
+ def enjoy_canonical_url(view_object)
17
+ return enjoy_canonicalable_url unless enjoy_canonicalable_url.blank?
18
+ return view_object.url_for enjoy_canonicalable unless enjoy_canonicalable.nil?
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,36 @@
1
+ module Enjoy::Pages::Connectable
2
+ extend ActiveSupport::Concern
3
+
4
+ module ClassMethods
5
+ def enjoy_connectable_field (name = :connected_pages, opts = {})
6
+ class_name = opts.delete(:class_name)
7
+ class_name ||= "Enjoy::Pages::Page"
8
+ routes_namespace = opts.delete(:routes_namespace)
9
+ routes_namespace ||= :main_app
10
+ autocreate_page = opts.delete(:autocreate_page)
11
+ autocreate_page = true if autocreate_page.nil?
12
+
13
+ has_many name, as: :enjoy_connectable, class_name: class_name
14
+ class_eval <<-EVAL
15
+ def routes_namespace
16
+ :#{routes_namespace}
17
+ end
18
+ EVAL
19
+
20
+ if autocreate_page
21
+ attr_accessor :enjoy_connectable_autocreate_page
22
+ _name_attr = Enjoy::Pages.config.localize ? "name_translations" : "name"
23
+ class_eval <<-EVAL
24
+ after_create do
25
+ if self.enjoy_connectable_autocreate_page
26
+ _p = #{class_name}.new
27
+ _p.#{_name_attr} = self.#{_name_attr}
28
+ _p.connectable = self
29
+ _p.save
30
+ end
31
+ end
32
+ EVAL
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Pages::Decorators
2
+ module Block
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Pages::Decorators
2
+ module Blockset
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Pages::Decorators
2
+ module Menu
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Pages::Decorators
2
+ module Page
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module Enjoy::Pages
2
+ if Enjoy::Pages.mongoid?
3
+ class Block < Enjoy::EmbeddedElement
4
+ include Enjoy::Pages::Models::Block
5
+
6
+ include Enjoy::Pages::Decorators::Block
7
+
8
+ rails_admin(&Enjoy::Pages::Admin::Block.config(rails_admin_add_fields) { |config|
9
+ rails_admin_add_config(config)
10
+ })
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Enjoy::Pages
2
+ if Enjoy::Pages.mongoid?
3
+ class Blockset
4
+ include Enjoy::Pages::Models::Blockset
5
+
6
+ include Enjoy::Pages::Decorators::Blockset
7
+
8
+ rails_admin(&Enjoy::Pages::Admin::Blockset.config(rails_admin_add_fields) { |config|
9
+ rails_admin_add_config(config)
10
+ })
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ module Enjoy::Pages
2
+ if Enjoy::Pages.active_record?
3
+ class Menu < ActiveRecord::Base
4
+ end
5
+ end
6
+
7
+ class Menu
8
+ include Enjoy::Pages::Models::Menu
9
+
10
+ include Enjoy::Pages::Decorators::Menu
11
+
12
+ rails_admin(&Enjoy::Pages::Admin::Menu.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Enjoy::Pages
2
+ if Enjoy::Pages.active_record?
3
+ class Page < ActiveRecord::Base
4
+ end
5
+ end
6
+
7
+ class Page
8
+ include Enjoy::Pages::Models::Page
9
+
10
+ include Enjoy::Pages::Decorators::Page
11
+
12
+ rails_admin(&Enjoy::Pages::Admin::Page.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ = render 'shared/obj', obj: @seo_page