ack_rocket_cms 0.7.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +244 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/head.load.js +707 -0
- data/app/assets/javascripts/jquery.placeholder.js +157 -0
- data/app/assets/javascripts/rocket_cms.js.coffee +10 -0
- data/app/assets/javascripts/rocket_cms/flash.js.coffee +3 -0
- data/app/assets/javascripts/rocket_cms/map.js.coffee +22 -0
- data/app/assets/stylesheets/rocket_cms.css.sass +6 -0
- data/app/assets/stylesheets/rocket_cms/flash.css.sass +66 -0
- data/app/assets/stylesheets/rocket_cms/normalize.css.scss +406 -0
- data/app/controllers/concerns/no_cache.rb +12 -0
- data/app/controllers/concerns/rs_errors.rb +63 -0
- data/app/controllers/concerns/rs_menu.rb +45 -0
- data/app/controllers/concerns/rs_pages.rb +41 -0
- data/app/controllers/contacts_controller.rb +3 -0
- data/app/controllers/home_controller.rb +5 -0
- data/app/controllers/news_controller.rb +3 -0
- data/app/controllers/pages_controller.rb +4 -0
- data/app/controllers/search_controller.rb +4 -0
- data/app/mailers/contact_mailer.rb +15 -0
- data/app/models/concerns/boolean_field.rb +17 -0
- data/app/models/concerns/enableable.rb +8 -0
- data/app/models/concerns/geocodeable.rb +4 -0
- data/app/models/concerns/mappable.rb +95 -0
- data/app/models/concerns/seoable.rb +42 -0
- data/app/models/concerns/sitemap_data.rb +20 -0
- data/app/models/concerns/sort_field.rb +17 -0
- data/app/models/concerns/sortable.rb +8 -0
- data/app/models/contact_message.rb +11 -0
- data/app/models/menu.rb +11 -0
- data/app/models/news.rb +10 -0
- data/app/models/page.rb +11 -0
- data/app/views/blocks/_footer.html.haml +1 -0
- data/app/views/contact_mailer/new_message_email.html.haml +16 -0
- data/app/views/contacts/index.html.haml +10 -0
- data/app/views/contacts/new.html.haml +10 -0
- data/app/views/contacts/sent.html.haml +4 -0
- data/app/views/errors/_base.html.haml +3 -0
- data/app/views/errors/error_403.html.haml +1 -0
- data/app/views/errors/error_404.html.haml +1 -0
- data/app/views/errors/error_500.html.haml +1 -0
- data/app/views/home/index.html.haml +1 -0
- data/app/views/layouts/application.html.haml +23 -0
- data/app/views/layouts/application.html.slim +24 -0
- data/app/views/news/index.html.haml +9 -0
- data/app/views/news/show.html.haml +8 -0
- data/app/views/pages/show.html.haml +1 -0
- data/app/views/rails_admin/main/_check_boxes.html.haml +27 -0
- data/app/views/rails_admin/main/_enum_check_boxes.html.haml +5 -0
- data/app/views/rails_admin/main/_enum_radio_buttons.html.haml +5 -0
- data/app/views/rails_admin/main/_form_raw.html.haml +1 -0
- data/app/views/search/index.html.haml +19 -0
- data/app/views/shared/_admin_link.html.haml +3 -0
- data/app/views/shared/_messages.html.haml +7 -0
- data/app/views/shared/_meta.html.haml +6 -0
- data/app/views/shared/_obj.html.haml +20 -0
- data/app/views/shared/_og.html.haml +4 -0
- data/config/locales/en.rocket_admin.yml +6 -0
- data/config/locales/en.rs.yml +20 -0
- data/config/locales/ru.cancan.yml +4 -0
- data/config/locales/ru.devise.yml +65 -0
- data/config/locales/ru.kaminari.yml +17 -0
- data/config/locales/ru.models.yml +92 -0
- data/config/locales/ru.mongoid.yml +450 -0
- data/config/locales/ru.rails_admin.yml +148 -0
- data/config/locales/ru.rocket_admin.yml +6 -0
- data/config/locales/ru.rs.yml +20 -0
- data/config/locales/ru.simple_captcha.yml +3 -0
- data/config/locales/ru.simple_form.yml +9 -0
- data/lib/filename_to_slug.rb +34 -0
- data/lib/generators/rocket_cms/ability_generator.rb +15 -0
- data/lib/generators/rocket_cms/admin_generator.rb +21 -0
- data/lib/generators/rocket_cms/capify_generator.rb +40 -0
- data/lib/generators/rocket_cms/layout_generator.rb +15 -0
- data/lib/generators/rocket_cms/migration_generator.rb +19 -0
- data/lib/generators/rocket_cms/templates/Capfile +17 -0
- data/lib/generators/rocket_cms/templates/ability.erb +28 -0
- data/lib/generators/rocket_cms/templates/admin.erb +81 -0
- data/lib/generators/rocket_cms/templates/deploy.erb +47 -0
- data/lib/generators/rocket_cms/templates/dl.erb +30 -0
- data/lib/generators/rocket_cms/templates/migration_contact_messages.rb +15 -0
- data/lib/generators/rocket_cms/templates/migration_news.rb +21 -0
- data/lib/generators/rocket_cms/templates/migration_pages.rb +36 -0
- data/lib/generators/rocket_cms/templates/production.erb +8 -0
- data/lib/generators/rocket_cms/templates/unicorn.erb +66 -0
- data/lib/generators/rocket_cms/utils.rb +22 -0
- data/lib/manual_slug.rb +11 -0
- data/lib/manual_slug/active_record.rb +32 -0
- data/lib/manual_slug/mongoid.rb +36 -0
- data/lib/rails_admin/custom_show_in_app.rb +39 -0
- data/lib/rocket_cms.rb +88 -0
- data/lib/rocket_cms/admin.rb +152 -0
- data/lib/rocket_cms/configuration.rb +67 -0
- data/lib/rocket_cms/controller.rb +24 -0
- data/lib/rocket_cms/controllers/contacts.rb +70 -0
- data/lib/rocket_cms/controllers/news.rb +31 -0
- data/lib/rocket_cms/controllers/pages.rb +19 -0
- data/lib/rocket_cms/controllers/search.rb +45 -0
- data/lib/rocket_cms/elastic_search.rb +31 -0
- data/lib/rocket_cms/engine.rb +39 -0
- data/lib/rocket_cms/migration.rb +31 -0
- data/lib/rocket_cms/model.rb +25 -0
- data/lib/rocket_cms/models/active_record/contact_message.rb +14 -0
- data/lib/rocket_cms/models/active_record/menu.rb +14 -0
- data/lib/rocket_cms/models/active_record/news.rb +23 -0
- data/lib/rocket_cms/models/active_record/page.rb +17 -0
- data/lib/rocket_cms/models/contact_message.rb +27 -0
- data/lib/rocket_cms/models/menu.rb +29 -0
- data/lib/rocket_cms/models/mongoid/contact_message.rb +20 -0
- data/lib/rocket_cms/models/mongoid/menu.rb +12 -0
- data/lib/rocket_cms/models/mongoid/news.rb +27 -0
- data/lib/rocket_cms/models/mongoid/page.rb +26 -0
- data/lib/rocket_cms/models/news.rb +50 -0
- data/lib/rocket_cms/models/page.rb +76 -0
- data/lib/rocket_cms/patch.rb +58 -0
- data/lib/rocket_cms/rails_admin_menu.rb +145 -0
- data/lib/rocket_cms/simple_form_patch.rb +12 -0
- data/lib/rocket_cms/tasks.rb +13 -0
- data/lib/rocket_cms/version.rb +3 -0
- data/release.sh +13 -0
- data/rocket_cms.gemspec +54 -0
- data/template.rb +557 -0
- metadata +533 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
class RocketCmsCreatePages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :menus do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.string :slug, null: false
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
add_index :menus, :slug, unique: true
|
9
|
+
|
10
|
+
create_table :pages do |t|
|
11
|
+
t.boolean :enabled, default: true, null: false
|
12
|
+
t.integer :parent_id
|
13
|
+
t.integer :lft
|
14
|
+
t.integer :rgt
|
15
|
+
t.integer :depth
|
16
|
+
|
17
|
+
t.string :slug, null: false
|
18
|
+
t.attachment :image
|
19
|
+
|
20
|
+
t.string :regexp
|
21
|
+
t.string :redirect
|
22
|
+
t.text :content
|
23
|
+
t.string :fullpath, null: false
|
24
|
+
RocketCMS::Migration.seo_fields(t)
|
25
|
+
t.timestamps
|
26
|
+
end
|
27
|
+
add_index :pages, :slug, unique: true
|
28
|
+
add_index :pages, [:enabled, :lft]
|
29
|
+
|
30
|
+
create_join_table :menus, :pages
|
31
|
+
|
32
|
+
add_foreign_key(:menus_pages, :menus, dependent: :delete)
|
33
|
+
add_foreign_key(:menus_pages, :pages, dependent: :delete)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
rails_env = ENV['RAILS_ENV'] || 'production'
|
2
|
+
|
3
|
+
deploy_to = '<%= deploy_to %>'
|
4
|
+
rails_root = "#{deploy_to}/current"
|
5
|
+
|
6
|
+
tmp_dir = "#{deploy_to}/shared/tmp"
|
7
|
+
pid_dir = "#{tmp_dir}/pids"
|
8
|
+
if File.directory?(tmp_dir) && !File.directory?(pid_dir)
|
9
|
+
puts "creating pid dir #{pid_dir}"
|
10
|
+
Dir.mkdir(pid_dir)
|
11
|
+
end
|
12
|
+
pid_file = "#{pid_dir}/unicorn.pid"
|
13
|
+
|
14
|
+
log_file = "#{deploy_to}/shared/log/unicorn.log"
|
15
|
+
err_log_file = "#{deploy_to}/shared/log/unicorn.error.log"
|
16
|
+
|
17
|
+
old_pid_file = pid_file + '.oldbin'
|
18
|
+
|
19
|
+
worker_processes 1
|
20
|
+
working_directory rails_root
|
21
|
+
|
22
|
+
timeout 120
|
23
|
+
|
24
|
+
# Specify path to socket unicorn listens to,
|
25
|
+
# we will use this in our nginx.conf later
|
26
|
+
|
27
|
+
listen "127.0.0.1:<%= port %>"
|
28
|
+
|
29
|
+
pid pid_file
|
30
|
+
|
31
|
+
# Set log file paths
|
32
|
+
stderr_path err_log_file
|
33
|
+
stdout_path log_file
|
34
|
+
|
35
|
+
# http://tech.tulentsev.com/2012/03/deploying-with-sinatra-capistrano-unicorn/
|
36
|
+
# NOTE: http://unicorn.bogomips.org/SIGNALS.html
|
37
|
+
preload_app true
|
38
|
+
|
39
|
+
# make sure that Bundler finds the Gemfile
|
40
|
+
before_exec do |server|
|
41
|
+
ENV['BUNDLE_GEMFILE'] = File.join( rails_root, 'Gemfile' )
|
42
|
+
end
|
43
|
+
|
44
|
+
before_fork do |server, worker|
|
45
|
+
# при использовании preload_app = true здесь должно быть закрытие всех открытых сокетов
|
46
|
+
|
47
|
+
# Mongoid сам заботится о переконнекте
|
48
|
+
# http://two.mongoid.org/docs/upgrading.html
|
49
|
+
|
50
|
+
# http://stackoverflow.com/a/9498372/2041969
|
51
|
+
# убиваем параллельный старый-процесс просле старта нового
|
52
|
+
if File.exists?( old_pid_file )
|
53
|
+
begin
|
54
|
+
Process.kill( "QUIT", File.read( old_pid_file ).to_i )
|
55
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
56
|
+
puts "Old master alerady dead"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
after_fork do |server, worker|
|
62
|
+
# pid-ы дочерних процессов
|
63
|
+
child_pid_file = server.config[:pid].sub(".pid", ".#{worker.nr}.pid")
|
64
|
+
system("echo #{Process.pid} > #{child_pid_file}")
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# shamelessly stolen from https://github.com/sferik/rails_admin/blob/master/lib/generators/rails_admin/utils.rb
|
2
|
+
|
3
|
+
module RocketCms
|
4
|
+
module Generators
|
5
|
+
module Utils
|
6
|
+
module InstanceMethods
|
7
|
+
def display(output, color = :green)
|
8
|
+
say(" - #{output}", color)
|
9
|
+
end
|
10
|
+
|
11
|
+
def ask_for(wording, default_value = nil, override_if_present_value = nil)
|
12
|
+
if override_if_present_value.present?
|
13
|
+
display("Using [#{override_if_present_value}] for question '#{wording}'") && override_if_present_value
|
14
|
+
else
|
15
|
+
ask(" ? #{wording} Press <enter> for [#{default_value}] >", :yellow).presence || default_value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
data/lib/manual_slug.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module ManualSlug::ActiveRecord
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
extend FriendlyId
|
6
|
+
end
|
7
|
+
|
8
|
+
def text_slug
|
9
|
+
slug
|
10
|
+
end
|
11
|
+
def text_slug=(s)
|
12
|
+
self.slug = s
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
def manual_slug(field, options = {}, callback = true)
|
17
|
+
friendly_id field, use: [:slugged, :finders]
|
18
|
+
define_method(:should_generate_new_friendly_id?) do
|
19
|
+
slug.blank?
|
20
|
+
end
|
21
|
+
|
22
|
+
skip_callback :validation, :before, :set_slug
|
23
|
+
before_validation do
|
24
|
+
if self.slug.blank?
|
25
|
+
self.send(:set_slug)
|
26
|
+
end
|
27
|
+
true
|
28
|
+
end if callback
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ManualSlug::Mongoid
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
include ::Mongoid::Slug
|
4
|
+
|
5
|
+
def text_slug
|
6
|
+
self._slugs.empty? ? '' : self._slugs.last
|
7
|
+
end
|
8
|
+
def text_slug=(slug)
|
9
|
+
if slug.blank?
|
10
|
+
self._slugs = []
|
11
|
+
else
|
12
|
+
self._slugs.delete(slug)
|
13
|
+
self._slugs << slug
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module ClassMethods
|
18
|
+
def manual_slug(field, options = {}, callback = true)
|
19
|
+
options.merge!(permanent: true, history: true)
|
20
|
+
slug field, options
|
21
|
+
|
22
|
+
# we will create slugs manually when needed
|
23
|
+
skip_callback :create, :before, :build_slug
|
24
|
+
|
25
|
+
before_validation do
|
26
|
+
self._slugs = self._slugs.map{ |s| s.strip }.reject {|s| s.blank? } if self._slugs
|
27
|
+
|
28
|
+
if self._slugs.blank?
|
29
|
+
self.build_slug
|
30
|
+
end
|
31
|
+
|
32
|
+
true
|
33
|
+
end if callback
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RailsAdmin
|
2
|
+
module Config
|
3
|
+
module Actions
|
4
|
+
class CustomShowInApp < RailsAdmin::Config::Actions::Base
|
5
|
+
RailsAdmin::Config::Actions.register(self)
|
6
|
+
|
7
|
+
register_instance_option :member do
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
register_instance_option :visible? do
|
12
|
+
authorized? && (bindings[:controller].main_app.url_for(bindings[:object]) rescue false)
|
13
|
+
end
|
14
|
+
|
15
|
+
register_instance_option :controller do
|
16
|
+
Proc.new do
|
17
|
+
if @object.class.name == 'Page'
|
18
|
+
redirect_to main_app.page_url(@object)
|
19
|
+
elsif @object.class.name == 'News'
|
20
|
+
redirect_to main_app.news_url(@object)
|
21
|
+
elsif @object.class.name == 'Obj'
|
22
|
+
redirect_to main_app.object_url(@object.category, @object)
|
23
|
+
else
|
24
|
+
redirect_to main_app.url_for(@object)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
register_instance_option :link_icon do
|
30
|
+
'icon-eye-open'
|
31
|
+
end
|
32
|
+
|
33
|
+
register_instance_option :pjax? do
|
34
|
+
false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/rocket_cms.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
unless defined?(RocketCMS) && RocketCMS.respond_to?(:orm) && [:active_record, :mongoid].include?(RocketCMS.orm)
|
2
|
+
puts "please use rocket_cms_mongoid or rocket_cms_activerecord and not rocket_cms directly"
|
3
|
+
exit 1
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'rocket_cms/version'
|
7
|
+
require 'devise'
|
8
|
+
|
9
|
+
require 'simple_form'
|
10
|
+
require 'rocket_cms/simple_form_patch'
|
11
|
+
|
12
|
+
require 'glebtv-simple_captcha'
|
13
|
+
require 'validates_email_format_of'
|
14
|
+
require 'smart_excerpt'
|
15
|
+
require 'filename_to_slug'
|
16
|
+
require 'rails_admin'
|
17
|
+
require 'rails_admin_nested_set'
|
18
|
+
require 'rails_admin_toggleable'
|
19
|
+
# require 'rails_admin_settings'
|
20
|
+
|
21
|
+
require 'x-real-ip'
|
22
|
+
|
23
|
+
require 'glebtv-ckeditor'
|
24
|
+
|
25
|
+
require 'sitemap_generator'
|
26
|
+
require 'kaminari'
|
27
|
+
require 'addressable/uri'
|
28
|
+
require 'turbolinks'
|
29
|
+
require 'simple-navigation'
|
30
|
+
|
31
|
+
require 'rocket_cms/configuration'
|
32
|
+
require 'rocket_cms/patch'
|
33
|
+
require 'rocket_cms/admin'
|
34
|
+
require 'rocket_cms/elastic_search'
|
35
|
+
require 'rocket_cms/model'
|
36
|
+
require 'rocket_cms/rails_admin_menu'
|
37
|
+
require 'rocket_cms/engine'
|
38
|
+
require 'rocket_cms/controller'
|
39
|
+
|
40
|
+
module RocketCMS
|
41
|
+
class << self
|
42
|
+
def mongoid?
|
43
|
+
RocketCMS.orm == :mongoid
|
44
|
+
end
|
45
|
+
def active_record?
|
46
|
+
RocketCMS.orm == :active_record
|
47
|
+
end
|
48
|
+
def model_namespace
|
49
|
+
"RocketCMS::Models::#{RocketCMS.orm.to_s.camelize}"
|
50
|
+
end
|
51
|
+
def orm_specific(name)
|
52
|
+
"#{model_namespace}::#{name}".constantize
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
autoload :Migration, 'rocket_cms/migration'
|
57
|
+
|
58
|
+
module Models
|
59
|
+
autoload :Menu, 'rocket_cms/models/menu'
|
60
|
+
autoload :Page, 'rocket_cms/models/page'
|
61
|
+
autoload :News, 'rocket_cms/models/news'
|
62
|
+
autoload :ContactMessage, 'rocket_cms/models/contact_message'
|
63
|
+
|
64
|
+
module Mongoid
|
65
|
+
autoload :Menu, 'rocket_cms/models/mongoid/menu'
|
66
|
+
autoload :Page, 'rocket_cms/models/mongoid/page'
|
67
|
+
autoload :News, 'rocket_cms/models/mongoid/news'
|
68
|
+
autoload :ContactMessage, 'rocket_cms/models/mongoid/contact_message'
|
69
|
+
end
|
70
|
+
|
71
|
+
module ActiveRecord
|
72
|
+
autoload :Menu, 'rocket_cms/models/active_record/menu'
|
73
|
+
autoload :Page, 'rocket_cms/models/active_record/page'
|
74
|
+
autoload :News, 'rocket_cms/models/active_record/news'
|
75
|
+
autoload :ContactMessage, 'rocket_cms/models/active_record/contact_message'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
module Controllers
|
80
|
+
autoload :Contacts, 'rocket_cms/controllers/contacts'
|
81
|
+
autoload :News, 'rocket_cms/controllers/news'
|
82
|
+
autoload :Pages, 'rocket_cms/controllers/pages'
|
83
|
+
autoload :Search, 'rocket_cms/controllers/search'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
require 'manual_slug'
|
88
|
+
|
@@ -0,0 +1,152 @@
|
|
1
|
+
module RocketCMS
|
2
|
+
class << self
|
3
|
+
def map_config(is_active = true)
|
4
|
+
Proc.new {
|
5
|
+
active is_active
|
6
|
+
label I18n.t('rs.map')
|
7
|
+
field :address, :string
|
8
|
+
field :map_address, :string
|
9
|
+
field :map_hint, :string
|
10
|
+
field :coordinates, :string do
|
11
|
+
read_only true
|
12
|
+
formatted_value{ bindings[:object].coordinates.to_json }
|
13
|
+
end
|
14
|
+
field :lat
|
15
|
+
field :lon
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def seo_config(is_active = false)
|
20
|
+
Proc.new {
|
21
|
+
active is_active
|
22
|
+
label "SEO"
|
23
|
+
field :h1, :string
|
24
|
+
field :title, :string
|
25
|
+
field :keywords, :text
|
26
|
+
field :description, :text
|
27
|
+
field :robots, :string
|
28
|
+
|
29
|
+
field :og_title, :string
|
30
|
+
field :og_image
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def page_config
|
35
|
+
Proc.new {
|
36
|
+
RocketCMS.apply_patches self
|
37
|
+
navigation_label I18n.t('rs.cms')
|
38
|
+
list do
|
39
|
+
scopes [:sorted, :enabled, nil]
|
40
|
+
|
41
|
+
field :enabled, :toggle
|
42
|
+
field :menus, :menu
|
43
|
+
field :name
|
44
|
+
field :fullpath do
|
45
|
+
pretty_value do
|
46
|
+
bindings[:view].content_tag(:a, bindings[:object].fullpath, href: bindings[:object].fullpath)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
field :redirect
|
50
|
+
field :slug
|
51
|
+
RocketCMS.apply_patches self
|
52
|
+
end
|
53
|
+
edit do
|
54
|
+
field :name
|
55
|
+
field :excerpt, :ck_editor
|
56
|
+
field :content, :ck_editor
|
57
|
+
RocketCMS.apply_patches self
|
58
|
+
group :menu do
|
59
|
+
label I18n.t('rs.menu')
|
60
|
+
field :menus
|
61
|
+
field :fullpath, :string do
|
62
|
+
help I18n.t('rs.with_final_slash')
|
63
|
+
end
|
64
|
+
field :regexp, :string do
|
65
|
+
help I18n.t('rs.page_url_regex')
|
66
|
+
end
|
67
|
+
field :redirect, :string do
|
68
|
+
help I18n.t('rs.final_in_menu')
|
69
|
+
end
|
70
|
+
field :text_slug
|
71
|
+
end
|
72
|
+
group :seo, &RocketCMS.seo_config
|
73
|
+
group :sitemap_data, &RocketCMS.sitemap_data_config
|
74
|
+
end
|
75
|
+
RocketCMS.only_patches self, [:show, :export]
|
76
|
+
nested_set({
|
77
|
+
max_depth: RocketCMS.configuration.menu_max_depth
|
78
|
+
})
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def menu_config
|
83
|
+
Proc.new {
|
84
|
+
navigation_label 'CMS'
|
85
|
+
|
86
|
+
field :enabled, :toggle
|
87
|
+
field :text_slug
|
88
|
+
field :name
|
89
|
+
RocketCMS.apply_patches self
|
90
|
+
RocketCMS.only_patches self, [:show, :list, :edit, :export]
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
def contact_message_config
|
95
|
+
Proc.new {
|
96
|
+
navigation_label I18n.t('rs.settings')
|
97
|
+
field :created_at do
|
98
|
+
read_only true
|
99
|
+
end
|
100
|
+
field :name
|
101
|
+
field :content, :text
|
102
|
+
field :email
|
103
|
+
field :phone
|
104
|
+
|
105
|
+
RocketCMS.apply_patches self
|
106
|
+
RocketCMS.only_patches self, [:show, :list, :edit, :export]
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def news_config
|
111
|
+
Proc.new {
|
112
|
+
navigation_label I18n.t('rs.cms')
|
113
|
+
list do
|
114
|
+
scopes [:by_date, :enabled, nil]
|
115
|
+
end
|
116
|
+
|
117
|
+
field :enabled, :toggle
|
118
|
+
field :time
|
119
|
+
field :name
|
120
|
+
unless RocketCMS.configuration.news_image_styles.nil?
|
121
|
+
field :image
|
122
|
+
end
|
123
|
+
field :excerpt
|
124
|
+
RocketCMS.apply_patches self
|
125
|
+
|
126
|
+
edit do
|
127
|
+
field :content, :ck_editor
|
128
|
+
RocketCMS.apply_patches self
|
129
|
+
group :seo, &RocketCMS.seo_config
|
130
|
+
group :sitemap_data, &RocketCMS.sitemap_data_config
|
131
|
+
end
|
132
|
+
|
133
|
+
RocketCMS.only_patches self, [:show, :list, :export]
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def sitemap_data_config(is_active = false)
|
138
|
+
Proc.new {
|
139
|
+
active is_active
|
140
|
+
label I18n.t('rs.sitemap_data')
|
141
|
+
field :sitemap_show
|
142
|
+
field :sitemap_lastmod
|
143
|
+
field :sitemap_changefreq, :enum do
|
144
|
+
enum do
|
145
|
+
SitemapData::SITEMAP_CHANGEFREQ_ARRAY
|
146
|
+
end
|
147
|
+
end
|
148
|
+
field :sitemap_priority
|
149
|
+
}
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|