enjoy_cms 0.3.7.4 → 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/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +62 -111
- data/app/assets/javascripts/{enjoy_cms → enjoy/cms}/flash.coffee +0 -0
- data/app/assets/javascripts/enjoy/cms/init.coffee +1 -0
- data/app/assets/javascripts/{enjoy_cms → enjoy/cms}/map.coffee +0 -0
- data/app/assets/javascripts/enjoy/cms.coffee +11 -0
- data/app/assets/javascripts/enjoy/rails_admin/cms.ui.coffee +26 -0
- data/app/assets/javascripts/{enjoy_cms → enjoy}/rails_admin/custom/ui.coffee +0 -0
- data/app/assets/javascripts/rails_admin/custom/ui.coffee +2 -2
- data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/flash.sass +0 -0
- data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/normalize.scss +0 -0
- data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/powered.sass +0 -0
- data/app/assets/stylesheets/{enjoy_cms.sass → enjoy/cms.sass} +3 -1
- data/app/assets/stylesheets/enjoy/rails_admin/cms.ui.sass +117 -0
- data/{lib/enjoy/controllers/sitemap_data.rb → app/assets/stylesheets/enjoy/rails_admin/custom/ui.sass} +0 -0
- data/app/assets/stylesheets/rails_admin/custom/theming.sass +2 -0
- data/app/controllers/concerns/enjoy/errors.rb +1 -1
- data/app/controllers/enjoy/registrations_controller.rb +20 -0
- data/app/controllers/enjoy/sessions_controller.rb +19 -0
- data/app/helpers/enjoy/home_helper.rb +2 -0
- data/app/helpers/enjoy/powered_helper.rb +1 -1
- data/app/models/concerns/enjoy/html_field.rb +3 -0
- data/app/views/blocks/_favicon.html.slim +60 -21
- data/app/views/devise/registrations/edit.html.slim +2 -2
- data/app/views/devise/registrations/new.html.slim +9 -3
- data/app/views/devise/sessions/new.html.slim +8 -2
- data/app/views/devise/shared/_links.html.slim +4 -4
- data/app/views/{errors → enjoy/errors}/_base.html.slim +0 -0
- data/app/views/{errors → enjoy/errors}/error_403.html.slim +0 -0
- data/app/views/{errors → enjoy/errors}/error_404.html.slim +0 -0
- data/app/views/{errors → enjoy/errors}/error_500.html.slim +0 -0
- data/app/views/{simple_captcha → enjoy/simple_captcha}/_simple_captcha.html.slim +0 -0
- data/app/views/layouts/application.html.slim +8 -4
- data/app/views/layouts/enjoy/devise/confirmations.html.slim +27 -0
- data/app/views/layouts/enjoy/devise/passwords.html.slim +27 -0
- data/app/views/layouts/enjoy/devise/registrations.html.slim +27 -0
- data/app/views/layouts/enjoy/devise/sessions.html.slim +27 -0
- data/app/views/layouts/enjoy/devise/unlocks.html.slim +27 -0
- data/app/views/rails_admin/main/_setting_value.html.haml +104 -0
- data/app/views/shared/_messages.html.slim +1 -1
- data/config/initializers/simple_captcha.rb +29 -20
- data/config/locales/en.enjoy.yml +1 -1
- data/config/locales/ru.enjoy.yml +0 -7
- data/config/locales/ru.models.yml +2 -39
- data/enjoy_cms.gemspec +7 -20
- data/lib/enjoy/configuration.rb +24 -40
- data/lib/enjoy/controller.rb +5 -3
- data/lib/enjoy/engine.rb +28 -28
- data/lib/enjoy/migration.rb +0 -19
- data/lib/enjoy/model.rb +5 -2
- data/lib/enjoy/rails_admin_ext/config.rb +112 -0
- data/lib/enjoy/rails_admin_ext/enjoy_hash.rb +0 -2
- data/lib/enjoy/rails_admin_ext/enjoy_slugs.rb +31 -0
- data/lib/enjoy/rails_admin_ext/group_patch.rb +2 -1
- data/lib/enjoy/rails_admin_settings_patch.rb +7 -0
- data/lib/enjoy/routes.rb +1 -26
- data/lib/enjoy/version.rb +1 -1
- data/lib/enjoy_cms.rb +25 -71
- data/lib/filename_to_slug.rb +20 -22
- data/lib/generators/enjoy/{ability_generator.rb → cms/ability_generator.rb} +3 -3
- data/lib/generators/enjoy/{admin_generator.rb → cms/admin_generator.rb} +2 -2
- data/lib/generators/enjoy/cms/application_generator.rb +14 -0
- data/lib/generators/enjoy/cms/assets_generator.rb +35 -0
- data/lib/generators/enjoy/{config/install_generator.rb → cms/config_generator.rb} +3 -3
- data/lib/generators/enjoy/cms/gemfile_generator.rb +13 -0
- data/lib/generators/enjoy/{layout_generator.rb → cms/layout_generator.rb} +2 -2
- data/lib/generators/enjoy/cms/paperclip_optimizer_generator.rb +13 -0
- data/lib/generators/enjoy/cms/rack_generator.rb +12 -0
- data/lib/generators/enjoy/cms/robots_generator.rb +12 -0
- data/lib/generators/enjoy/cms/scripts_generator.rb +25 -0
- data/lib/generators/enjoy/cms/templates/Gemfile.erb +69 -0
- data/lib/generators/enjoy/cms/templates/ability.erb +45 -0
- data/lib/generators/enjoy/{templates → cms/templates}/admin.erb +5 -26
- data/lib/generators/enjoy/cms/templates/application.erb +42 -0
- data/lib/generators/enjoy/cms/templates/assets/javascripts/application.coffee.erb +1 -0
- data/lib/generators/enjoy/cms/templates/assets/stylesheets/application.sass.erb +15 -0
- data/lib/generators/enjoy/cms/templates/assets/stylesheets/enjoy/rails_admin/custom/ui.sass.erb +106 -0
- data/lib/generators/enjoy/cms/templates/enjoy_cms.erb +28 -0
- data/lib/generators/enjoy/cms/templates/paperclip_optimizer.erb +80 -0
- data/lib/generators/enjoy/cms/templates/rack.erb +15 -0
- data/lib/generators/enjoy/cms/templates/robots.txt.erb +4 -0
- data/lib/generators/enjoy/cms/templates/scripts/assets_precompile.sh +3 -0
- data/lib/generators/enjoy/cms/templates/scripts/bundle_production.sh +4 -0
- data/lib/generators/enjoy/cms/templates/scripts/db_dump.sh.erb +3 -0
- data/lib/generators/enjoy/cms/templates/scripts/db_restore.sh +3 -0
- data/lib/generators/enjoy/cms/templates/scripts/full_assets_precompile.sh +4 -0
- data/lib/generators/enjoy/cms/templates/scripts/restart_thru_kill.sh +3 -0
- data/lib/generators/enjoy/cms/templates/scripts/send_hup.sh +3 -0
- data/lib/generators/enjoy/cms/templates/scripts/send_usr2.sh +3 -0
- data/lib/generators/enjoy/cms/templates/unicorn.erb +57 -0
- data/lib/generators/enjoy/cms/templates/unicorn.god.erb +59 -0
- data/lib/generators/enjoy/cms/unicorn_god_generator.rb +15 -0
- data/lib/generators/enjoy/{utils.rb → cms/utils.rb} +1 -1
- data/lib/rails_admin/custom_show_in_app.rb +13 -13
- data/template.rb +197 -543
- metadata +73 -325
- data/app/assets/javascripts/enjoy_cms/contacts.coffee +0 -11
- data/app/assets/javascripts/enjoy_cms/rails_admin/cms.ui.coffee +0 -6
- data/app/assets/javascripts/enjoy_cms.coffee +0 -7
- data/app/controllers/concerns/enjoy/blocksetable.rb +0 -37
- data/app/controllers/concerns/enjoy/decorators/contacts.rb +0 -5
- data/app/controllers/concerns/enjoy/decorators/news.rb +0 -5
- data/app/controllers/concerns/enjoy/decorators/pages.rb +0 -5
- data/app/controllers/concerns/enjoy/decorators/search.rb +0 -5
- data/app/controllers/concerns/enjoy/nav_menu.rb +0 -91
- data/app/controllers/concerns/enjoy/seo_pages.rb +0 -90
- data/app/controllers/enjoy/contacts_controller.rb +0 -7
- data/app/controllers/enjoy/news_controller.rb +0 -7
- data/app/controllers/enjoy/pages_controller.rb +0 -7
- data/app/controllers/enjoy/search_controller.rb +0 -8
- data/app/mailers/enjoy/contact_mailer.rb +0 -17
- data/app/models/concerns/enjoy/connectable.rb +0 -36
- data/app/models/concerns/enjoy/decorators/contact_message.rb +0 -5
- data/app/models/concerns/enjoy/decorators/embedded_gallery_image.rb +0 -5
- data/app/models/concerns/enjoy/decorators/gallery.rb +0 -5
- data/app/models/concerns/enjoy/decorators/gallery_image.rb +0 -5
- data/app/models/concerns/enjoy/decorators/menu.rb +0 -5
- data/app/models/concerns/enjoy/decorators/news.rb +0 -5
- data/app/models/concerns/enjoy/decorators/page.rb +0 -5
- data/app/models/concerns/enjoy/decorators/page_block.rb +0 -5
- data/app/models/concerns/enjoy/decorators/page_blockset.rb +0 -5
- data/app/models/concerns/enjoy/decorators/seo.rb +0 -5
- data/app/models/concerns/enjoy/decorators/sitemap_data.rb +0 -5
- data/app/models/concerns/enjoy/mongoid_paperclip.rb +0 -51
- data/app/models/concerns/enjoy/seoable.rb +0 -36
- data/app/models/concerns/enjoy/sitemap_data_field.rb +0 -17
- data/app/models/enjoy/contact_message.rb +0 -16
- data/app/models/enjoy/embedded_gallery_image.rb +0 -16
- data/app/models/enjoy/gallery.rb +0 -13
- data/app/models/enjoy/gallery_image.rb +0 -13
- data/app/models/enjoy/menu.rb +0 -16
- data/app/models/enjoy/news.rb +0 -16
- data/app/models/enjoy/page.rb +0 -16
- data/app/models/enjoy/page_block.rb +0 -13
- data/app/models/enjoy/page_blockset.rb +0 -13
- data/app/models/enjoy/seo.rb +0 -16
- data/app/models/enjoy/sitemap_data.rb +0 -16
- data/app/views/enjoy/contact_mailer/new_message_email.html.slim +0 -15
- data/app/views/enjoy/contacts/_form.html.slim +0 -7
- data/app/views/enjoy/contacts/_form_with_wrapper.html.slim +0 -2
- data/app/views/enjoy/contacts/_success.html.slim +0 -3
- data/app/views/enjoy/contacts/index.html.slim +0 -4
- data/app/views/enjoy/contacts/new.html.slim +0 -4
- data/app/views/enjoy/contacts/sent.html.slim +0 -3
- data/app/views/enjoy/news/index.html.slim +0 -9
- data/app/views/enjoy/news/show.html.slim +0 -8
- data/app/views/enjoy/pages/show.html.slim +0 -1
- data/app/views/enjoy/search/index.html.slim +0 -19
- data/app/views/rails_admin/main/_enjoy_connectable.html.slim +0 -56
- data/config/locales/ru.kaminari.yml +0 -17
- data/config/locales/ru.simple_captcha.yml +0 -3
- data/config/locales/ru.simple_form.yml +0 -9
- data/lib/enjoy/admin/contact_message.rb +0 -42
- data/lib/enjoy/admin/embedded_gallery_image.rb +0 -38
- data/lib/enjoy/admin/gallery.rb +0 -44
- data/lib/enjoy/admin/gallery_image.rb +0 -31
- data/lib/enjoy/admin/menu.rb +0 -27
- data/lib/enjoy/admin/news.rb +0 -89
- data/lib/enjoy/admin/page.rb +0 -96
- data/lib/enjoy/admin/page_block.rb +0 -49
- data/lib/enjoy/admin/page_blockset.rb +0 -50
- data/lib/enjoy/admin/seo.rb +0 -41
- data/lib/enjoy/admin/sitemap_data.rb +0 -29
- data/lib/enjoy/controllers/contacts.rb +0 -86
- data/lib/enjoy/controllers/news.rb +0 -36
- data/lib/enjoy/controllers/pages.rb +0 -22
- data/lib/enjoy/controllers/search.rb +0 -62
- data/lib/enjoy/elastic_search.rb +0 -31
- data/lib/enjoy/models/active_record/contact_message.rb +0 -14
- data/lib/enjoy/models/active_record/menu.rb +0 -17
- data/lib/enjoy/models/active_record/news.rb +0 -26
- data/lib/enjoy/models/active_record/page.rb +0 -20
- data/lib/enjoy/models/active_record/seo.rb +0 -17
- data/lib/enjoy/models/active_record/sitemap_data.rb +0 -11
- data/lib/enjoy/models/contact_message.rb +0 -41
- data/lib/enjoy/models/embedded_gallery_image.rb +0 -13
- data/lib/enjoy/models/gallery.rb +0 -21
- data/lib/enjoy/models/gallery_image.rb +0 -19
- data/lib/enjoy/models/menu.rb +0 -23
- data/lib/enjoy/models/mongoid/contact_message.rb +0 -23
- data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +0 -24
- data/lib/enjoy/models/mongoid/gallery.rb +0 -32
- data/lib/enjoy/models/mongoid/gallery_image.rb +0 -29
- data/lib/enjoy/models/mongoid/menu.rb +0 -20
- data/lib/enjoy/models/mongoid/news.rb +0 -37
- data/lib/enjoy/models/mongoid/page.rb +0 -49
- data/lib/enjoy/models/mongoid/page_block.rb +0 -56
- data/lib/enjoy/models/mongoid/page_blockset.rb +0 -20
- data/lib/enjoy/models/mongoid/seo.rb +0 -35
- data/lib/enjoy/models/mongoid/sitemap_data.rb +0 -25
- data/lib/enjoy/models/news.rb +0 -58
- data/lib/enjoy/models/page.rb +0 -92
- data/lib/enjoy/models/page_block.rb +0 -22
- data/lib/enjoy/models/page_blockset.rb +0 -24
- data/lib/enjoy/models/seo.rb +0 -17
- data/lib/enjoy/models/sitemap_data.rb +0 -17
- data/lib/enjoy/rails_admin_ext/enjoy_connectable.rb +0 -33
- data/lib/enjoy/rails_admin_ext/menu.rb +0 -147
- data/lib/generators/enjoy/capify_generator.rb +0 -39
- data/lib/generators/enjoy/config/templates/enjoy_cms.erb +0 -27
- data/lib/generators/enjoy/migration_generator.rb +0 -18
- data/lib/generators/enjoy/templates/Capfile +0 -17
- data/lib/generators/enjoy/templates/ability.erb +0 -48
- data/lib/generators/enjoy/templates/deploy.erb +0 -47
- data/lib/generators/enjoy/templates/dl.erb +0 -30
- data/lib/generators/enjoy/templates/migration_contact_messages.rb +0 -15
- data/lib/generators/enjoy/templates/migration_news.rb +0 -26
- data/lib/generators/enjoy/templates/migration_pages.rb +0 -45
- data/lib/generators/enjoy/templates/migration_seos.rb +0 -14
- data/lib/generators/enjoy/templates/production.erb +0 -8
- data/lib/generators/enjoy/templates/unicorn.erb +0 -66
@@ -1,91 +0,0 @@
|
|
1
|
-
module Enjoy::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::Menu"
|
87
|
-
end
|
88
|
-
def menu_class
|
89
|
-
menu_class_name.constantize
|
90
|
-
end
|
91
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module Enjoy::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 = Enjoy::Page.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::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
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
class ContactMailer < ActionMailer::Base
|
3
|
-
def new_message_email(message)
|
4
|
-
@message = message
|
5
|
-
|
6
|
-
#if message.attachment?
|
7
|
-
# attachments[message.attachment.identifier] = File.read(message.attachment.current_path)
|
8
|
-
#end
|
9
|
-
|
10
|
-
mail(
|
11
|
-
from: Settings.default_email_from(default: 'noreply@enjoycreate.ru'),
|
12
|
-
to: Settings.form_email(default: 'admin@enjoycreate.ru'),
|
13
|
-
subject: "[#{Settings.email_topic(default: 'с сайта')}] #{message.name} #{message.email}"
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Enjoy::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::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: :connectable, class_name: "Enjoy::Page"
|
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.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
|
@@ -1,51 +0,0 @@
|
|
1
|
-
if Enjoy.mongoid?
|
2
|
-
module Enjoy::MongoidPaperclip
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
include Mongoid::Paperclip
|
6
|
-
|
7
|
-
module ClassMethods
|
8
|
-
def enjoy_cms_mongoid_attached_file(name, opts = {})
|
9
|
-
name = name.to_sym
|
10
|
-
unless opts.blank?
|
11
|
-
content_type = opts.delete(:content_type)
|
12
|
-
jcrop_options = opts.delete(:jcrop_options)
|
13
|
-
end
|
14
|
-
|
15
|
-
opts[:processors] ||= []
|
16
|
-
opts[:processors] << :paperclip_optimizer
|
17
|
-
opts[:processors].flatten!
|
18
|
-
opts[:processors].uniq!
|
19
|
-
|
20
|
-
opts[:convert_options] = {all: "-quality 75 -strip"} if opts[:convert_options].blank?
|
21
|
-
|
22
|
-
has_mongoid_attached_file name, opts
|
23
|
-
validates_attachment name, content_type: content_type unless content_type.blank?
|
24
|
-
class_eval <<-EVAL
|
25
|
-
def #{name}_file_name=(val)
|
26
|
-
return self[:#{name}_file_name] = "" if val == ""
|
27
|
-
return self[:#{name}_file_name] = nil if val == nil
|
28
|
-
val = val.to_s
|
29
|
-
extension = File.extname(val)[1..-1]
|
30
|
-
file_name = val[0..val.size-extension.size-1]
|
31
|
-
self[:#{name}_file_name] = "\#{file_name.filename_to_slug}.\#{extension.filename_to_slug}"
|
32
|
-
end
|
33
|
-
|
34
|
-
before_#{name}_post_process do
|
35
|
-
p_o = self.#{name}.processors.delete :paperclip_optimizer
|
36
|
-
self.#{name}.processors << p_o if p_o
|
37
|
-
true
|
38
|
-
end
|
39
|
-
EVAL
|
40
|
-
jcrop_options ||= {}
|
41
|
-
if jcrop_options
|
42
|
-
class_eval <<-EVAL
|
43
|
-
def #{name}_jcrop_options
|
44
|
-
#{jcrop_options}
|
45
|
-
end
|
46
|
-
EVAL
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Enjoy::Seoable
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
LOCALIZED_FIELDS = [:h1, :title, :keywords, :description, :og_title]
|
4
|
-
FIELDS = LOCALIZED_FIELDS + [:og_image, :robots]
|
5
|
-
|
6
|
-
included do
|
7
|
-
has_one :seo, as: :seoable, autosave: true, class_name: "Enjoy::Seo"
|
8
|
-
accepts_nested_attributes_for :seo
|
9
|
-
|
10
|
-
delegate *FIELDS, to: :seo
|
11
|
-
delegate *(FIELDS.map {|f| "#{f}=".to_sym }), to: :seo
|
12
|
-
|
13
|
-
if Enjoy.config.localize
|
14
|
-
delegate *(LOCALIZED_FIELDS.map {|f| "#{f}_translations".to_sym }), to: :seo
|
15
|
-
delegate *(LOCALIZED_FIELDS.map {|f| "#{f}_translations=".to_sym }), to: :seo
|
16
|
-
end
|
17
|
-
|
18
|
-
alias seo_without_build seo
|
19
|
-
def seo
|
20
|
-
seo_without_build || build_seo
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def page_title
|
25
|
-
title.blank? ? name : title
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_og_title
|
29
|
-
og_title.blank? ? name : og_title
|
30
|
-
end
|
31
|
-
|
32
|
-
def og_image_jcrop_options
|
33
|
-
{aspectRation: 800.0/600.0}
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Enjoy::SitemapDataField
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
FIELDS = [:sitemap_show, :sitemap_lastmod, :sitemap_changefreq, :sitemap_priority]
|
4
|
-
|
5
|
-
included do
|
6
|
-
has_one :sitemap_data, as: :sitemap_data_field, autosave: true, class_name: "Enjoy::SitemapData"
|
7
|
-
accepts_nested_attributes_for :sitemap_data
|
8
|
-
|
9
|
-
delegate *FIELDS, to: :sitemap_data
|
10
|
-
delegate *(FIELDS.map {|f| "#{f}=".to_sym }), to: :sitemap_data
|
11
|
-
|
12
|
-
alias sitemap_data_without_build sitemap_data
|
13
|
-
def sitemap_data
|
14
|
-
sitemap_data_without_build || build_sitemap_data
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class ContactMessage < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class ContactMessage
|
8
|
-
include Enjoy::Models::ContactMessage
|
9
|
-
|
10
|
-
include Enjoy::Decorators::ContactMessage
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::ContactMessage.config(rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.mongoid?
|
3
|
-
class EmbeddedGalleryImage < Enjoy::EmbeddedElement
|
4
|
-
include Enjoy::Models::EmbeddedGalleryImage
|
5
|
-
|
6
|
-
include Enjoy::Decorators::EmbeddedGalleryImage
|
7
|
-
|
8
|
-
# use it in inherited model
|
9
|
-
# rails_admin &Enjoy::Admin::EmbeddedGalleryImage.config
|
10
|
-
|
11
|
-
# use it in rails_admin in parent model for sort
|
12
|
-
# sort_embedded({fields: [:embedded_field_1, :embedded_field_2...]})
|
13
|
-
# or u need to override rails_admin in inherited model to add sort field
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/app/models/enjoy/gallery.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.mongoid?
|
3
|
-
class Gallery
|
4
|
-
include Enjoy::Models::Gallery
|
5
|
-
|
6
|
-
include Enjoy::Decorators::Gallery
|
7
|
-
|
8
|
-
rails_admin(&Enjoy::Admin::Gallery.config(rails_admin_add_fields) { |config|
|
9
|
-
rails_admin_add_config(config)
|
10
|
-
})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.mongoid?
|
3
|
-
class GalleryImage
|
4
|
-
include Enjoy::Models::GalleryImage
|
5
|
-
|
6
|
-
include Enjoy::Decorators::GalleryImage
|
7
|
-
|
8
|
-
rails_admin(&Enjoy::Admin::GalleryImage.config(rails_admin_add_fields) { |config|
|
9
|
-
rails_admin_add_config(config)
|
10
|
-
})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/app/models/enjoy/menu.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class Menu < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class Menu
|
8
|
-
include Enjoy::Models::Menu
|
9
|
-
|
10
|
-
include Enjoy::Decorators::Menu
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::Menu.config(rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
data/app/models/enjoy/news.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class News < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class News
|
8
|
-
include Enjoy::Models::News
|
9
|
-
|
10
|
-
include Enjoy::Decorators::News
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::News.config(rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
data/app/models/enjoy/page.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class Page < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class Page
|
8
|
-
include Enjoy::Models::Page
|
9
|
-
|
10
|
-
include Enjoy::Decorators::Page
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::Page.config(rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.mongoid?
|
3
|
-
class PageBlock < Enjoy::EmbeddedElement
|
4
|
-
include Enjoy::Models::PageBlock
|
5
|
-
|
6
|
-
include Enjoy::Decorators::PageBlock
|
7
|
-
|
8
|
-
rails_admin(&Enjoy::Admin::PageBlock.config(rails_admin_add_fields) { |config|
|
9
|
-
rails_admin_add_config(config)
|
10
|
-
})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.mongoid?
|
3
|
-
class PageBlockset
|
4
|
-
include Enjoy::Models::PageBlockset
|
5
|
-
|
6
|
-
include Enjoy::Decorators::PageBlockset
|
7
|
-
|
8
|
-
rails_admin(&Enjoy::Admin::PageBlockset.config(rails_admin_add_fields) { |config|
|
9
|
-
rails_admin_add_config(config)
|
10
|
-
})
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/app/models/enjoy/seo.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class Seo < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class Seo
|
8
|
-
include Enjoy::Models::Seo
|
9
|
-
|
10
|
-
include Enjoy::Decorators::Seo
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::Seo.config(false, rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Enjoy
|
2
|
-
if Enjoy.active_record?
|
3
|
-
class SitemapData < ActiveRecord::Base
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class SitemapData
|
8
|
-
include Enjoy::Models::SitemapData
|
9
|
-
|
10
|
-
include Enjoy::Decorators::SitemapData
|
11
|
-
|
12
|
-
rails_admin(&Enjoy::Admin::SitemapData.config(false, rails_admin_add_fields) { |config|
|
13
|
-
rails_admin_add_config(config)
|
14
|
-
})
|
15
|
-
end
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
- excluded_column_names = %w[id c_at u_at created_at updated_at _id _type enabled attachment c_at u_at captcha captcha_key veenjoyion creator_id creator updater_id updater modifier modifier_id]
|
2
|
-
|
3
|
-
h3= "Сообщение из формы связи:"
|
4
|
-
|
5
|
-
table
|
6
|
-
tr
|
7
|
-
th(style='padding: 2px 3px') Поле
|
8
|
-
th(style='padding: 2px 3px') Значение
|
9
|
-
- fields = (Enjoy.mongoid? ? Enjoy::ContactMessage.fields.keys : Enjoy::ContactMessage.columns.map(&:name))
|
10
|
-
- fields.reject{|c| excluded_column_names.include?(c) }.each do |c|
|
11
|
-
tr
|
12
|
-
td(style='padding: 2px 3px')
|
13
|
-
= Enjoy::ContactMessage.human_attribute_name(c)
|
14
|
-
td(style='padding: 2px 3px')
|
15
|
-
= @message.send(c.to_sym)
|