enjoy_cms 0.2.0.3.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/app/models/concerns/enjoy/decorators/contact_message.rb +5 -0
  4. data/app/models/concerns/enjoy/decorators/embedded_element.rb +5 -0
  5. data/app/models/concerns/enjoy/decorators/embedded_gallery_image.rb +5 -0
  6. data/app/models/concerns/enjoy/decorators/gallery.rb +5 -0
  7. data/app/models/concerns/enjoy/decorators/gallery_image.rb +5 -0
  8. data/app/models/concerns/enjoy/decorators/menu.rb +5 -0
  9. data/app/models/concerns/enjoy/decorators/news.rb +5 -0
  10. data/app/models/concerns/enjoy/decorators/page.rb +5 -0
  11. data/app/models/concerns/enjoy/decorators/seo.rb +5 -0
  12. data/app/models/concerns/enjoy/decorators/sitemap_data.rb +5 -0
  13. data/app/models/enjoy/contact_message.rb +6 -2
  14. data/app/models/enjoy/embedded_element.rb +3 -1
  15. data/app/models/enjoy/embedded_gallery_image.rb +2 -1
  16. data/app/models/enjoy/gallery.rb +5 -2
  17. data/app/models/enjoy/gallery_image.rb +5 -2
  18. data/app/models/enjoy/menu.rb +5 -1
  19. data/app/models/enjoy/news.rb +5 -1
  20. data/app/models/enjoy/page.rb +5 -1
  21. data/app/models/enjoy/seo.rb +6 -2
  22. data/app/models/enjoy/sitemap_data.rb +6 -2
  23. data/lib/enjoy/admin/contact_message.rb +13 -1
  24. data/lib/enjoy/admin/embedded_element.rb +1 -0
  25. data/lib/enjoy/admin/embedded_gallery_image.rb +1 -1
  26. data/lib/enjoy/admin/gallery.rb +13 -1
  27. data/lib/enjoy/admin/gallery_image.rb +1 -0
  28. data/lib/enjoy/admin/menu.rb +13 -1
  29. data/lib/enjoy/admin/seo.rb +13 -1
  30. data/lib/enjoy/admin/sitemap_data.rb +13 -1
  31. data/lib/enjoy/models/contact_message.rb +18 -5
  32. data/lib/enjoy/models/embedded_element.rb +10 -1
  33. data/lib/enjoy/models/embedded_gallery_image.rb +9 -0
  34. data/lib/enjoy/models/gallery.rb +9 -0
  35. data/lib/enjoy/models/gallery_image.rb +9 -0
  36. data/lib/enjoy/models/menu.rb +10 -0
  37. data/lib/enjoy/models/news.rb +9 -0
  38. data/lib/enjoy/models/page.rb +9 -0
  39. data/lib/enjoy/models/seo.rb +9 -0
  40. data/lib/enjoy/models/sitemap_data.rb +9 -0
  41. data/lib/enjoy/version.rb +1 -1
  42. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd4ec57e1e47baccfe849e9572ff7728a34c7a11
4
- data.tar.gz: 23692ddf8e0deec91f79516ca69d6d97b0e5ff70
3
+ metadata.gz: a9058168d3e015e9c7618246f623a9c5f2a324be
4
+ data.tar.gz: 3823a3981ad52b1620ff1e0618acfc3c6ce3ce44
5
5
  SHA512:
6
- metadata.gz: d3517b3951508d390e50e6f2e7a184ed18cdf83d3d98cb5a0705608627c2ce670ba75cda90d1059ad927491091a9144402f40565adf0e96c2729f4ac7597c75a
7
- data.tar.gz: 5e17ce46c0808c0e3b8eaf6928d0768045286b8359a9e582b5f01df6c3c37537f3e0f440a29ef1e04922635012acb8aef346fd4014e49d51470e09474fc2fc95
6
+ metadata.gz: 772b57c08786e0be58c5accbefc841ee8317e9d91349b89aafc73dc4885d9e674cbdc291e9e6175a5d7ae2e5cb09a89ce566c6d28ddb0e5e8669f9182b755e80
7
+ data.tar.gz: be0678b89c1ae435d21e9d19352ea2d1b7f7d5974defcc4dddb76f9adb6f7aa27f7407258a12e8204d24983d901b96074ea373e16c8ebc224bacdce0131677b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enjoy_cms (0.2.0.3.2)
4
+ enjoy_cms (0.2.1)
5
5
  ack_rails_admin_jcrop
