enjoy_cms 0.1.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.lock +249 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +137 -0
  10. data/Rakefile +1 -0
  11. data/app/assets/javascripts/enjoy_cms.coffee +6 -0
  12. data/app/assets/javascripts/enjoy_cms/flash.js.coffee +3 -0
  13. data/app/assets/javascripts/enjoy_cms/map.js.coffee +22 -0
  14. data/app/assets/javascripts/head.load.js +707 -0
  15. data/app/assets/javascripts/jquery.placeholder.js +157 -0
  16. data/app/assets/stylesheets/enjoy_cms.sass +5 -0
  17. data/app/assets/stylesheets/enjoy_cms/flash.sass +63 -0
  18. data/app/assets/stylesheets/enjoy_cms/normalize.scss +406 -0
  19. data/app/assets/stylesheets/enjoy_cms/powered.sass +18 -0
  20. data/app/controllers/concerns/enjoy/errors.rb +93 -0
  21. data/app/controllers/concerns/enjoy/fancybox.rb +14 -0
  22. data/app/controllers/concerns/enjoy/localizeable.rb +33 -0
  23. data/app/controllers/concerns/enjoy/nav_menu.rb +64 -0
  24. data/app/controllers/concerns/enjoy/no_cache.rb +12 -0
  25. data/app/controllers/concerns/enjoy/seo_pages.rb +83 -0
  26. data/app/controllers/enjoy/contacts_controller.rb +5 -0
  27. data/app/controllers/enjoy/home_controller.rb +6 -0
  28. data/app/controllers/enjoy/news_controller.rb +5 -0
  29. data/app/controllers/enjoy/pages_controller.rb +5 -0
  30. data/app/controllers/enjoy/search_controller.rb +6 -0
  31. data/app/helpers/enjoy/gzip_helper.rb +27 -0
  32. data/app/helpers/enjoy/powered_helper.rb +12 -0
  33. data/app/mailers/enjoy/contact_mailer.rb +17 -0
  34. data/app/models/concerns/enjoy/boolean_field.rb +17 -0
  35. data/app/models/concerns/enjoy/enableable.rb +8 -0
  36. data/app/models/concerns/enjoy/geocodeable.rb +4 -0
  37. data/app/models/concerns/enjoy/mappable.rb +95 -0
  38. data/app/models/concerns/enjoy/mongoid_paperclip.rb +37 -0
  39. data/app/models/concerns/enjoy/seoable.rb +36 -0
  40. data/app/models/concerns/enjoy/sitemap_data.rb +23 -0
  41. data/app/models/concerns/enjoy/sort_field.rb +20 -0
  42. data/app/models/concerns/enjoy/sortable.rb +8 -0
  43. data/app/models/enjoy/contact_message.rb +12 -0
  44. data/app/models/enjoy/embedded_element.rb +15 -0
  45. data/app/models/enjoy/embedded_gallery_image.rb +15 -0
  46. data/app/models/enjoy/gallery.rb +10 -0
  47. data/app/models/enjoy/gallery_image.rb +10 -0
  48. data/app/models/enjoy/menu.rb +12 -0
  49. data/app/models/enjoy/news.rb +12 -0
  50. data/app/models/enjoy/page.rb +12 -0
  51. data/app/models/enjoy/seo.rb +13 -0
  52. data/app/views/blocks/_favicon.html.slim +21 -0
  53. data/app/views/blocks/_footer.html.slim +1 -0
  54. data/app/views/blocks/_seo_block.html.slim +18 -0
  55. data/app/views/blocks/_seo_block_with_obj.html.slim +27 -0
  56. data/app/views/devise/registrations/edit.html.slim +21 -0
  57. data/app/views/devise/registrations/new.html.slim +21 -0
  58. data/app/views/devise/sessions/new.html.slim +22 -0
  59. data/app/views/devise/shared/_links.html.slim +11 -0
  60. data/app/views/enjoy/contact_mailer/new_message_email.html.slim +15 -0
  61. data/app/views/enjoy/contacts/index.html.slim +10 -0
  62. data/app/views/enjoy/contacts/new.html.slim +10 -0
  63. data/app/views/enjoy/contacts/sent.html.slim +4 -0
  64. data/app/views/enjoy/home/index.html.slim +1 -0
  65. data/app/views/enjoy/news/index.html.slim +9 -0
  66. data/app/views/enjoy/news/show.html.slim +8 -0
  67. data/app/views/enjoy/pages/show.html.slim +1 -0
  68. data/app/views/enjoy/search/index.html.slim +19 -0
  69. data/app/views/errors/_base.html.slim +3 -0
  70. data/app/views/errors/error_403.html.slim +1 -0
  71. data/app/views/errors/error_404.html.slim +1 -0
  72. data/app/views/errors/error_500.html.slim +1 -0
  73. data/app/views/layouts/application.html.slim +25 -0
  74. data/app/views/rails_admin/main/_check_boxes.html.slim +27 -0
  75. data/app/views/rails_admin/main/_enum_check_boxes.html.slim +5 -0
  76. data/app/views/rails_admin/main/_enum_radio_buttons.html.slim +5 -0
  77. data/app/views/rails_admin/main/_form_raw.html.slim +1 -0
  78. data/app/views/shared/_admin_link.html.slim +3 -0
  79. data/app/views/shared/_messages.html.slim +7 -0
  80. data/app/views/shared/_meta.html.slim +19 -0
  81. data/app/views/shared/_obj.html.slim +21 -0
  82. data/app/views/shared/_og.html.slim +4 -0
  83. data/app/views/simple_captcha/_simple_captcha.html.slim +12 -0
  84. data/config/initializers/simple_captcha.rb +29 -0
  85. data/config/locales/en.enjoy.yml +29 -0
  86. data/config/locales/en.enjoy_admin.yml +6 -0
  87. data/config/locales/ru.cancan.yml +4 -0
  88. data/config/locales/ru.devise.yml +65 -0
  89. data/config/locales/ru.enjoy.yml +39 -0
  90. data/config/locales/ru.enjoy_admin.yml +6 -0
  91. data/config/locales/ru.kaminari.yml +17 -0
  92. data/config/locales/ru.models.yml +103 -0
  93. data/config/locales/ru.mongoid.yml +450 -0
  94. data/config/locales/ru.rails_admin.yml +148 -0
  95. data/config/locales/ru.simple_captcha.yml +3 -0
  96. data/config/locales/ru.simple_form.yml +9 -0
  97. data/config/routes.rb +14 -0
  98. data/enjoy_cms.gemspec +53 -0
  99. data/lib/enjoy/admin.rb +350 -0
  100. data/lib/enjoy/admin/contact_message.rb +36 -0
  101. data/lib/enjoy/admin/embedded_element.rb +11 -0
  102. data/lib/enjoy/admin/embedded_gallery_image.rb +15 -0
  103. data/lib/enjoy/admin/gallery.rb +20 -0
  104. data/lib/enjoy/admin/gallery_image.rb +18 -0
  105. data/lib/enjoy/admin/menu.rb +27 -0
  106. data/lib/enjoy/admin/news.rb +57 -0
  107. data/lib/enjoy/admin/page.rb +81 -0
  108. data/lib/enjoy/admin/seo.rb +17 -0
  109. data/lib/enjoy/configuration.rb +73 -0
  110. data/lib/enjoy/controller.rb +31 -0
  111. data/lib/enjoy/controllers/contacts.rb +70 -0
  112. data/lib/enjoy/controllers/news.rb +36 -0
  113. data/lib/enjoy/controllers/pages.rb +22 -0
  114. data/lib/enjoy/controllers/search.rb +62 -0
  115. data/lib/enjoy/elastic_search.rb +31 -0
  116. data/lib/enjoy/engine.rb +46 -0
  117. data/lib/enjoy/migration.rb +34 -0
  118. data/lib/enjoy/model.rb +22 -0
  119. data/lib/enjoy/models/active_record/contact_message.rb +14 -0
  120. data/lib/enjoy/models/active_record/menu.rb +17 -0
  121. data/lib/enjoy/models/active_record/news.rb +26 -0
  122. data/lib/enjoy/models/active_record/page.rb +20 -0
  123. data/lib/enjoy/models/active_record/seo.rb +17 -0
  124. data/lib/enjoy/models/contact_message.rb +37 -0
  125. data/lib/enjoy/models/embedded_element.rb +12 -0
  126. data/lib/enjoy/models/embedded_gallery_image.rb +16 -0
  127. data/lib/enjoy/models/gallery.rb +29 -0
  128. data/lib/enjoy/models/gallery_image.rb +23 -0
  129. data/lib/enjoy/models/menu.rb +28 -0
  130. data/lib/enjoy/models/mongoid/contact_message.rb +20 -0
  131. data/lib/enjoy/models/mongoid/embedded_element.rb +13 -0
  132. data/lib/enjoy/models/mongoid/embedded_gallery_image.rb +19 -0
  133. data/lib/enjoy/models/mongoid/gallery.rb +23 -0
  134. data/lib/enjoy/models/mongoid/gallery_image.rb +21 -0
  135. data/lib/enjoy/models/mongoid/menu.rb +15 -0
  136. data/lib/enjoy/models/mongoid/news.rb +29 -0
  137. data/lib/enjoy/models/mongoid/page.rb +25 -0
  138. data/lib/enjoy/models/mongoid/seo.rb +28 -0
  139. data/lib/enjoy/models/news.rb +58 -0
  140. data/lib/enjoy/models/page.rb +90 -0
  141. data/lib/enjoy/models/seo.rb +22 -0
  142. data/lib/enjoy/patch.rb +58 -0
  143. data/lib/enjoy/rails_admin_menu.rb +145 -0
  144. data/lib/enjoy/simple_form_patch.rb +12 -0
  145. data/lib/enjoy/tasks.rb +13 -0
  146. data/lib/enjoy/version.rb +3 -0
  147. data/lib/enjoy_cms.rb +109 -0
  148. data/lib/filename_to_slug.rb +34 -0
  149. data/lib/generators/enjoy/ability_generator.rb +14 -0
  150. data/lib/generators/enjoy/admin_generator.rb +21 -0
  151. data/lib/generators/enjoy/capify_generator.rb +39 -0
  152. data/lib/generators/enjoy/layout_generator.rb +14 -0
  153. data/lib/generators/enjoy/migration_generator.rb +18 -0
  154. data/lib/generators/enjoy/templates/Capfile +17 -0
  155. data/lib/generators/enjoy/templates/ability.erb +26 -0
  156. data/lib/generators/enjoy/templates/admin.erb +89 -0
  157. data/lib/generators/enjoy/templates/deploy.erb +47 -0
  158. data/lib/generators/enjoy/templates/dl.erb +30 -0
  159. data/lib/generators/enjoy/templates/migration_contact_messages.rb +15 -0
  160. data/lib/generators/enjoy/templates/migration_news.rb +26 -0
  161. data/lib/generators/enjoy/templates/migration_pages.rb +45 -0
  162. data/lib/generators/enjoy/templates/migration_seos.rb +14 -0
  163. data/lib/generators/enjoy/templates/production.erb +8 -0
  164. data/lib/generators/enjoy/templates/unicorn.erb +66 -0
  165. data/lib/generators/enjoy/utils.rb +21 -0
  166. data/lib/manual_slug.rb +10 -0
  167. data/lib/manual_slug/active_record.rb +32 -0
  168. data/lib/manual_slug/mongoid.rb +36 -0
  169. data/lib/rails_admin/custom_show_in_app.rb +43 -0
  170. data/release.sh +13 -0
  171. data/template.rb +824 -0
  172. metadata +579 -0
