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.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile.lock +62 -111
  5. data/app/assets/javascripts/{enjoy_cms → enjoy/cms}/flash.coffee +0 -0
  6. data/app/assets/javascripts/enjoy/cms/init.coffee +1 -0
  7. data/app/assets/javascripts/{enjoy_cms → enjoy/cms}/map.coffee +0 -0
  8. data/app/assets/javascripts/enjoy/cms.coffee +11 -0
  9. data/app/assets/javascripts/enjoy/rails_admin/cms.ui.coffee +26 -0
  10. data/app/assets/javascripts/{enjoy_cms → enjoy}/rails_admin/custom/ui.coffee +0 -0
  11. data/app/assets/javascripts/rails_admin/custom/ui.coffee +2 -2
  12. data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/flash.sass +0 -0
  13. data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/normalize.scss +0 -0
  14. data/app/assets/stylesheets/{enjoy_cms → enjoy/cms}/powered.sass +0 -0
  15. data/app/assets/stylesheets/{enjoy_cms.sass → enjoy/cms.sass} +3 -1
  16. data/app/assets/stylesheets/enjoy/rails_admin/cms.ui.sass +117 -0
  17. data/{lib/enjoy/controllers/sitemap_data.rb → app/assets/stylesheets/enjoy/rails_admin/custom/ui.sass} +0 -0
  18. data/app/assets/stylesheets/rails_admin/custom/theming.sass +2 -0
  19. data/app/controllers/concerns/enjoy/errors.rb +1 -1
  20. data/app/controllers/enjoy/registrations_controller.rb +20 -0
  21. data/app/controllers/enjoy/sessions_controller.rb +19 -0
  22. data/app/helpers/enjoy/home_helper.rb +2 -0
  23. data/app/helpers/enjoy/powered_helper.rb +1 -1
  24. data/app/models/concerns/enjoy/html_field.rb +3 -0
  25. data/app/views/blocks/_favicon.html.slim +60 -21
  26. data/app/views/devise/registrations/edit.html.slim +2 -2
  27. data/app/views/devise/registrations/new.html.slim +9 -3
  28. data/app/views/devise/sessions/new.html.slim +8 -2
  29. data/app/views/devise/shared/_links.html.slim +4 -4
  30. data/app/views/{errors → enjoy/errors}/_base.html.slim +0 -0
  31. data/app/views/{errors → enjoy/errors}/error_403.html.slim +0 -0
  32. data/app/views/{errors → enjoy/errors}/error_404.html.slim +0 -0
  33. data/app/views/{errors → enjoy/errors}/error_500.html.slim +0 -0
  34. data/app/views/{simple_captcha → enjoy/simple_captcha}/_simple_captcha.html.slim +0 -0
  35. data/app/views/layouts/application.html.slim +8 -4
  36. data/app/views/layouts/enjoy/devise/confirmations.html.slim +27 -0
  37. data/app/views/layouts/enjoy/devise/passwords.html.slim +27 -0
  38. data/app/views/layouts/enjoy/devise/registrations.html.slim +27 -0
  39. data/app/views/layouts/enjoy/devise/sessions.html.slim +27 -0
  40. data/app/views/layouts/enjoy/devise/unlocks.html.slim +27 -0
  41. data/app/views/rails_admin/main/_setting_value.html.haml +104 -0
  42. data/app/views/shared/_messages.html.slim +1 -1
  43. data/config/initializers/simple_captcha.rb +29 -20
  44. data/config/locales/en.enjoy.yml +1 -1
  45. data/config/locales/ru.enjoy.yml +0 -7
  46. data/config/locales/ru.models.yml +2 -39
  47. data/enjoy_cms.gemspec +7 -20
  48. data/lib/enjoy/configuration.rb +24 -40
  49. data/lib/enjoy/controller.rb +5 -3
  50. data/lib/enjoy/engine.rb +28 -28
  51. data/lib/enjoy/migration.rb +0 -19
  52. data/lib/enjoy/model.rb +5 -2
  53. data/lib/enjoy/rails_admin_ext/config.rb +112 -0
  54. data/lib/enjoy/rails_admin_ext/enjoy_hash.rb +0 -2
  55. data/lib/enjoy/rails_admin_ext/enjoy_slugs.rb +31 -0
  56. data/lib/enjoy/rails_admin_ext/group_patch.rb +2 -1
  57. data/lib/enjoy/rails_admin_settings_patch.rb +7 -0
  58. data/lib/enjoy/routes.rb +1 -26
  59. data/lib/enjoy/version.rb +1 -1
  60. data/lib/enjoy_cms.rb +25 -71
  61. data/lib/filename_to_slug.rb +20 -22
  62. data/lib/generators/enjoy/{ability_generator.rb → cms/ability_generator.rb} +3 -3
  63. data/lib/generators/enjoy/{admin_generator.rb → cms/admin_generator.rb} +2 -2
  64. data/lib/generators/enjoy/cms/application_generator.rb +14 -0
  65. data/lib/generators/enjoy/cms/assets_generator.rb +35 -0
  66. data/lib/generators/enjoy/{config/install_generator.rb → cms/config_generator.rb} +3 -3
  67. data/lib/generators/enjoy/cms/gemfile_generator.rb +13 -0
  68. data/lib/generators/enjoy/{layout_generator.rb → cms/layout_generator.rb} +2 -2
  69. data/lib/generators/enjoy/cms/paperclip_optimizer_generator.rb +13 -0
  70. data/lib/generators/enjoy/cms/rack_generator.rb +12 -0
  71. data/lib/generators/enjoy/cms/robots_generator.rb +12 -0
  72. data/lib/generators/enjoy/cms/scripts_generator.rb +25 -0
  73. data/lib/generators/enjoy/cms/templates/Gemfile.erb +69 -0
  74. data/lib/generators/enjoy/cms/templates/ability.erb +45 -0
  75. data/lib/generators/enjoy/{templates → cms/templates}/admin.erb +5 -26
  76. data/lib/generators/enjoy/cms/templates/application.erb +42 -0
  77. data/lib/generators/enjoy/cms/templates/assets/javascripts/application.coffee.erb +1 -0
  78. data/lib/generators/enjoy/cms/templates/assets/stylesheets/application.sass.erb +15 -0
  79. data/lib/generators/enjoy/cms/templates/assets/stylesheets/enjoy/rails_admin/custom/ui.sass.erb +106 -0
  80. data/lib/generators/enjoy/cms/templates/enjoy_cms.erb +28 -0
  81. data/lib/generators/enjoy/cms/templates/paperclip_optimizer.erb +80 -0
  82. data/lib/generators/enjoy/cms/templates/rack.erb +15 -0
  83. data/lib/generators/enjoy/cms/templates/robots.txt.erb +4 -0
  84. data/lib/generators/enjoy/cms/templates/scripts/assets_precompile.sh +3 -0
  85. data/lib/generators/enjoy/cms/templates/scripts/bundle_production.sh +4 -0
  86. data/lib/generators/enjoy/cms/templates/scripts/db_dump.sh.erb +3 -0
  87. data/lib/generators/enjoy/cms/templates/scripts/db_restore.sh +3 -0
  88. data/lib/generators/enjoy/cms/templates/scripts/full_assets_precompile.sh +4 -0
  89. data/lib/generators/enjoy/cms/templates/scripts/restart_thru_kill.sh +3 -0
  90. data/lib/generators/enjoy/cms/templates/scripts/send_hup.sh +3 -0
  91. data/lib/generators/enjoy/cms/templates/scripts/send_usr2.sh +3 -0
  92. data/lib/generators/enjoy/cms/templates/unicorn.erb +57 -0
  93. data/lib/generators/enjoy/cms/templates/unicorn.god.erb +59 -0
  94. data/lib/generators/enjoy/cms/unicorn_god_generator.rb +15 -0
  95. data/lib/generators/enjoy/{utils.rb → cms/utils.rb} +1 -1
  96. data/lib/rails_admin/custom_show_in_app.rb +13 -13
  97. data/template.rb +197 -543
  98. metadata +73 -325
  99. data/app/assets/javascripts/enjoy_cms/contacts.coffee +0 -11
  100. data/app/assets/javascripts/enjoy_cms/rails_admin/cms.ui.coffee +0 -6
  101. data/app/assets/javascripts/enjoy_cms.coffee +0 -7
  102. data/app/controllers/concerns/enjoy/blocksetable.rb +0 -37
  103. data/app/controllers/concerns/enjoy/decorators/contacts.rb +0 -5
  104. data/app/controllers/concerns/enjoy/decorators/news.rb +0 -5
  105. data/app/controllers/concerns/enjoy/decorators/pages.rb +0 -5
  106. data/app/controllers/concerns/enjoy/decorators/search.rb +0 -5
  107. data/app/controllers/concerns/enjoy/nav_menu.rb +0 -91
  108. data/app/controllers/concerns/enjoy/seo_pages.rb +0 -90
  109. data/app/controllers/enjoy/contacts_controller.rb +0 -7
  110. data/app/controllers/enjoy/news_controller.rb +0 -7
  111. data/app/controllers/enjoy/pages_controller.rb +0 -7
  112. data/app/controllers/enjoy/search_controller.rb +0 -8
  113. data/app/mailers/enjoy/contact_mailer.rb +0 -17
  114. data/app/models/concerns/enjoy/connectable.rb +0 -36
  115. data/app/models/concerns/enjoy/decorators/contact_message.rb +0 -5
  116. data/app/models/concerns/enjoy/decorators/embedded_gallery_image.rb +0 -5
  117. data/app/models/concerns/enjoy/decorators/gallery.rb +0 -5
  118. data/app/models/concerns/enjoy/decorators/gallery_image.rb +0 -5
  119. data/app/models/concerns/enjoy/decorators/menu.rb +0 -5
  120. data/app/models/concerns/enjoy/decorators/news.rb +0 -5
  121. data/app/models/concerns/enjoy/decorators/page.rb +0 -5
  122. data/app/models/concerns/enjoy/decorators/page_block.rb +0 -5
  123. data/app/models/concerns/enjoy/decorators/page_blockset.rb +0 -5
  124. data/app/models/concerns/enjoy/decorators/seo.rb +0 -5
  125. data/app/models/concerns/enjoy/decorators/sitemap_data.rb +0 -5
  126. data/app/models/concerns/enjoy/mongoid_paperclip.rb +0 -51
  127. data/app/models/concerns/enjoy/seoable.rb +0 -36
  128. data/app/models/concerns/enjoy/sitemap_data_field.rb +0 -17
  129. data/app/models/enjoy/contact_message.rb +0 -16
  130. data/app/models/enjoy/embedded_gallery_image.rb +0 -16
  131. data/app/models/enjoy/gallery.rb +0 -13
  132. data/app/models/enjoy/gallery_image.rb +0 -13
  133. data/app/models/enjoy/menu.rb +0 -16
  134. data/app/models/enjoy/news.rb +0 -16
  135. data/app/models/enjoy/page.rb +0 -16
  136. data/app/models/enjoy/page_block.rb +0 -13
  137. data/app/models/enjoy/page_blockset.rb +0 -13
  138. data/app/models/enjoy/seo.rb +0 -16
  139. data/app/models/enjoy/sitemap_data.rb +0 -16
  140. data/app/views/enjoy/contact_mailer/new_message_email.html.slim +0 -15
  141. data/app/views/enjoy/contacts/_form.html.slim +0 -7
  142. data/app/views/enjoy/contacts/_form_with_wrapper.html.slim +0 -2
  143. data/app/views/enjoy/contacts/_success.html.slim +0 -3
  144. data/app/views/enjoy/contacts/index.html.slim +0 -4
  145. data/app/views/enjoy/contacts/new.html.slim +0 -4
  146. data/app/views/enjoy/contacts/sent.html.slim +0 -3
  147. data/app/views/enjoy/news/index.html.slim +0 -9
  148. data/app/views/enjoy/news/show.html.slim +0 -8
  149. data/app/views/enjoy/pages/show.html.slim +0 -1
  150. data/app/views/enjoy/search/index.html.slim +0 -19
  151. data/app/views/rails_admin/main/_enjoy_connectable.html.slim +0 -56
  152. data/config/locales/ru.kaminari.yml +0 -17
  153. data/config/locales/ru.simple_captcha.yml +0 -3
  154. data/config/locales/ru.simple_form.yml +0 -9
  155. data/lib/enjoy/admin/contact_message.rb +0 -42
  156. data/lib/enjoy/admin/embedded_gallery_image.rb +0 -38
  157. data/lib/enjoy/admin/gallery.rb +0 -44
  158. data/lib/enjoy/admin/gallery_image.rb +0 -31
  159. data/lib/enjoy/admin/menu.rb +0 -27
  160. data/lib/enjoy/admin/news.rb +0 -89
  161. data/lib/enjoy/admin/page.rb +0 -96
  162. data/lib/enjoy/admin/page_block.rb +0 -49
  163. data/lib/enjoy/admin/page_blockset.rb +0 -50
  164. data/lib/enjoy/admin/seo.rb +0 -41
  165. data/lib/enjoy/admin/sitemap_data.rb +0 -29
  166. data/lib/enjoy/controllers/contacts.rb +0 -86
  167. data/lib/enjoy/controllers/news.rb +0 -36
  168. data/lib/enjoy/controllers/pages.rb +0 -22
  169. data/lib/enjoy/controllers/search.rb +0 -62
  170. data/lib/enjoy/elastic_search.rb +0 -31
  171. data/lib/enjoy/models/active_record/contact_message.rb +0 -14
  172. data/lib/enjoy/models/active_record/menu.rb +0 -17
  173. data/lib/enjoy/models/active_record/news.rb +0 -26
  174. data/lib/enjoy/models/active_record/page.rb +0 -20
  175. data/lib/enjoy/models/active_record/seo.rb +0 -17
  176. data/lib/enjoy/models/active_record/sitemap_data.rb +0 -11
  177. data/lib/enjoy/models/contact_message.rb +0 -41
  178. data/lib/enjoy/models/embedded_gallery_image.rb +0 -13
  179. data/lib/enjoy/models/gallery.rb +0 -21
  180. data/lib/enjoy/models/gallery_image.rb +0 -19
  181. data/lib/enjoy/models/menu.rb +0 -23
  182. data/lib/enjoy/models/mongoid/contact_message.rb +0 -23
  183. data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +0 -24
  184. data/lib/enjoy/models/mongoid/gallery.rb +0 -32
  185. data/lib/enjoy/models/mongoid/gallery_image.rb +0 -29
  186. data/lib/enjoy/models/mongoid/menu.rb +0 -20
  187. data/lib/enjoy/models/mongoid/news.rb +0 -37
  188. data/lib/enjoy/models/mongoid/page.rb +0 -49
  189. data/lib/enjoy/models/mongoid/page_block.rb +0 -56
  190. data/lib/enjoy/models/mongoid/page_blockset.rb +0 -20
  191. data/lib/enjoy/models/mongoid/seo.rb +0 -35
  192. data/lib/enjoy/models/mongoid/sitemap_data.rb +0 -25
  193. data/lib/enjoy/models/news.rb +0 -58
  194. data/lib/enjoy/models/page.rb +0 -92
  195. data/lib/enjoy/models/page_block.rb +0 -22
  196. data/lib/enjoy/models/page_blockset.rb +0 -24
  197. data/lib/enjoy/models/seo.rb +0 -17
  198. data/lib/enjoy/models/sitemap_data.rb +0 -17
  199. data/lib/enjoy/rails_admin_ext/enjoy_connectable.rb +0 -33
  200. data/lib/enjoy/rails_admin_ext/menu.rb +0 -147
  201. data/lib/generators/enjoy/capify_generator.rb +0 -39
  202. data/lib/generators/enjoy/config/templates/enjoy_cms.erb +0 -27
  203. data/lib/generators/enjoy/migration_generator.rb +0 -18
  204. data/lib/generators/enjoy/templates/Capfile +0 -17
  205. data/lib/generators/enjoy/templates/ability.erb +0 -48
  206. data/lib/generators/enjoy/templates/deploy.erb +0 -47
  207. data/lib/generators/enjoy/templates/dl.erb +0 -30
  208. data/lib/generators/enjoy/templates/migration_contact_messages.rb +0 -15
  209. data/lib/generators/enjoy/templates/migration_news.rb +0 -26
  210. data/lib/generators/enjoy/templates/migration_pages.rb +0 -45
  211. data/lib/generators/enjoy/templates/migration_seos.rb +0 -14
  212. data/lib/generators/enjoy/templates/production.erb +0 -8
  213. data/lib/generators/enjoy/templates/unicorn.erb +0 -66
