enjoy_cms 0.1.0.beta1
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/Gemfile +5 -0
- data/Gemfile.lock +249 -0
- data/LICENSE.txt +22 -0
- data/README.md +137 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/enjoy_cms.coffee +6 -0
- data/app/assets/javascripts/enjoy_cms/flash.js.coffee +3 -0
- data/app/assets/javascripts/enjoy_cms/map.js.coffee +22 -0
- data/app/assets/javascripts/head.load.js +707 -0
- data/app/assets/javascripts/jquery.placeholder.js +157 -0
- data/app/assets/stylesheets/enjoy_cms.sass +5 -0
- data/app/assets/stylesheets/enjoy_cms/flash.sass +63 -0
- data/app/assets/stylesheets/enjoy_cms/normalize.scss +406 -0
- data/app/assets/stylesheets/enjoy_cms/powered.sass +18 -0
- data/app/controllers/concerns/enjoy/errors.rb +93 -0
- data/app/controllers/concerns/enjoy/fancybox.rb +14 -0
- data/app/controllers/concerns/enjoy/localizeable.rb +33 -0
- data/app/controllers/concerns/enjoy/nav_menu.rb +64 -0
- data/app/controllers/concerns/enjoy/no_cache.rb +12 -0
- data/app/controllers/concerns/enjoy/seo_pages.rb +83 -0
- data/app/controllers/enjoy/contacts_controller.rb +5 -0
- data/app/controllers/enjoy/home_controller.rb +6 -0
- data/app/controllers/enjoy/news_controller.rb +5 -0
- data/app/controllers/enjoy/pages_controller.rb +5 -0
- data/app/controllers/enjoy/search_controller.rb +6 -0
- data/app/helpers/enjoy/gzip_helper.rb +27 -0
- data/app/helpers/enjoy/powered_helper.rb +12 -0
- data/app/mailers/enjoy/contact_mailer.rb +17 -0
- data/app/models/concerns/enjoy/boolean_field.rb +17 -0
- data/app/models/concerns/enjoy/enableable.rb +8 -0
- data/app/models/concerns/enjoy/geocodeable.rb +4 -0
- data/app/models/concerns/enjoy/mappable.rb +95 -0
- data/app/models/concerns/enjoy/mongoid_paperclip.rb +37 -0
- data/app/models/concerns/enjoy/seoable.rb +36 -0
- data/app/models/concerns/enjoy/sitemap_data.rb +23 -0
- data/app/models/concerns/enjoy/sort_field.rb +20 -0
- data/app/models/concerns/enjoy/sortable.rb +8 -0
- data/app/models/enjoy/contact_message.rb +12 -0
- data/app/models/enjoy/embedded_element.rb +15 -0
- data/app/models/enjoy/embedded_gallery_image.rb +15 -0
- data/app/models/enjoy/gallery.rb +10 -0
- data/app/models/enjoy/gallery_image.rb +10 -0
- data/app/models/enjoy/menu.rb +12 -0
- data/app/models/enjoy/news.rb +12 -0
- data/app/models/enjoy/page.rb +12 -0
- data/app/models/enjoy/seo.rb +13 -0
- data/app/views/blocks/_favicon.html.slim +21 -0
- data/app/views/blocks/_footer.html.slim +1 -0
- data/app/views/blocks/_seo_block.html.slim +18 -0
- data/app/views/blocks/_seo_block_with_obj.html.slim +27 -0
- data/app/views/devise/registrations/edit.html.slim +21 -0
- data/app/views/devise/registrations/new.html.slim +21 -0
- data/app/views/devise/sessions/new.html.slim +22 -0
- data/app/views/devise/shared/_links.html.slim +11 -0
- data/app/views/enjoy/contact_mailer/new_message_email.html.slim +15 -0
- data/app/views/enjoy/contacts/index.html.slim +10 -0
- data/app/views/enjoy/contacts/new.html.slim +10 -0
- data/app/views/enjoy/contacts/sent.html.slim +4 -0
- data/app/views/enjoy/home/index.html.slim +1 -0
- data/app/views/enjoy/news/index.html.slim +9 -0
- data/app/views/enjoy/news/show.html.slim +8 -0
- data/app/views/enjoy/pages/show.html.slim +1 -0
- data/app/views/enjoy/search/index.html.slim +19 -0
- data/app/views/errors/_base.html.slim +3 -0
- data/app/views/errors/error_403.html.slim +1 -0
- data/app/views/errors/error_404.html.slim +1 -0
- data/app/views/errors/error_500.html.slim +1 -0
- data/app/views/layouts/application.html.slim +25 -0
- data/app/views/rails_admin/main/_check_boxes.html.slim +27 -0
- data/app/views/rails_admin/main/_enum_check_boxes.html.slim +5 -0
- data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +5 -0
- data/app/views/rails_admin/main/_form_raw.html.slim +1 -0
- data/app/views/shared/_admin_link.html.slim +3 -0
- data/app/views/shared/_messages.html.slim +7 -0
- data/app/views/shared/_meta.html.slim +19 -0
- data/app/views/shared/_obj.html.slim +21 -0
- data/app/views/shared/_og.html.slim +4 -0
- data/app/views/simple_captcha/_simple_captcha.html.slim +12 -0
- data/config/initializers/simple_captcha.rb +29 -0
- data/config/locales/en.enjoy.yml +29 -0
- data/config/locales/en.enjoy_admin.yml +6 -0
- data/config/locales/ru.cancan.yml +4 -0
- data/config/locales/ru.devise.yml +65 -0
- data/config/locales/ru.enjoy.yml +39 -0
- data/config/locales/ru.enjoy_admin.yml +6 -0
- data/config/locales/ru.kaminari.yml +17 -0
- data/config/locales/ru.models.yml +103 -0
- data/config/locales/ru.mongoid.yml +450 -0
- data/config/locales/ru.rails_admin.yml +148 -0
- data/config/locales/ru.simple_captcha.yml +3 -0
- data/config/locales/ru.simple_form.yml +9 -0
- data/config/routes.rb +14 -0
- data/enjoy_cms.gemspec +53 -0
- data/lib/enjoy/admin.rb +350 -0
- data/lib/enjoy/admin/contact_message.rb +36 -0
- data/lib/enjoy/admin/embedded_element.rb +11 -0
- data/lib/enjoy/admin/embedded_gallery_image.rb +15 -0
- data/lib/enjoy/admin/gallery.rb +20 -0
- data/lib/enjoy/admin/gallery_image.rb +18 -0
- data/lib/enjoy/admin/menu.rb +27 -0
- data/lib/enjoy/admin/news.rb +57 -0
- data/lib/enjoy/admin/page.rb +81 -0
- data/lib/enjoy/admin/seo.rb +17 -0
- data/lib/enjoy/configuration.rb +73 -0
- data/lib/enjoy/controller.rb +31 -0
- data/lib/enjoy/controllers/contacts.rb +70 -0
- data/lib/enjoy/controllers/news.rb +36 -0
- data/lib/enjoy/controllers/pages.rb +22 -0
- data/lib/enjoy/controllers/search.rb +62 -0
- data/lib/enjoy/elastic_search.rb +31 -0
- data/lib/enjoy/engine.rb +46 -0
- data/lib/enjoy/migration.rb +34 -0
- data/lib/enjoy/model.rb +22 -0
- data/lib/enjoy/models/active_record/contact_message.rb +14 -0
- data/lib/enjoy/models/active_record/menu.rb +17 -0
- data/lib/enjoy/models/active_record/news.rb +26 -0
- data/lib/enjoy/models/active_record/page.rb +20 -0
- data/lib/enjoy/models/active_record/seo.rb +17 -0
- data/lib/enjoy/models/contact_message.rb +37 -0
- data/lib/enjoy/models/embedded_element.rb +12 -0
- data/lib/enjoy/models/embedded_gallery_image.rb +16 -0
- data/lib/enjoy/models/gallery.rb +29 -0
- data/lib/enjoy/models/gallery_image.rb +23 -0
- data/lib/enjoy/models/menu.rb +28 -0
- data/lib/enjoy/models/mongoid/contact_message.rb +20 -0
- data/lib/enjoy/models/mongoid/embedded_element.rb +13 -0
- data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +19 -0
- data/lib/enjoy/models/mongoid/gallery.rb +23 -0
- data/lib/enjoy/models/mongoid/gallery_image.rb +21 -0
- data/lib/enjoy/models/mongoid/menu.rb +15 -0
- data/lib/enjoy/models/mongoid/news.rb +29 -0
- data/lib/enjoy/models/mongoid/page.rb +25 -0
- data/lib/enjoy/models/mongoid/seo.rb +28 -0
- data/lib/enjoy/models/news.rb +58 -0
- data/lib/enjoy/models/page.rb +90 -0
- data/lib/enjoy/models/seo.rb +22 -0
- data/lib/enjoy/patch.rb +58 -0
- data/lib/enjoy/rails_admin_menu.rb +145 -0
- data/lib/enjoy/simple_form_patch.rb +12 -0
- data/lib/enjoy/tasks.rb +13 -0
- data/lib/enjoy/version.rb +3 -0
- data/lib/enjoy_cms.rb +109 -0
- data/lib/filename_to_slug.rb +34 -0
- data/lib/generators/enjoy/ability_generator.rb +14 -0
- data/lib/generators/enjoy/admin_generator.rb +21 -0
- data/lib/generators/enjoy/capify_generator.rb +39 -0
- data/lib/generators/enjoy/layout_generator.rb +14 -0
- data/lib/generators/enjoy/migration_generator.rb +18 -0
- data/lib/generators/enjoy/templates/Capfile +17 -0
- data/lib/generators/enjoy/templates/ability.erb +26 -0
- data/lib/generators/enjoy/templates/admin.erb +89 -0
- data/lib/generators/enjoy/templates/deploy.erb +47 -0
- data/lib/generators/enjoy/templates/dl.erb +30 -0
- data/lib/generators/enjoy/templates/migration_contact_messages.rb +15 -0
- data/lib/generators/enjoy/templates/migration_news.rb +26 -0
- data/lib/generators/enjoy/templates/migration_pages.rb +45 -0
- data/lib/generators/enjoy/templates/migration_seos.rb +14 -0
- data/lib/generators/enjoy/templates/production.erb +8 -0
- data/lib/generators/enjoy/templates/unicorn.erb +66 -0
- data/lib/generators/enjoy/utils.rb +21 -0
- data/lib/manual_slug.rb +10 -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 +43 -0
- data/release.sh +13 -0
- data/template.rb +824 -0
- metadata +579 -0
@@ -0,0 +1,148 @@
|
|
1
|
+
# Russian. Updated 2012-07-18
|
2
|
+
|
3
|
+
ru:
|
4
|
+
admin:
|
5
|
+
home:
|
6
|
+
name: "Главная"
|
7
|
+
pagination:
|
8
|
+
previous: "« Предыдущая"
|
9
|
+
next: "Следующая »"
|
10
|
+
truncate: "…"
|
11
|
+
misc:
|
12
|
+
filter_date_format: "dd.mm.yyyy"
|
13
|
+
search: "Поиск"
|
14
|
+
filter: "Фильтрация"
|
15
|
+
refresh: "Обновить"
|
16
|
+
show_all: "Показать все"
|
17
|
+
add_filter: "Добавить фильтр..."
|
18
|
+
bulk_menu_title: "Выбранные элементы..."
|
19
|
+
remove: "Убрать"
|
20
|
+
add_new: "Добавить новый"
|
21
|
+
chosen: "Выбрать %{name}"
|
22
|
+
chose_all: "Выбрать все"
|
23
|
+
clear_all: "Убрать выделение"
|
24
|
+
up: "Вверх"
|
25
|
+
down: "Вниз"
|
26
|
+
navigation: "Навигация"
|
27
|
+
log_out: "Выйти"
|
28
|
+
ago: "назад"
|
29
|
+
flash:
|
30
|
+
successful: "%{name} был %{action}"
|
31
|
+
error: "Не получилось %{action} %{name}"
|
32
|
+
noaction: "Никаких изменений не выполнено"
|
33
|
+
model_not_found: "Модель '%{model}' не найден"
|
34
|
+
object_not_found: "Объект %{model} с id '%{id}' не найден"
|
35
|
+
table_headers:
|
36
|
+
items: "Элементы"
|
37
|
+
model_name: "Название модели"
|
38
|
+
last_used: "Последний раз использовалось"
|
39
|
+
records: "Записи"
|
40
|
+
username: "Пользователь"
|
41
|
+
changes: "Изменения"
|
42
|
+
created_at: "Дата/Время"
|
43
|
+
item: "Элемент"
|
44
|
+
message: "Сообщение"
|
45
|
+
actions:
|
46
|
+
nestable:
|
47
|
+
title: "Сортировка %{model_label}"
|
48
|
+
menu: "Сортировать"
|
49
|
+
breadcrumb: "Сортировка"
|
50
|
+
link: "Сортировать"
|
51
|
+
bulk_link: "Сортировка выбранных %{model_label_plural}"
|
52
|
+
done: "Сохранено"
|
53
|
+
success: "Успешно"
|
54
|
+
error: "Ошибка"
|
55
|
+
social_auth:
|
56
|
+
menu: Авторизовать
|
57
|
+
|
58
|
+
dashboard:
|
59
|
+
title: "Управление сайтом"
|
60
|
+
menu: "Контрольная панель"
|
61
|
+
breadcrumb: "панель"
|
62
|
+
index:
|
63
|
+
title: "Список %{model_label_plural}"
|
64
|
+
menu: "Список"
|
65
|
+
breadcrumb: "%{model_label_plural}"
|
66
|
+
show:
|
67
|
+
title: "Детали %{model_label} '%{object_label}'"
|
68
|
+
menu: "Просмотр"
|
69
|
+
breadcrumb: "%{object_label}"
|
70
|
+
show_in_app:
|
71
|
+
menu: "Показать в приложении"
|
72
|
+
new:
|
73
|
+
title: "Новый %{model_label}"
|
74
|
+
menu: "Создание"
|
75
|
+
breadcrumb: "новый"
|
76
|
+
link: "Добавить новый %{model_label}"
|
77
|
+
done: "создано"
|
78
|
+
edit:
|
79
|
+
title: "Редактирование %{model_label} '%{object_label}'"
|
80
|
+
menu: "Редактирование"
|
81
|
+
breadcrumb: "редактирование"
|
82
|
+
link: "Редактировать %{model_label}"
|
83
|
+
done: "сохранено"
|
84
|
+
delete:
|
85
|
+
title: "Удаление %{model_label} '%{object_label}'"
|
86
|
+
menu: "Удаление"
|
87
|
+
breadcrumb: "удаление"
|
88
|
+
link: "Удалить '%{object_label}'"
|
89
|
+
done: "удалено"
|
90
|
+
bulk_delete:
|
91
|
+
title: "Удалить много %{model_label_plural}"
|
92
|
+
menu: "Мульти-удаление"
|
93
|
+
breadcrumb: "мульти-удаление"
|
94
|
+
bulk_link: "Удалить выбранные %{model_label_plural}"
|
95
|
+
export:
|
96
|
+
title: "Экспорт %{model_label}"
|
97
|
+
menu: "Экспорт"
|
98
|
+
breadcrumb: "экспорт"
|
99
|
+
link: "Экспорт найденных %{model_label_plural}"
|
100
|
+
bulk_link: "Экспорт выбраных %{model_label_plural}"
|
101
|
+
done: "экспортировано"
|
102
|
+
history_index:
|
103
|
+
title: "История для %{model_label_plural}"
|
104
|
+
menu: "История"
|
105
|
+
breadcrumb: "история"
|
106
|
+
history_show:
|
107
|
+
title: "История для %{model_label} '%{object_label}'"
|
108
|
+
menu: "История"
|
109
|
+
breadcrumb: "история"
|
110
|
+
show_in_app:
|
111
|
+
title: 'В приложении'
|
112
|
+
menu: "Показать на сайте"
|
113
|
+
form:
|
114
|
+
cancel: "Отмена"
|
115
|
+
basic_info: "Основное"
|
116
|
+
required: "Требуемое"
|
117
|
+
optional: "Необязательное"
|
118
|
+
one_char: "символ"
|
119
|
+
char_length_up_to: "длина не более"
|
120
|
+
char_length_of: "длина"
|
121
|
+
save: "Сохранить"
|
122
|
+
save_and_add_another: "Сохранить и добавить ещё"
|
123
|
+
save_and_edit: "Сохранить и остаться"
|
124
|
+
all_of_the_following_related_items_will_be_deleted: "Следующие объекты будут удалены:"
|
125
|
+
are_you_sure_you_want_to_delete_the_object: "Вы уверены что хотите удалить %{model_name}"
|
126
|
+
confirmation: "Да, уверен"
|
127
|
+
delete_confirmation: "Подтвердить удаление"
|
128
|
+
bulk_delete: "Следующие объекты будут удалены, что может сломать связи с другими объектами:"
|
129
|
+
new_model: "Новый"
|
130
|
+
export:
|
131
|
+
confirmation: "Экспортировать как %{name}"
|
132
|
+
select: "Выберите поля для экспорта"
|
133
|
+
fields_from: "Поля из %{name}"
|
134
|
+
fields_from_associated: "Поля из ассоциированной %{name}"
|
135
|
+
display: "Показать %{name}: %{type}"
|
136
|
+
options_for: "Настройки для %{name}"
|
137
|
+
empty_value_for_associated_objects: "<пусто>"
|
138
|
+
click_to_reverse_selection: 'Обратить выделение'
|
139
|
+
csv:
|
140
|
+
header_for_root_methods: "%{name}" # 'model' is available
|
141
|
+
header_for_association_methods: "%{name} [%{association}]"
|
142
|
+
encoding_to: "Декодировать как"
|
143
|
+
encoding_to_help: "Выберите результирующую кодировку. Оставьте пустой, чтобы оставить исходную кодировку нетронутой: (%{name})"
|
144
|
+
skip_header: "Без заголовка"
|
145
|
+
skip_header_help: "Не выводить заголовок (без описаний полей)"
|
146
|
+
default_col_sep: ","
|
147
|
+
col_sep: "Разделитель столбцов"
|
148
|
+
col_sep_help: "Оставьте пустым, чтобы было по умолчанию ('%{value}')" # value is default_col_sep
|
data/config/routes.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Enjoy::Engine.routes.draw do
|
2
|
+
get 'contacts' => 'contacts#new', as: :contacts
|
3
|
+
post 'contacts' => 'contacts#create', as: :create_contacts
|
4
|
+
get 'contacts/sent' => 'contacts#sent', as: :contacts_sent
|
5
|
+
|
6
|
+
get 'search' => 'search#index', as: :search
|
7
|
+
|
8
|
+
resources :news, only: [:index, :show]
|
9
|
+
|
10
|
+
root to: 'home#index'
|
11
|
+
|
12
|
+
get '*slug' => 'pages#show'
|
13
|
+
resources :pages, only: [:show]
|
14
|
+
end
|
data/enjoy_cms.gemspec
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'enjoy/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'enjoy_cms'
|
7
|
+
spec.version = Enjoy::VERSION
|
8
|
+
spec.authors = ['Alexander Kiseliev']
|
9
|
+
spec.email = ["dev@enjoycreate.ru"]
|
10
|
+
spec.description = %q{EnjoyCMS }
|
11
|
+
spec.summary = %q{Please DO NOT use this gem directly, use enjoy_cms_mongoid or enjoy_cms_activerecord instead!}
|
12
|
+
spec.homepage = 'https://github.com/enjoycreative/enjoy_cms'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/).reject {|f| f.start_with?('mongoid') || f.start_with?('activerecord') }
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
|
23
|
+
spec.add_dependency 'rails', '4.2.4' #'~> 5.0.0.beta1'
|
24
|
+
|
25
|
+
spec.add_dependency 'jquery-rails'
|
26
|
+
spec.add_dependency 'simple_form'
|
27
|
+
spec.add_dependency 'glebtv-simple_captcha'
|
28
|
+
spec.add_dependency 'coffee-rails'
|
29
|
+
spec.add_dependency 'devise'
|
30
|
+
spec.add_dependency 'turbolinks'
|
31
|
+
spec.add_dependency 'validates_email_format_of'
|
32
|
+
spec.add_dependency 'rails_admin'
|
33
|
+
spec.add_dependency 'rails_admin_nested_set'
|
34
|
+
spec.add_dependency 'rails_admin_toggleable'
|
35
|
+
|
36
|
+
spec.add_dependency 'ckeditor'
|
37
|
+
spec.add_dependency 'rails_admin_settings'
|
38
|
+
|
39
|
+
spec.add_dependency 'geocoder'
|
40
|
+
spec.add_dependency 'simple-navigation'
|
41
|
+
spec.add_dependency 'sitemap_generator'
|
42
|
+
spec.add_dependency 'kaminari'
|
43
|
+
spec.add_dependency 'addressable'
|
44
|
+
|
45
|
+
spec.add_dependency 'x-real-ip'
|
46
|
+
|
47
|
+
spec.add_dependency "rails_admin_mongoid_localize_field"
|
48
|
+
spec.add_dependency "ack_rails_admin_jcrop"
|
49
|
+
|
50
|
+
spec.add_dependency 'stringex'
|
51
|
+
spec.add_dependency 'thor'
|
52
|
+
spec.add_dependency 'smart_excerpt'
|
53
|
+
end
|
data/lib/enjoy/admin.rb
ADDED
@@ -0,0 +1,350 @@
|
|
1
|
+
module Enjoy
|
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
|
+
if block_given?
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def seo_config(is_active = true)
|
24
|
+
Proc.new {
|
25
|
+
if respond_to?(:active)
|
26
|
+
active is_active
|
27
|
+
label "SEO"
|
28
|
+
else
|
29
|
+
visible false
|
30
|
+
end
|
31
|
+
Enjoy.seo_fields(self)
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def seo_fields(s)
|
36
|
+
s.instance_eval do
|
37
|
+
field :h1, :string
|
38
|
+
field :title, :string
|
39
|
+
field :keywords, :text
|
40
|
+
field :description, :text
|
41
|
+
field :robots, :string
|
42
|
+
|
43
|
+
field :og_title, :string
|
44
|
+
|
45
|
+
field :og_image, :jcrop do
|
46
|
+
jcrop_options :og_image_jcrop_options
|
47
|
+
end
|
48
|
+
|
49
|
+
if block_given?
|
50
|
+
yield
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def page_config(fields = {})
|
56
|
+
Proc.new {
|
57
|
+
Enjoy.apply_patches self
|
58
|
+
# navigation_label I18n.t('enjoy.cms')
|
59
|
+
list do
|
60
|
+
scopes [:sorted, :enabled, nil]
|
61
|
+
|
62
|
+
field :enabled, :toggle
|
63
|
+
field :menus, :menu
|
64
|
+
field :name
|
65
|
+
field :fullpath do
|
66
|
+
pretty_value do
|
67
|
+
bindings[:view].content_tag(:a, bindings[:object].fullpath, href: bindings[:object].fullpath)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
field :redirect
|
71
|
+
field :slug
|
72
|
+
Enjoy.apply_patches self
|
73
|
+
end
|
74
|
+
edit do
|
75
|
+
field :name
|
76
|
+
field :excerpt, :ck_editor
|
77
|
+
field :content, :ck_editor
|
78
|
+
Enjoy.apply_patches self
|
79
|
+
group :menu do
|
80
|
+
label I18n.t('rs.menu')
|
81
|
+
field :menus
|
82
|
+
field :fullpath, :string do
|
83
|
+
help I18n.t('rs.with_final_slash')
|
84
|
+
end
|
85
|
+
field :regexp, :string do
|
86
|
+
help I18n.t('rs.page_url_regex')
|
87
|
+
end
|
88
|
+
field :redirect, :string do
|
89
|
+
help I18n.t('rs.final_in_menu')
|
90
|
+
end
|
91
|
+
field :text_slug
|
92
|
+
end
|
93
|
+
fields.each_pair do |name, type|
|
94
|
+
if type.nil?
|
95
|
+
field name
|
96
|
+
else
|
97
|
+
if type.is_a?(Array)
|
98
|
+
field name, type[0], &type[1]
|
99
|
+
else
|
100
|
+
field name, type
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
group :seo do
|
105
|
+
active true
|
106
|
+
field :seo do
|
107
|
+
active true
|
108
|
+
end
|
109
|
+
end
|
110
|
+
group :sitemap_data, &Enjoy.sitemap_data_config
|
111
|
+
end
|
112
|
+
Enjoy.only_patches self, [:show, :export]
|
113
|
+
nested_set({
|
114
|
+
max_depth: Enjoy.config.menu_max_depth,
|
115
|
+
scopes: []
|
116
|
+
})
|
117
|
+
|
118
|
+
if block_given?
|
119
|
+
yield
|
120
|
+
end
|
121
|
+
}
|
122
|
+
end
|
123
|
+
|
124
|
+
def menu_config
|
125
|
+
Proc.new {
|
126
|
+
# navigation_label 'CMS'
|
127
|
+
|
128
|
+
field :enabled, :toggle
|
129
|
+
field :text_slug
|
130
|
+
field :name
|
131
|
+
Enjoy.apply_patches self
|
132
|
+
Enjoy.only_patches self, [:show, :list, :edit, :export]
|
133
|
+
|
134
|
+
if block_given?
|
135
|
+
yield
|
136
|
+
end
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def contact_message_config
|
141
|
+
Proc.new {
|
142
|
+
# navigation_label I18n.t('rs.settings')
|
143
|
+
field :c_at do
|
144
|
+
read_only true
|
145
|
+
end
|
146
|
+
field :name
|
147
|
+
field :content, :text
|
148
|
+
field :email
|
149
|
+
field :phone
|
150
|
+
|
151
|
+
Enjoy.config.contacts_fields.each_pair do |fn, ft|
|
152
|
+
next if ft.nil?
|
153
|
+
if ft.is_a?(Array)
|
154
|
+
field fn, ft[1].to_sym
|
155
|
+
else
|
156
|
+
field fn
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
if block_given?
|
161
|
+
yield
|
162
|
+
end
|
163
|
+
|
164
|
+
Enjoy.apply_patches self
|
165
|
+
Enjoy.only_patches self, [:show, :list, :edit, :export]
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
169
|
+
def news_config(fields = {})
|
170
|
+
Proc.new {
|
171
|
+
# navigation_label I18n.t('enjoy.cms')
|
172
|
+
list do
|
173
|
+
scopes [:by_date, :enabled, nil]
|
174
|
+
end
|
175
|
+
|
176
|
+
field :enabled, :toggle
|
177
|
+
field :time do
|
178
|
+
sort_reverse true
|
179
|
+
end
|
180
|
+
field :name
|
181
|
+
unless Enjoy.config.news_image_styles.nil?
|
182
|
+
field :image, :jcrop do
|
183
|
+
jcrop_options :image_jcrop_options
|
184
|
+
end
|
185
|
+
end
|
186
|
+
field :excerpt, :ck_editor
|
187
|
+
field :slugs, :enum do
|
188
|
+
enum_method do
|
189
|
+
:slugs
|
190
|
+
end
|
191
|
+
visible do
|
192
|
+
bindings[:view].current_user.admin?
|
193
|
+
end
|
194
|
+
multiple do
|
195
|
+
true
|
196
|
+
end
|
197
|
+
end
|
198
|
+
field :text_slug
|
199
|
+
|
200
|
+
Enjoy.apply_patches self
|
201
|
+
|
202
|
+
list do
|
203
|
+
Enjoy.apply_patches self
|
204
|
+
sort_by :time
|
205
|
+
end
|
206
|
+
|
207
|
+
edit do
|
208
|
+
field :content, :ck_editor
|
209
|
+
fields.each_pair do |name, type|
|
210
|
+
if type.nil?
|
211
|
+
field name
|
212
|
+
else
|
213
|
+
if type.is_a?(Array)
|
214
|
+
field name, type[0], &type[1]
|
215
|
+
else
|
216
|
+
field name, type
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
Enjoy.apply_patches self
|
221
|
+
group :seo, &Enjoy.seo_config
|
222
|
+
group :sitemap_data, &Enjoy.sitemap_data_config
|
223
|
+
end
|
224
|
+
|
225
|
+
Enjoy.only_patches self, [:show, :list, :export]
|
226
|
+
|
227
|
+
if block_given?
|
228
|
+
yield(self)
|
229
|
+
end
|
230
|
+
}
|
231
|
+
end
|
232
|
+
|
233
|
+
def sitemap_data_config(is_active = false)
|
234
|
+
Proc.new {
|
235
|
+
active is_active
|
236
|
+
label I18n.t('rs.sitemap_data')
|
237
|
+
field :sitemap_show
|
238
|
+
field :sitemap_lastmod
|
239
|
+
field :sitemap_changefreq, :enum do
|
240
|
+
enum do
|
241
|
+
SitemapData::SITEMAP_CHANGEFREQ_ARRAY
|
242
|
+
end
|
243
|
+
end
|
244
|
+
field :sitemap_priority
|
245
|
+
|
246
|
+
if block_given?
|
247
|
+
yield
|
248
|
+
end
|
249
|
+
}
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
def embedded_element_config(_navigation_label = I18n.t('enjoy.cms'), fields = {})
|
255
|
+
Proc.new {
|
256
|
+
# navigation_label(_navigation_label) unless _navigation_label.nil?
|
257
|
+
field :enabled, :toggle
|
258
|
+
field :name, :string
|
259
|
+
fields.each_pair do |name, type|
|
260
|
+
if type.nil?
|
261
|
+
field name
|
262
|
+
else
|
263
|
+
if type.is_a?(Array)
|
264
|
+
field name, type[0], &type[1]
|
265
|
+
else
|
266
|
+
field name, type
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
if block_given?
|
272
|
+
yield
|
273
|
+
end
|
274
|
+
}
|
275
|
+
end
|
276
|
+
|
277
|
+
def embedded_image_config(fields = {})
|
278
|
+
jcrop_proc = Proc.new do
|
279
|
+
jcrop_options :image_jcrop_options
|
280
|
+
end
|
281
|
+
|
282
|
+
if block_given?
|
283
|
+
Enjoy.embedded_element_config(
|
284
|
+
nil,
|
285
|
+
{image: [:jcrop, jcrop_proc]}.merge(fields),
|
286
|
+
yield
|
287
|
+
)
|
288
|
+
else
|
289
|
+
Enjoy.embedded_element_config(
|
290
|
+
nil,
|
291
|
+
{image: [:jcrop, jcrop_proc]}.merge(fields)
|
292
|
+
)
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def gallery_config
|
297
|
+
Proc.new {
|
298
|
+
# navigation_label I18n.t('rs.gallery')
|
299
|
+
field :enabled, :toggle
|
300
|
+
|
301
|
+
field :name, :string
|
302
|
+
field :slugs, :enum do
|
303
|
+
enum_method do
|
304
|
+
:slugs
|
305
|
+
end
|
306
|
+
visible do
|
307
|
+
bindings[:view].current_user.admin?
|
308
|
+
end
|
309
|
+
multiple do
|
310
|
+
true
|
311
|
+
end
|
312
|
+
end
|
313
|
+
field :text_slug
|
314
|
+
|
315
|
+
field :image, :jcrop do
|
316
|
+
jcrop_options :image_jcrop_options
|
317
|
+
end
|
318
|
+
|
319
|
+
if block_given?
|
320
|
+
yield
|
321
|
+
end
|
322
|
+
}
|
323
|
+
end
|
324
|
+
|
325
|
+
def image_config(without_gallery = false, fields = {})
|
326
|
+
Proc.new {
|
327
|
+
# navigation_label I18n.t('rs.gallery')
|
328
|
+
field :enabled, :toggle
|
329
|
+
unless without_gallery
|
330
|
+
field :gallery
|
331
|
+
end
|
332
|
+
field :name, :string
|
333
|
+
field :image, :jcrop do
|
334
|
+
jcrop_options :image_jcrop_options
|
335
|
+
end
|
336
|
+
fields.each_pair do |name, type|
|
337
|
+
if type.nil?
|
338
|
+
field name
|
339
|
+
else
|
340
|
+
field name, type
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
if block_given?
|
345
|
+
yield
|
346
|
+
end
|
347
|
+
}
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|