@@ -0,0 +1,36 @@
1
+ module Enjoy
2
+ module Admin
3
+ module ContactMessage
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enjoy.orm_specific('ContactMessage')
7
+
8
+ included do
9
+
10
+ apply_simple_captcha message: Enjoy.configuration.contacts_captcha_error_message
11
+
12
+ validates_email_format_of :email, unless: 'email.blank?'
13
+ if Enjoy.config.contacts_message_required
14
+ validates_presence_of :content
15
+ end
16
+ validate do
17
+ if email.blank? && phone.blank?
18
+ errors.add(:email, I18n.t('rs.no_contact_info'))
19
+ end
20
+ end
21
+
22
+ after_create do
23
+ mailer_class.send(mailer_method, self).deliver
24
+ end
25
+
26
+ def mailer_class
27
+ Enjoy::ContactMailer
28
+ end
29
+
30
+ def mailer_method
31
+ :new_message_email
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,11 @@
1
+ module Enjoy
2
+ module Admin
3
+ module EmbeddedElement
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enjoy::Enableable
7
+ include Enjoy::Sortable
8
+ include Enjoy.orm_specific('EmbeddedElement')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Enjoy
2
+ module Admin
3
+ module EmbeddedGalleryImage
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enjoy::Enableable
7
+ include Enjoy::Sortable
8
+ include Enjoy.orm_specific('EmbeddedGalleryImage')
9
+
10
+ included do
11
+ validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ module Enjoy
2
+ module Admin
3
+ module Gallery
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include ManualSlug
7
+ include Enjoy::Enableable
8
+ include Enjoy::SitemapData
9
+ include Enjoy.orm_specific('Gallery')
10
+
11
+ included do
12
+
13
+ has_many :gallery_images, class_name: "Enjoy::GalleryImage"
14
+ field :name, type: String, localize: Enjoy.configuration.localize
15
+
16
+ validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module Enjoy
2
+ module Admin
3
+ module GalleryImage
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enableable
7
+ include Enjoy.orm_specific('GalleryImage')
8
+
9
+ included do
10
+
11
+ belongs_to :gallery, class_name: "Enjoy::Gallery"
12
+ field :name, type: String, localize: Enjoy.configuration.localize
13
+
14
+ validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ module Enjoy
2
+ module Admin
3
+ module Menu
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enableable
7
+ include ManualSlug
8
+ include Enjoy.orm_specific('Menu')
9
+
10
+ included do
11
+
12
+ field :name, type: String
13
+ manual_slug :name
14
+
15
+ after_save do
16
+ Rails.cache.delete 'menus'
17
+ end
18
+ after_destroy do
19
+ Rails.cache.delete 'menus'
20
+ end
21
+
22
+ has_and_belongs_to_many :pages, inverse_of: :menus, class_name: "Enjoy::Page"
23
+ alias_method :items, :pages
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,57 @@
1
+ module Enjoy
2
+ module Admin
3
+ module News
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Seoable
7
+ include Enableable
8
+ include ManualSlug
9
+ include SitemapData
10
+ include Enjoy.orm_specific('News')
11
+
12
+ if Enjoy.config.search_enabled
13
+ include Enjoy::ElasticSearch
14
+ end
15
+
16
+ included do
17
+
18
+ unless Enjoy.config.news_image_styles.nil?
19
+ validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
20
+ end
21
+
22
+ validates_presence_of :name
23
+ if Enjoy.config.news_content_required
24
+ validates_presence_of :content
25
+ end
26
+
27
+ before_validation do
28
+ self.time = Time.now if self.time.blank?
29
+ end
30
+ scope :recent, ->(count = 5) { enabled.after_now.by_date.limit(count) }
31
+ unless Enjoy.config.news_per_page.nil?
32
+ paginates_per Enjoy.config.news_per_page
33
+ end
34
+ smart_excerpt :excerpt, :content, Enjoy.config.news_excerpt
35
+ manual_slug :report_slug
36
+
37
+ Enjoy.apply_patches self
38
+ end
39
+
40
+ def report_slug
41
+ if time.blank?
42
+ name
43
+ elsif name.blank?
44
+ time.strftime('%Y-%m-%d')
45
+ else
46
+ time.strftime('%Y-%m-%d') + '-' + name[0..20]
47
+ end
48
+ end
49
+ def html5_date
50
+ time.strftime('%Y-%m-%d')
51
+ end
52
+ def format_date
53
+ time.strftime(I18n.t('rs.format_time'))
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,81 @@
1
+ module Enjoy
2
+ module Admin
3
+ module Page
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enableable
7
+ include Seoable
8
+ include ManualSlug
9
+ include SitemapData
10
+
11
+ include Enjoy.orm_specific('Page')
12
+
13
+ if Enjoy.config.search_enabled
14
+ include Enjoy::ElasticSearch
15
+ end
16
+
17
+ included do
18
+
19
+ has_and_belongs_to_many :menus, inverse_of: :pages, class_name: "Enjoy::Menu"
20
+ validates_uniqueness_of :fullpath
21
+ validates_presence_of :name
22
+ manual_slug :name
23
+ before_validation do
24
+ self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
25
+ end
26
+ end
27
+
28
+ def get_fullpath
29
+ redirect.blank? ? fullpath : redirect
30
+ end
31
+
32
+ def has_content?
33
+ @content_used.nil? && !content.blank?
34
+ end
35
+
36
+ def page_content
37
+ if @content_used.nil?
38
+ @content_used = true
39
+ if content.nil?
40
+ ''
41
+ else
42
+ content.gsub(/\{\{(.*?)\}\}/) do
43
+ Settings ? Settings.get($1).val : "" #temp
44
+ end
45
+ end
46
+ else
47
+ ''
48
+ end
49
+ end
50
+
51
+ def is_current?(url)
52
+ if fullpath == '/'
53
+ url == '/'
54
+ else
55
+ url.match(clean_regexp)
56
+ end
57
+ end
58
+
59
+ def regexp_prefix
60
+ ""
61
+ end
62
+
63
+ def clean_regexp
64
+ if regexp.blank?
65
+ /^#{regexp_prefix}#{Regexp.escape(fullpath)}$/
66
+ else
67
+ begin
68
+ /#{regexp}/
69
+ rescue
70
+ # not a valid regexp - treat as literal search string
71
+ /#{Regexp.escape(regexp)}/
72
+ end
73
+ end
74
+ end
75
+
76
+ def nav_options
77
+ {highlights_on: clean_regexp}
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,17 @@
1
+ module Enjoy
2
+ module Admin
3
+ module Seo
4
+ extend ActiveSupport::Concern
5
+ include Enjoy::Model
6
+ include Enableable
7
+ include Enjoy.orm_specific('Seo')
8
+ include Enjoy::SeoHelpers
9
+
10
+ included do
11
+
12
+ Enjoy.apply_patches self
13
+ validates_attachment_content_type :og_image, content_type: /\Aimage\/.*\Z/, if: :og_image?
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,73 @@
1
+ module Enjoy
2
+ def self.configuration
3
+ @configuration ||= Configuration.new
4
+ end
5
+ def self.config
6
+ @configuration ||= Configuration.new
7
+ end
8
+
9
+ def self.configure
10
+ yield configuration
11
+ end
12
+
13
+ class Configuration
14
+ attr_accessor :news_image_styles
15
+ attr_accessor :news_per_page
16
+ attr_accessor :news_excerpt
17
+ attr_accessor :news_content_required
18
+
19
+ attr_accessor :error_layout
20
+ attr_accessor :menu_max_depth
21
+
22
+ attr_accessor :search_enabled
23
+ attr_accessor :search_per_page
24
+ attr_accessor :search_models
25
+
26
+ attr_accessor :contacts_captcha
27
+ attr_accessor :contacts_fields
28
+ attr_accessor :contacts_message_required
29
+ attr_accessor :contacts_captcha_error_message
30
+
31
+ attr_accessor :separate_seo_table
32
+
33
+ attr_accessor :localize
34
+
35
+ attr_accessor :recreate_contact_message_action
36
+
37
+ def initialize
38
+ @news_image_styles = {
39
+ main: '400x200>',
40
+ thumb: '200x100>',
41
+ }
42
+ @news_per_page = 10
43
+ @news_excerpt = 12
44
+ @news_content_required = true
45
+
46
+ @error_layout = 'application'
47
+ @menu_max_depth = 2
48
+
49
+ @search_enabled = false
50
+ @search_per_page = 10
51
+ @search_models = []
52
+
53
+ @contacts_captcha = false
54
+ @contacts_fields = {}
55
+ @contacts_message_required = true
56
+
57
+ @contacts_captcha_error_message = "Код проверки введен неверно"
58
+ @recreate_contact_message_action = "new"
59
+
60
+ @localize = false
61
+
62
+ @separate_seo_table = false
63
+ end
64
+
65
+ def search_enabled=(val)
66
+ @search_enabled = val
67
+ if @search_enabled
68
+ @search_models << 'Page'
69
+ @search_models << 'News'
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,31 @@
1
+ module Enjoy::Controller
2
+ extend ActiveSupport::Concern
3
+ included do
4
+ include Enjoy::Errors
5
+ include Enjoy::SeoPages
6
+ include Enjoy::NavMenu
7
+ include Enjoy::Fancybox
8
+ protect_from_forgery with: :exception
9
+ helper_method :page_title
10
+ end
11
+
12
+ protected
13
+
14
+ def page_title
15
+ if @seo_page.nil?
16
+ Settings ? Settings.default_title : "" #temp
17
+ else
18
+ @seo_page.page_title
19
+ end
20
+ end
21
+
22
+ def ckeditor_authenticate
23
+ redirect_to '/' unless user_signed_in? && current_user.has_role?('admin')
24
+ end
25
+
26
+
27
+ def hide_ym_ga
28
+ false
29
+ end
30
+ helper_method :hide_ym_ga
31
+ end
@@ -0,0 +1,70 @@
1
+ module Enjoy
2
+ module Controllers
3
+ module Contacts
4
+ extend ActiveSupport::Concern
5
+ def index
6
+ @contact_message = model.new
7
+ after_initialize
8
+ end
9
+
10
+ def new
11
+ @contact_message = model.new
12
+ after_initialize
13
+ end
14
+
15
+ def create
16
+ @contact_message = model.new(message_params)
17
+ after_initialize
18
+ if Enjoy.config.contacts_captcha
19
+ meth = :save_with_captcha
20
+ else
21
+ meth = :save
22
+ end
23
+ if @contact_message.send(meth)
24
+ after_create
25
+ if request.xhr? && process_ajax
26
+ ajax_success
27
+ else
28
+ redirect_after_done
29
+ end
30
+ else
31
+ render_contacts_error
32
+ end
33
+ end
34
+
35
+ def sent
36
+ end
37
+
38
+ private
39
+ def render_contacts_error
40
+ if request.xhr? && process_ajax
41
+ render json: {errors: @contact_message.errors}, status: 422
42
+ else
43
+ flash.now[:alert] = @contact_message.errors.full_messages.join("\n")
44
+ render action: Enjoy.configuration.recreate_contact_message_action, status: 422
45
+ end
46
+ end
47
+ def process_ajax
48
+ true
49
+ end
50
+ def ajax_success
51
+ render json: {ok: true}
52
+ end
53
+ def redirect_after_done
54
+ redirect_to :contacts_sent
55
+ end
56
+ def after_initialize
57
+ # overrideable hook for updating message
58
+ end
59
+ def after_create
60
+ # overrideable hook for updating message
61
+ end
62
+ def model
63
+ Enjoy::ContactMessage
64
+ end
65
+ def message_params
66
+ params.require(:contact_message).permit(Enjoy.config.contacts_fields.keys + [:name, :email, :phone, :content, :captcha, :captcha_key])
67
+ end
68
+ end
69
+ end
70
+ end