@@ -1,4 +0,0 @@
1
- = render 'shared/obj', obj: @seo_page
2
-
3
- #enjoy_cms_contact_form
4
- = render partial: "enjoy/contacts/form"
@@ -1,4 +0,0 @@
1
- = render 'shared/obj', obj: @seo_page
2
-
3
- #enjoy_cms_contact_form
4
- = render partial: "enjoy/contacts/form"
@@ -1,3 +0,0 @@
1
- #enjoy_cms_contact_sent
2
- h1 Обратная связь
3
- = render partial: "enjoy/contacts/success"
@@ -1,9 +0,0 @@
1
- .enjoy-news-index
2
- h1= t('enjoy.news')
3
- - @news.each do |news|
4
- .enjoy-news-date= l(news.time.to_date)
5
- = link_to news.name, news, class: "enjoy-news-title", title: news.name
6
- - if !Enjoy.configuration.news_image_styles.nil? && news.image?
7
- .enjoy-news-image= image_tag news.image.url(:thumb)
8
- .enjoy-news-excerpt== news.excerpt
9
- = paginate @news
@@ -1,8 +0,0 @@
1
- .enjoy-news-show
2
- h1.enjoy-news-title= @news.name
3
- .enjoy-news-date= l(@news.time.to_date)
4
- .enjoy-news-text== @news.content
5
- - if !Enjoy.config.news_image_styles.nil? && @news.image?
6
- .enjoy-news-image= image_tag @news.image.url(:main)
7
- .enjoy-news-content
8
- = render 'shared/obj', obj: @news
@@ -1 +0,0 @@
1
- = render 'shared/obj', obj: @seo_page
@@ -1,19 +0,0 @@
1
- .enjoy-search-results
2
- h1 Результаты поиска
3
- = form_tag enjoy_search_path, method: :get, class: 'nav_search' do
4
- = text_field_tag 'query', params[:query], placeholder: "Поиск"
5
- = submit_tag 'Найти'
6
- ol
7
- - any = false
8
- - @results.each do |r|
9
- - any = true
10
- li
11
- .title= link_to (r._highlight.nil? || r._highlight['name'].nil?) ? r.name : r._highlight['name'].join(' ... ').html_safe, url_for(r)
12
- .text
13
- = raw (r._highlight.nil? || r._highlight['content'].nil?) ? (r.content.blank? ? '' : SmartExcerpt.truncate(r.content)) : r._highlight['content'].join(' ... ')
14
- span.more= link_to '', url_for(r)
15
-
16
- - unless any
17
- .enjoy-search-no-results К сожалению, ничего не найдено
18
-
19
- = paginate @results if any
@@ -1,56 +0,0 @@
1
- ruby:
2
- related_id = params[:associations] && params[:associations][field.name.to_s]
3
- config = field.associated_model_config
4
- source_abstract_model = RailsAdmin.config(form.object.class).abstract_model
5
-
6
- if form.object.new_record? && related_id.present? && related_id != 'new'
7
- selected = [config.abstract_model.get(related_id)]
8
- else
9
- selected = form.object.send(field.name)
10
- end
11
- selected_ids = selected.map{|s| s.send(field.associated_primary_key)}
12
-
13
- current_action = params[:action].in?(['create', 'new']) ? 'create' : 'update'
14
-
15
- xhr = !field.associated_collection_cache_all
16
-
17
- collection = if xhr
18
- selected.map { |o| [o.send(field.associated_object_label_method), o.send(field.associated_primary_key)] }
19
- else
20
- i = 0
21
- controller.list_entries(config, :index, field.associated_collection_scope, false).map { |o| [o.send(field.associated_object_label_method), o.send(field.associated_primary_key)] }.sort_by {|a| [selected_ids.index(a[1]) || selected_ids.size, i+=1] }
22
- end
23
-
24
- js_data = {
25
- xhr: xhr,
26
- :'edit-url' => (authorized?(:edit, config.abstract_model) ? edit_path(model_name: config.abstract_model.to_param, id: '__ID__') : ''),
27
- remote_source: index_path(config.abstract_model, source_object_id: form.object.id, source_abstract_model: source_abstract_model.to_param, associated_collection: field.name, current_action: current_action, compact: true),
28
- sortable: !!field.orderable,
29
- removable: !!field.removable,
30
- cacheAll: !!field.associated_collection_cache_all,
31
- regional: {
32
- chooseAll: t("admin.misc.chose_all"),
33
- chosen: t("admin.misc.chosen", name: config.label_plural),
34
- clearAll: t("admin.misc.clear_all"),
35
- search: t("admin.misc.search"),
36
- up: t("admin.misc.up"),
37
- down: t("admin.misc.down")
38
- }
39
- }
40
-
41
- input{name="#{form.dom_name(field)}" type="hidden" value=""}
42
-
43
- - if field.bindings[:object].new_record? and field.bindings[:object].respond_to?(field.autocreate_page_attr)
44
- p
45
- span{style='float: left'}= form.check_box field.autocreate_page_attr, checked: true, class: "form-control"
46
- div{style='margin-left: 35px; line-height: 40px;'} Автоматически создать пункт меню
47
-
48
- - selected_ids = (hdv = field.form_default_value).nil? ? selected_ids : hdv
49
- = form.select field.method_name, collection, { selected: selected_ids, object: form.object }, field.html_attributes.reverse_merge({data: { filteringmultiselect: true, options: js_data.to_json }, multiple: true})
50
- - if authorized?(:new, config.abstract_model) && field.inline_add
51
- - path_hash = { model_name: config.abstract_model.to_param, modal: true }
52
- - path_hash.merge!({ associations: { field.inverse_of => (form.object.persisted? ? form.object.id : 'new') } }) if field.inverse_of
53
- = link_to "<i class=\"icon-plus icon-white\"></i> ".html_safe + wording_for(:link, :new, config.abstract_model), '#', data: { link: new_path(path_hash) }, class: "create btn btn-info", style: 'margin-left:10px'
54
-
55
-
56
-
@@ -1,17 +0,0 @@
1
- ru:
2
- views:
3
- pagination:
4
- first: "&laquo; Начало"
5
- last: "Конец &raquo;"
6
- previous: "&lsaquo; Предыдущая"
7
- next: "Следующая &rsaquo;"
8
- truncate: "&hellip;"
9
- helpers:
10
- page_entries_info:
11
- one_page:
12
- display_entries:
13
- zero: "%{entry_name} не найдены"
14
- one: "Показано <b>1</b> %{entry_name}"
15
- other: "Показаны <b>все %{count}</b> %{entry_name}"
16
- more_pages:
17
- display_entries: "Показаны %{entry_name} <b>%{first}&nbsp;-&nbsp;%{last}</b> из <b>%{total}</b>"
@@ -1,3 +0,0 @@
1
- ru:
2
- simple_captcha:
3
- label: "Введите код с картинки"
@@ -1,9 +0,0 @@
1
- ru:
2
- simple_form:
3
- "yes": 'Да'
4
- "no": 'Нет'
5
- required:
6
- text: 'Обязательное поле'
7
- mark: '*'
8
- error_notification:
9
- default_message: "Пожалуйста, исправьте неточности в заполнении полей"
@@ -1,42 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module ContactMessage
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label I18n.t('enjoy.contact_message')
7
- field :c_at do
8
- read_only true
9
- end
10
- field :name do
11
- searchable true
12
- end
13
- field :content, :text do
14
- searchable true
15
- end
16
- field :email do
17
- searchable true
18
- end
19
- field :phone do
20
- searchable true
21
- end
22
-
23
- Enjoy.config.contacts_fields.each_pair do |fn, ft|
24
- next if ft.nil?
25
- if ft.is_a?(Array)
26
- field fn, ft[1].to_sym
27
- else
28
- field fn
29
- end
30
- end
31
-
32
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
33
-
34
- if block_given?
35
- yield self
36
- end
37
-
38
- }
39
- end
40
- end
41
- end
42
- end
@@ -1,38 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module EmbeddedGalleryImage
4
- def self.config(fields = {})
5
- jcrop_proc = Proc.new do
6
- jcrop_options :image_jcrop_options
7
- end
8
-
9
- if fields
10
- if fields.is_a?(Hash)
11
- fields.reverse_merge!({image: [:jcrop, jcrop_proc]})
12
- else
13
- finded = false
14
- fields.each { |g|
15
- finded = !!g[:fields][:image] unless finded
16
- }
17
- unless finded
18
- fields << {
19
- name: :image,
20
- fields: {
21
- image: [:jcrop, jcrop_proc]
22
- }
23
- }
24
- end
25
- end
26
- end
27
-
28
- if block_given?
29
- Enjoy::Admin::EmbeddedElement.config(nil, fields) do |config|
30
- yield config
31
- end
32
- else
33
- Enjoy::Admin::EmbeddedElement.config(nil, fields)
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,44 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module Gallery
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label I18n.t('enjoy.gallery')
7
- field :enabled, :toggle do
8
- searchable false
9
- end
10
-
11
- field :name, :string do
12
- searchable true
13
- end
14
- group :URL do
15
- active false
16
- searchable true
17
- field :slugs, :enum do
18
- enum_method do
19
- :slugs
20
- end
21
- visible do
22
- bindings[:view].current_user.admin?
23
- end
24
- multiple do
25
- true
26
- end
27
- end
28
- field :text_slug
29
- end
30
-
31
- field :image, :jcrop do
32
- jcrop_options :image_jcrop_options
33
- end
34
-
35
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
36
-
37
- if block_given?
38
- yield self
39
- end
40
- }
41
- end
42
- end
43
- end
44
- end
@@ -1,31 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module GalleryImage
4
- def self.config(without_gallery = false, fields = {})
5
- Proc.new {
6
- # navigation_label I18n.t('enjoy.gallery')
7
- field :enabled, :toggle do
8
- searchable false
9
- end
10
- unless without_gallery
11
- field :gallery do
12
- searchable :name
13
- end
14
- end
15
- field :name, :string do
16
- searchable true
17
- end
18
- field :image, :jcrop do
19
- jcrop_options :image_jcrop_options
20
- end
21
-
22
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
23
-
24
- if block_given?
25
- yield self
26
- end
27
- }
28
- end
29
- end
30
- end
31
- end
@@ -1,27 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module Menu
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label 'CMS'
7
-
8
- field :enabled, :toggle do
9
- searchable false
10
- end
11
- field :text_slug do
12
- searchable true
13
- end
14
- field :name do
15
- searchable true
16
- end
17
-
18
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
19
-
20
- if block_given?
21
- yield self
22
- end
23
- }
24
- end
25
- end
26
- end
27
- end
@@ -1,89 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module News
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label I18n.t('enjoy.cms')
7
- list do
8
- scopes [:by_date, :enabled, nil]
9
- end
10
-
11
- field :enabled, :toggle do
12
- searchable false
13
- end
14
- field :time do
15
- searchable false
16
- sort_reverse true
17
- end
18
- field :name do
19
- searchable true
20
- end
21
- field :connected_pages, :enjoy_connectable
22
- unless Enjoy.config.news_image_styles.nil?
23
- field :image, :jcrop do
24
- jcrop_options :image_jcrop_options
25
- end
26
- end
27
- group :content do
28
- active false
29
- field :excerpt, :enjoy_html do
30
- searchable true
31
- end
32
- # field :excerpt_html, :ck_editor
33
- # field :excerpt_clear, :toggle
34
- end
35
- group :URL do
36
- active false
37
- field :slugs, :enum do
38
- searchable true
39
- enum_method do
40
- :slugs
41
- end
42
- visible do
43
- bindings[:view].current_user.admin?
44
- end
45
- multiple do
46
- true
47
- end
48
- end
49
- field :text_slug do
50
- searchable true
51
- end
52
- end
53
-
54
- list do
55
- sort_by :time
56
- end
57
-
58
- edit do
59
- group :content do
60
- active false
61
- field :content, :enjoy_html
62
- # field :content_html, :ck_editor
63
- # field :content_clear, :toggle
64
- end
65
-
66
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
67
-
68
- group :seo do
69
- active false
70
- field :seo do
71
- active true
72
- end
73
- end
74
- group :sitemap_data do
75
- active false
76
- field :sitemap_data do
77
- active true
78
- end
79
- end
80
- end
81
-
82
- if block_given?
83
- yield self
84
- end
85
- }
86
- end
87
- end
88
- end
89
- end
@@ -1,96 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module Page
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label I18n.t('enjoy.cms')
7
- list do
8
- scopes [:sorted, :enabled, nil]
9
-
10
- field :enabled, :toggle do
11
- searchable false
12
- end
13
- field :menus, :menu do
14
- searchable :name
15
- end
16
- field :name do
17
- searchable true
18
- end
19
- field :connectable do
20
- searchable :name
21
- end
22
- field :fullpath do
23
- searchable true
24
- pretty_value do
25
- bindings[:view].content_tag(:a, bindings[:object].fullpath, href: bindings[:object].fullpath)
26
- end
27
- end
28
- field :redirect do
29
- searchable true
30
- end
31
- field :slug do
32
- searchable true
33
- end
34
- end
35
-
36
- edit do
37
- field :name
38
- field :connectable do
39
- read_only true
40
- end
41
-
42
- group :content do
43
- active false
44
- field :excerpt, :enjoy_html
45
- # field :excerpt_html, :ck_editor
46
- # field :excerpt_clear, :toggle
47
- field :content, :enjoy_html
48
- # field :content_html, :ck_editor
49
- # field :content_clear, :toggle
50
- end
51
-
52
- group :menu do
53
- active false
54
- label I18n.t('enjoy.menu')
55
- field :menus
56
- field :fullpath, :string do
57
- help I18n.t('enjoy.with_final_slash')
58
- end
59
- field :regexp, :string do
60
- help I18n.t('enjoy.page_url_regex')
61
- end
62
- field :redirect, :string do
63
- help I18n.t('enjoy.final_in_menu')
64
- end
65
- field :text_slug
66
- end
67
-
68
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
69
-
70
- group :seo do
71
- active false
72
- field :seo do
73
- active true
74
- end
75
- end
76
- group :sitemap_data do
77
- active false
78
- field :sitemap_data do
79
- active true
80
- end
81
- end
82
- end
83
-
84
- nested_set({
85
- max_depth: Enjoy.config.menu_max_depth,
86
- scopes: []
87
- })
88
-
89
- if block_given?
90
- yield self
91
- end
92
- }
93
- end
94
- end
95
- end
96
- end
@@ -1,49 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module PageBlock
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label 'CMS'
7
-
8
- field :enabled, :toggle do
9
- searchable false
10
- end
11
- field :partial, :toggle do
12
- searchable false
13
- end
14
- field :name do
15
- searchable true
16
- end
17
- field :file_path, :string do
18
- searchable true
19
- end
20
-
21
- field :content, :enjoy_html do
22
- searchable true
23
- end
24
- # field :content_html, :ck_editor
25
- # field :content_clear, :toggle
26
-
27
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
28
-
29
- # field :blocksets do
30
- # read_only true
31
- # help 'Список групп блоков'
32
- #
33
- # pretty_value do
34
- # bindings[:object].blocksets.to_a.map { |bs|
35
- # route = (bindings[:view] || bindings[:controller])
36
- # model_name = bs.rails_admin_model
37
- # route.link_to(bs.name, route.rails_admin.show_path(model_name: model_name, id: bs.id), title: bs.name)
38
- # }.join("<br>").html_safe
39
- # end
40
- # end
41
-
42
- if block_given?
43
- yield self
44
- end
45
- }
46
- end
47
- end
48
- end
49
- end
@@ -1,50 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module PageBlockset
4
- def self.config(fields = {})
5
- Proc.new {
6
- # navigation_label 'CMS'
7
-
8
- field :enabled, :toggle do
9
- searchable false
10
- end
11
- field :text_slug do
12
- searchable true
13
- end
14
- field :name do
15
- searchable true
16
- end
17
-
18
- field :blocks do
19
- searchable :name
20
- end
21
-
22
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
23
-
24
- # field :blocks do
25
- # read_only true
26
- # help 'Список блоков'
27
- #
28
- # pretty_value do
29
- # bindings[:object].blocks.to_a.map { |b|
30
- # route = (bindings[:view] || bindings[:controller])
31
- # model_name = b.rails_admin_model
32
- # route.link_to(b.name, route.rails_admin.show_path(model_name: model_name, id: b.id), title: b.name)
33
- # }.join("<br>").html_safe
34
- # end
35
- # end
36
-
37
- sort_embedded(
38
- {
39
- fields: [:blocks]
40
- }
41
- )
42
-
43
- if block_given?
44
- yield self
45
- end
46
- }
47
- end
48
- end
49
- end
50
- end
@@ -1,41 +0,0 @@
1
- module Enjoy
2
- module Admin
3
- module Seo
4
- def self.config(is_active = true, fields = {})
5
- Proc.new {
6
- navigation_label 'SEO'
7
- field :seoable do
8
- read_only true
9
- end
10
- field :h1, :string do
11
- searchable true
12
- end
13
- field :title, :string do
14
- searchable true
15
- end
16
- field :keywords, :text do
17
- searchable true
18
- end
19
- field :description, :text do
20
- searchable true
21
- end
22
- field :robots, :string
23
-
24
- field :og_title, :string do
25
- searchable true
26
- end
27
-
28
- field :og_image, :jcrop do
29
- jcrop_options :og_image_jcrop_options
30
- end
31
-
32
- Enjoy::RailsAdminGroupPatch::enjoy_cms_group(self, fields)
33
-
34
- if block_given?
35
- yield self
36
- end
37
- }
38
- end
39
- end
40
- end
41
- end