6
6
  addressable
7
7
  ckeditor
@@ -30,7 +30,7 @@ PATH
30
30
  GEM
31
31
  remote: https://rubygems.org/
32
32
  specs:
33
- ack_rails_admin_jcrop (0.0.6)
33
+ ack_rails_admin_jcrop (0.0.7)
34
34
  mini_magick
35
35
  rails (>= 3.0.0)
36
36
  rails_admin (>= 0.3.0)
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module ContactMessage
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module EmbeddedElement
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module EmbeddedGalleryImage
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module Gallery
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module GalleryImage
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module Menu
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module News
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module Page
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module Seo
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Enjoy::Decorators
2
+ module SitemapData
3
+ extend ActiveSupport::Concern
4
+ end
5
+ end
@@ -6,7 +6,11 @@ module Enjoy
6
6
 
7
7
  class ContactMessage
8
8
  include Enjoy::Models::ContactMessage
9
-
10
- rails_admin &Enjoy::Admin::ContactMessage.config
9
+
10
+ include Enjoy::Decorators::ContactMessage
11
+
12
+ rails_admin(&Enjoy::Admin::ContactMessage.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -2,7 +2,9 @@ module Enjoy
2
2
  if Enjoy.mongoid?
3
3
  class EmbeddedElement
4
4
  include Enjoy::Models::EmbeddedElement
5
-
5
+
6
+ include Enjoy::Decorators::EmbeddedElement
7
+
6
8
 
7
9
  # use it in inherited model
8
10
  # rails_admin &Enjoy::Admin::EmbeddedElement.config
@@ -2,7 +2,8 @@ module Enjoy
2
2
  if Enjoy.mongoid?
3
3
  class EmbeddedGalleryImage < Enjoy::EmbeddedElement
4
4
  include Enjoy::Models::EmbeddedGalleryImage
5
-
5
+
6
+ include Enjoy::Decorators::EmbeddedGalleryImage
6
7
 
7
8
  # use it in inherited model
8
9
  # rails_admin &Enjoy::Admin::EmbeddedGalleryImage.config
@@ -2,9 +2,12 @@ module Enjoy
2
2
  if Enjoy.mongoid?
3
3
  class Gallery
4
4
  include Enjoy::Models::Gallery
5
-
6
5
 
7
- rails_admin &Enjoy::Admin::Gallery.config
6
+ include Enjoy::Decorators::Gallery
7
+
8
+ rails_admin(&Enjoy::Admin::Gallery.config(rails_admin_add_fields) { |config|
9
+ rails_admin_add_config(config)
10
+ })
8
11
  end
9
12
  end
10
13
  end
@@ -2,9 +2,12 @@ module Enjoy
2
2
  if Enjoy.mongoid?
3
3
  class GalleryImage
4
4
  include Enjoy::Models::GalleryImage
5
-
6
5
 
7
- rails_admin &Enjoy::Admin::GalleryImage.config
6
+ include Enjoy::Decorators::GalleryImage
7
+
8
+ rails_admin(&Enjoy::Admin::GalleryImage.config(rails_admin_add_fields) { |config|
9
+ rails_admin_add_config(config)
10
+ })
8
11
  end
9
12
  end
10
13
  end
@@ -7,6 +7,10 @@ module Enjoy
7
7
  class Menu
8
8
  include Enjoy::Models::Menu
9
9
 
10
- rails_admin &Enjoy::Admin::Menu.config
10
+ include Enjoy::Decorators::Menu
11
+
12
+ rails_admin(&Enjoy::Admin::Menu.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -7,6 +7,10 @@ module Enjoy
7
7
  class News
8
8
  include Enjoy::Models::News
9
9
 
10
- rails_admin &Enjoy::Admin::News.config
10
+ include Enjoy::Decorators::News
11
+
12
+ rails_admin(&Enjoy::Admin::News.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -7,6 +7,10 @@ module Enjoy
7
7
  class Page
8
8
  include Enjoy::Models::Page
9
9
 
10
- rails_admin &Enjoy::Admin::Page.config
10
+ include Enjoy::Decorators::Page
11
+
12
+ rails_admin(&Enjoy::Admin::Page.config(rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -6,7 +6,11 @@ module Enjoy
6
6
 
7
7
  class Seo
8
8
  include Enjoy::Models::Seo
9
-
10
- rails_admin &Enjoy::Admin::Seo.config
9
+
10
+ include Enjoy::Decorators::Seo
11
+
12
+ rails_admin(&Enjoy::Admin::Seo.config(false, rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -6,7 +6,11 @@ module Enjoy
6
6
 
7
7
  class SitemapData
8
8
  include Enjoy::Models::SitemapData
9
-
10
- rails_admin &Enjoy::Admin::SitemapData.config
9
+
10
+ include Enjoy::Decorators::SitemapData
11
+
12
+ rails_admin(&Enjoy::Admin::SitemapData.config(false, rails_admin_add_fields) { |config|
13
+ rails_admin_add_config(config)
14
+ })
11
15
  end
12
16
  end
@@ -1,7 +1,7 @@
1
1
  module Enjoy
2
2
  module Admin
3
3
  module ContactMessage
4
- def self.config
4
+ def self.config(fields = {})
5
5
  Proc.new {
6
6
  # navigation_label I18n.t('enjoy.contact_message')
7
7
  field :c_at do
@@ -21,6 +21,18 @@ module Enjoy
21
21
  end
22
22
  end
23
23
 
24
+ fields.each_pair do |name, type|
25
+ if type.nil?
26
+ field name
27
+ else
28
+ if type.is_a?(Array)
29
+ field name, type[0], &type[1]
30
+ else
31
+ field name, type
32
+ end
33
+ end
34
+ end
35
+
24
36
  if block_given?
25
37
  yield self
26
38
  end
@@ -6,6 +6,7 @@ module Enjoy
6
6
  # navigation_label(_navigation_label) unless _navigation_label.nil?
7
7
  field :enabled, :toggle
8
8
  field :name, :string
9
+
9
10
  fields.each_pair do |name, type|
10
11
  if type.nil?
11
12
  field name
@@ -6,7 +6,7 @@ module Enjoy
6
6
  jcrop_options :image_jcrop_options
7
7
  end
8
8
 
9
- fields = {image: [:jcrop, jcrop_proc]}.merge(fields)
9
+ fields.reverse_merge!({image: [:jcrop, jcrop_proc]})
10
10
  if block_given?
11
11
  Enjoy::Admin::EmbeddedElement.config(nil, fields) do |config|
12
12
  yield config
@@ -1,7 +1,7 @@
1
1
  module Enjoy
2
2
  module Admin
3
3
  module Gallery
4
- def self.config
4
+ def self.config(fields = {})
5
5
  Proc.new {
6
6
  # navigation_label I18n.t('enjoy.gallery')
7
7
  field :enabled, :toggle
@@ -24,6 +24,18 @@ module Enjoy
24
24
  jcrop_options :image_jcrop_options
25
25
  end
26
26
 
27
+ fields.each_pair do |name, type|
28
+ if type.nil?
29
+ field name
30
+ else
31
+ if type.is_a?(Array)
32
+ field name, type[0], &type[1]
33
+ else
34
+ field name, type
35
+ end
36
+ end
37
+ end
38
+
27
39
  if block_given?
28
40
  yield self
29
41
  end
@@ -12,6 +12,7 @@ module Enjoy
12
12
  field :image, :jcrop do
13
13
  jcrop_options :image_jcrop_options
14
14
  end
15
+
15
16
  fields.each_pair do |name, type|
16
17
  if type.nil?
17
18
  field name
@@ -1,7 +1,7 @@
1
1
  module Enjoy
2
2
  module Admin
3
3
  module Menu
4
- def self.config
4
+ def self.config(fields = {})
5
5
  Proc.new {
6
6
  # navigation_label 'CMS'
7
7
 
@@ -9,6 +9,18 @@ module Enjoy
9
9
  field :text_slug
10
10
  field :name
11
11
 
12
+ fields.each_pair do |name, type|
13
+ if type.nil?
14
+ field name
15
+ else
16
+ if type.is_a?(Array)
17
+ field name, type[0], &type[1]
18
+ else
19
+ field name, type
20
+ end
21
+ end
22
+ end
23
+
12
24
  if block_given?
13
25
  yield self
14
26
  end
@@ -1,7 +1,7 @@
1
1
  module Enjoy
2
2
  module Admin
3
3
  module Seo
4
- def self.config(is_active = true)
4
+ def self.config(is_active = true, fields = {})
5
5
  Proc.new {
6
6
  navigation_label 'SEO'
7
7
  field :seoable do
@@ -19,6 +19,18 @@ module Enjoy
19
19
  jcrop_options :og_image_jcrop_options
20
20
  end
21
21
 
22
+ fields.each_pair do |name, type|
23
+ if type.nil?
24
+ field name
25
+ else
26
+ if type.is_a?(Array)
27
+ field name, type[0], &type[1]
28
+ else
29
+ field name, type
30
+ end
31
+ end
32
+ end
33
+
22
34
  if block_given?
23
35
  yield self
24
36
  end
@@ -1,7 +1,7 @@
1
1
  module Enjoy
2
2
  module Admin
3
3
  module SitemapData
4
- def self.config(is_active = false)
4
+ def self.config(is_active = false, fields = {})
5
5
  Proc.new {
6
6
  navigation_label 'SEO'
7
7
  label I18n.t('enjoy.sitemap_data')
@@ -17,6 +17,18 @@ module Enjoy
17
17
  end
18
18
  field :sitemap_priority
19
19
 
20
+ fields.each_pair do |name, type|
21
+ if type.nil?
22
+ field name
23
+ else
24
+ if type.is_a?(Array)
25
+ field name, type[0], &type[1]
26
+ else
27
+ field name, type
28
+ end
29
+ end
30
+ end
31
+
20
32
  if block_given?
21
33
  yield self
22
34
  end
@@ -21,17 +21,30 @@ module Enjoy
21
21
  end
22
22
 
23
23
  after_create do
24
- mailer_class.send(mailer_method, self).deliver
24
+ mailer_class.send(mailer_method, self).deliver if send_emails?
25
25
  end
26
+ end
26
27
 
27
- def mailer_class
28
- ContactMailer
28
+ module ClassMethods
29
+ def rails_admin_add_fields
30
+ {}
29
31
  end
30
32
 
31
- def mailer_method
32
- :new_message_email
33
+ def rails_admin_add_config(config)
33
34
  end
34
35
  end
36
+
37
+ def send_emails?
38
+ true
39
+ end
40
+
41
+ def mailer_class
42
+ ContactMailer
43
+ end
44
+
45
+ def mailer_method
46
+ :new_message_email
47
+ end
35
48
  end
36
49
  end
37
50
  end
@@ -5,8 +5,17 @@ module Enjoy
5
5
  include Enjoy::Model
6
6
  include Enjoy::Enableable
7
7
  include Enjoy::Sortable
8
-
8
+
9
9
  include Enjoy.orm_specific('EmbeddedElement')
10
+
11
+ module ClassMethods
12
+ def rails_admin_add_fields
13
+ {}
14
+ end
15
+
16
+ def rails_admin_add_config(config)
17
+ end
18
+ end
10
19
  end
11
20
  end
12
21
  end
@@ -11,6 +11,15 @@ module Enjoy
11
11
  included do
12
12
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
13
13
  end
14
+
15
+ module ClassMethods
16
+ def rails_admin_add_fields
17
+ {}
18
+ end
19
+
20
+ def rails_admin_add_config(config)
21
+ end
22
+ end
14
23
  end
15
24
  end
16
25
  end
@@ -16,6 +16,15 @@ module Enjoy
16
16
 
17
17
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
18
18
  end
19
+
20
+ module ClassMethods
21
+ def rails_admin_add_fields
22
+ {}
23
+ end
24
+
25
+ def rails_admin_add_config(config)
26
+ end
27
+ end
19
28
  end
20
29
  end
21
30
  end
@@ -14,6 +14,15 @@ module Enjoy
14
14
 
15
15
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/, if: :image?
16
16
  end
17
+
18
+ module ClassMethods
19
+ def rails_admin_add_fields
20
+ {}
21
+ end
22
+
23
+ def rails_admin_add_config(config)
24
+ end
25
+ end
17
26
  end
18
27
  end
19
28
  end
@@ -7,6 +7,7 @@ module Enjoy
7
7
  include Enjoy::Enableable
8
8
 
9
9
  include Enjoy.orm_specific('Menu')
10
+
10
11
  included do
11
12
 
12
13
  field :name, type: String
@@ -19,6 +20,15 @@ module Enjoy
19
20
  Rails.cache.delete 'menus'
20
21
  end
21
22
  end
23
+
24
+ module ClassMethods
25
+ def rails_admin_add_fields
26
+ {}
27
+ end
28
+
29
+ def rails_admin_add_config(config)
30
+ end
31
+ end
22
32
  end
23
33
  end
24
34
  end
@@ -36,6 +36,15 @@ module Enjoy
36
36
  manual_slug :report_slug
37
37
  end
38
38
 
39
+ module ClassMethods
40
+ def rails_admin_add_fields
41
+ {}
42
+ end
43
+
44
+ def rails_admin_add_config(config)
45
+ end
46
+ end
47
+
39
48
  def report_slug
40
49
  if time.blank?
41
50
  name
@@ -23,6 +23,15 @@ module Enjoy
23
23
  end
24
24
  end
25
25
 
26
+ module ClassMethods
27
+ def rails_admin_add_fields
28
+ {}
29
+ end
30
+
31
+ def rails_admin_add_config(config)
32
+ end
33
+ end
34
+
26
35
  def page_h1
27
36
  _ret = seo ? seo.h1 : nil
28
37
  _ret = name if _ret.blank?
@@ -12,6 +12,15 @@ module Enjoy
12
12
 
13
13
  validates_attachment_content_type :og_image, content_type: /\Aimage\/.*\Z/, if: :og_image?
14
14
  end
15
+
16
+ module ClassMethods
17
+ def rails_admin_add_fields
18
+ {}
19
+ end
20
+
21
+ def rails_admin_add_config(config)
22
+ end
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -12,6 +12,15 @@ module Enjoy
12
12
  included do
13
13
  belongs_to :sitemap_data_field, polymorphic: true
14
14
  end
15
+
16
+ module ClassMethods
17
+ def rails_admin_add_fields
18
+ {}
19
+ end
20
+
21
+ def rails_admin_add_config(config)
22
+ end
23
+ end
15
24
  end
16
25
  end
17
26
  end
data/lib/enjoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Enjoy
2
- VERSION = "0.2.0.3.2"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enjoy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.3.2
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-08 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -414,6 +414,16 @@ files:
414
414
  - app/helpers/enjoy/powered_helper.rb
415
415
  - app/mailers/enjoy/contact_mailer.rb
416
416
  - app/models/concerns/enjoy/boolean_field.rb
417
+ - app/models/concerns/enjoy/decorators/contact_message.rb
418
+ - app/models/concerns/enjoy/decorators/embedded_element.rb
419
+ - app/models/concerns/enjoy/decorators/embedded_gallery_image.rb
420
+ - app/models/concerns/enjoy/decorators/gallery.rb
421
+ - app/models/concerns/enjoy/decorators/gallery_image.rb
422
+ - app/models/concerns/enjoy/decorators/menu.rb
423
+ - app/models/concerns/enjoy/decorators/news.rb
424
+ - app/models/concerns/enjoy/decorators/page.rb
425
+ - app/models/concerns/enjoy/decorators/seo.rb
426
+ - app/models/concerns/enjoy/decorators/sitemap_data.rb
417
427
  - app/models/concerns/enjoy/enableable.rb
418
428
  - app/models/concerns/enjoy/geocodeable.rb
419
429
  - app/models/concerns/enjoy/mappable.rb