enjoy_cms_gallery 0.4.0.1 → 0.4.0.2
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.
- checksums.yaml +4 -4
- data/app/models/concerns/enjoy/gallery/active_record_paperclip.rb +16 -0
- data/app/models/concerns/enjoy/gallery/mongoid_paperclip.rb +15 -0
- data/lib/enjoy/gallery/models/embedded_image.rb +1 -11
- data/lib/enjoy/gallery/models/gallery.rb +1 -11
- data/lib/enjoy/gallery/models/image.rb +1 -11
- data/lib/enjoy/gallery/models/mongoid/gallery.rb +0 -3
- data/lib/enjoy/gallery/models/mongoid/image.rb +0 -3
- data/lib/enjoy/gallery/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd0be9a73f8d96fcfd0bb20d8b2259a0d0cef929
|
4
|
+
data.tar.gz: cc0a730f4dab94e2ef39578de352519bad718f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0c64f99d6430e85e134507d3dd37bfc7cbc05fd644daa18da7e259c7891198bcb9f35d734f1f34d0b4e02468ba91531e42e4e31e919c865190586909eb46d80
|
7
|
+
data.tar.gz: 10b9025bf73313a46664c5c125c0e0b28fc4a1f35db51a69b2f803a74ef1c7174ec8f2b807dbd28cbb537ff1e567006552cf2fb2522b11437dd7bc03da2bd1ca
|
@@ -7,6 +7,8 @@ if Enjoy.active_record?
|
|
7
7
|
module ClassMethods
|
8
8
|
def enjoy_cms_active_record_attached_file(name, opts = {})
|
9
9
|
name = name.to_sym
|
10
|
+
is_image = true
|
11
|
+
styles_method_name = nil
|
10
12
|
unless opts.blank?
|
11
13
|
content_type = opts.delete(:content_type)
|
12
14
|
jcrop_options = opts.delete(:jcrop_options)
|
@@ -21,11 +23,17 @@ if Enjoy.active_record?
|
|
21
23
|
opts[:processors].uniq!
|
22
24
|
|
23
25
|
opts[:convert_options] = {all: "-quality 75 -strip"} if opts[:convert_options].blank?
|
26
|
+
|
27
|
+
if opts[:styles].blank?
|
28
|
+
styles_method_name = "#{name}_styles"
|
29
|
+
opts[:styles] = lambda { |attachment| attachment.instance.send(styles_method_name) }
|
30
|
+
end
|
24
31
|
end
|
25
32
|
|
26
33
|
has_attached_file name, opts
|
27
34
|
# validates_attachment name, content_type: content_type unless content_type.blank?
|
28
35
|
validates_attachment_content_type name, content_type: /\Aimage\/.*\Z/ if is_image
|
36
|
+
|
29
37
|
class_eval <<-EVAL
|
30
38
|
def #{name}_file_name=(val)
|
31
39
|
return self[:#{name}_file_name] = "" if val == ""
|
@@ -62,6 +70,14 @@ if Enjoy.active_record?
|
|
62
70
|
end
|
63
71
|
EVAL
|
64
72
|
end
|
73
|
+
if styles_method_name
|
74
|
+
class_eval <<-EVAL
|
75
|
+
def #{styles_method_name}
|
76
|
+
{}
|
77
|
+
end
|
78
|
+
EVAL
|
79
|
+
end
|
80
|
+
|
65
81
|
end
|
66
82
|
end
|
67
83
|
end
|
@@ -8,6 +8,7 @@ if Enjoy.mongoid?
|
|
8
8
|
def enjoy_cms_mongoid_attached_file(name, opts = {})
|
9
9
|
name = name.to_sym
|
10
10
|
is_image = true
|
11
|
+
styles_method_name = nil
|
11
12
|
unless opts.blank?
|
12
13
|
content_type = opts.delete(:content_type)
|
13
14
|
jcrop_options = opts.delete(:jcrop_options)
|
@@ -22,11 +23,17 @@ if Enjoy.mongoid?
|
|
22
23
|
opts[:processors].uniq!
|
23
24
|
|
24
25
|
opts[:convert_options] = {all: "-quality 75 -strip"} if opts[:convert_options].blank?
|
26
|
+
|
27
|
+
if opts[:styles].blank?
|
28
|
+
styles_method_name = "#{name}_styles"
|
29
|
+
opts[:styles] = lambda { |attachment| attachment.instance.send(styles_method_name) }
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
33
|
has_mongoid_attached_file name, opts
|
28
34
|
# validates_attachment name, content_type: content_type unless content_type.blank?
|
29
35
|
validates_attachment_content_type name, content_type: /\Aimage\/.*\Z/ if is_image
|
36
|
+
|
30
37
|
class_eval <<-EVAL
|
31
38
|
def #{name}_file_name=(val)
|
32
39
|
return self[:#{name}_file_name] = "" if val == ""
|
@@ -63,6 +70,14 @@ if Enjoy.mongoid?
|
|
63
70
|
end
|
64
71
|
EVAL
|
65
72
|
end
|
73
|
+
if styles_method_name
|
74
|
+
class_eval <<-EVAL
|
75
|
+
def #{styles_method_name}
|
76
|
+
{}
|
77
|
+
end
|
78
|
+
EVAL
|
79
|
+
end
|
80
|
+
|
66
81
|
end
|
67
82
|
end
|
68
83
|
end
|
@@ -8,17 +8,7 @@ module Enjoy::Gallery
|
|
8
8
|
include Enjoy::Gallery.orm_specific('EmbeddedImage')
|
9
9
|
|
10
10
|
included do
|
11
|
-
enjoy_cms_attached_file(:image
|
12
|
-
styles: lambda { |attachment| attachment.instance.image_styles }
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
def image_jcrop_options
|
17
|
-
{}
|
18
|
-
end
|
19
|
-
|
20
|
-
def image_styles
|
21
|
-
{}
|
11
|
+
enjoy_cms_attached_file(:image)
|
22
12
|
end
|
23
13
|
end
|
24
14
|
end
|
@@ -17,20 +17,10 @@ module Enjoy::Gallery
|
|
17
17
|
|
18
18
|
acts_as_nested_set
|
19
19
|
|
20
|
-
enjoy_cms_attached_file(:image
|
21
|
-
styles: lambda { |attachment| attachment.instance.image_styles }
|
22
|
-
)
|
20
|
+
enjoy_cms_attached_file(:image)
|
23
21
|
|
24
22
|
# has_many :connected_objects, as: :enjoy_gallerable
|
25
23
|
end
|
26
|
-
|
27
|
-
def image_jcrop_options
|
28
|
-
{}
|
29
|
-
end
|
30
|
-
|
31
|
-
def image_styles
|
32
|
-
{}
|
33
|
-
end
|
34
24
|
end
|
35
25
|
end
|
36
26
|
end
|
@@ -13,17 +13,7 @@ module Enjoy::Gallery
|
|
13
13
|
|
14
14
|
acts_as_nested_set
|
15
15
|
|
16
|
-
enjoy_cms_attached_file(:image
|
17
|
-
styles: lambda { |attachment| attachment.instance.image_styles }
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
def image_jcrop_options
|
22
|
-
{}
|
23
|
-
end
|
24
|
-
|
25
|
-
def image_styles
|
26
|
-
{}
|
16
|
+
enjoy_cms_attached_file(:image)
|
27
17
|
end
|
28
18
|
end
|
29
19
|
end
|
@@ -5,9 +5,6 @@ module Enjoy::Gallery
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
if defined?(RailsAdminComments)
|
9
|
-
include RailsAdminComments::Commentable
|
10
|
-
end
|
11
8
|
field :name, type: String, localize: Enjoy::Gallery.configuration.localize
|
12
9
|
|
13
10
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
@@ -5,9 +5,6 @@ module Enjoy::Gallery
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
if defined?(RailsAdminComments)
|
9
|
-
include RailsAdminComments::Commentable
|
10
|
-
end
|
11
8
|
field :name, type: String, localize: Enjoy::Gallery.configuration.localize
|
12
9
|
|
13
10
|
scope :sorted, -> { order_by([:lft, :asc]) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enjoy_cms_gallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|