enjoy_cms_gallery 0.4.0 → 0.4.0.1
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 +12 -0
- data/app/models/concerns/enjoy/gallery/mongoid_paperclip.rb +12 -0
- data/lib/enjoy/gallery/admin/embedded_image.rb +2 -5
- data/lib/enjoy/gallery/admin/gallery.rb +2 -15
- data/lib/enjoy/gallery/admin/image.rb +1 -3
- data/lib/enjoy/gallery/rails_admin_ext/enjoy_image.rb +32 -0
- data/lib/enjoy/gallery/version.rb +1 -1
- data/lib/enjoy_cms_gallery.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c0e1f36e556ece09d0d90a5493f4752679af22
|
4
|
+
data.tar.gz: c3b947cb8fd2ee714cd64831696ccd99c6863da9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 632ac29c44d5c842f8448a4b486aaacf16fb1a8a0ffc80b54f79f9210242bf1bd9e04027760749a4ed52f40bc5f457aa57a0a4a41e0b3dc54f85ae912a52ebc7
|
7
|
+
data.tar.gz: 11907bd019e601ad28aa0dcf3612420077803d34b14790bcb27566933705cbf3c865e72673a484484e404c2ccb2118e8303f886533d8fbf7278a73016b5da1bf
|
@@ -41,6 +41,18 @@ if Enjoy.active_record?
|
|
41
41
|
self.#{name}.processors << p_o if p_o
|
42
42
|
true
|
43
43
|
end
|
44
|
+
|
45
|
+
def #{name}_svg?
|
46
|
+
#{name}_content_type =~ /svg/
|
47
|
+
end
|
48
|
+
|
49
|
+
def #{name}_url(opts)
|
50
|
+
if #{name}_svg?
|
51
|
+
#{name}.url
|
52
|
+
else
|
53
|
+
#{name}.url(opts)
|
54
|
+
end
|
55
|
+
end
|
44
56
|
EVAL
|
45
57
|
jcrop_options ||= {}
|
46
58
|
if jcrop_options
|
@@ -42,6 +42,18 @@ if Enjoy.mongoid?
|
|
42
42
|
self.#{name}.processors << p_o if p_o
|
43
43
|
true
|
44
44
|
end
|
45
|
+
|
46
|
+
def #{name}_svg?
|
47
|
+
#{name}_content_type =~ /svg/
|
48
|
+
end
|
49
|
+
|
50
|
+
def #{name}_url(opts)
|
51
|
+
if #{name}_svg?
|
52
|
+
#{name}.url
|
53
|
+
else
|
54
|
+
#{name}.url(opts)
|
55
|
+
end
|
56
|
+
end
|
45
57
|
EVAL
|
46
58
|
jcrop_options ||= {}
|
47
59
|
if jcrop_options
|
@@ -2,13 +2,10 @@ module Enjoy::Gallery
|
|
2
2
|
module Admin
|
3
3
|
module EmbeddedImage
|
4
4
|
def self.config(fields = {})
|
5
|
-
jcrop_proc = Proc.new do
|
6
|
-
jcrop_options :image_jcrop_options
|
7
|
-
end
|
8
5
|
|
9
6
|
if fields
|
10
7
|
if fields.is_a?(Hash)
|
11
|
-
fields.reverse_merge!({image:
|
8
|
+
fields.reverse_merge!({image: :enjoy_image})
|
12
9
|
else
|
13
10
|
finded = false
|
14
11
|
fields.each { |g|
|
@@ -18,7 +15,7 @@ module Enjoy::Gallery
|
|
18
15
|
fields << {
|
19
16
|
name: :image,
|
20
17
|
fields: {
|
21
|
-
image:
|
18
|
+
image: :enjoy_image
|
22
19
|
}
|
23
20
|
}
|
24
21
|
end
|
@@ -13,24 +13,11 @@ module Enjoy::Gallery
|
|
13
13
|
end
|
14
14
|
group :URL do
|
15
15
|
active false
|
16
|
-
field :slugs, :
|
17
|
-
searchable true
|
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
|
16
|
+
field :slugs, :enjoy_slugs
|
28
17
|
field :text_slug
|
29
18
|
end
|
30
19
|
|
31
|
-
field :image, :
|
32
|
-
jcrop_options :image_jcrop_options
|
33
|
-
end
|
20
|
+
field :image, :enjoy_image
|
34
21
|
|
35
22
|
# field :gallery_objects do
|
36
23
|
# read_only true
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'ack_rails_admin_jcrop'
|
2
|
+
|
3
|
+
module RailsAdmin
|
4
|
+
module Config
|
5
|
+
module Fields
|
6
|
+
module Types
|
7
|
+
class EnjoyImage < RailsAdmin::Config::Fields::Types::Jcrop
|
8
|
+
# Register field type for the type loader
|
9
|
+
RailsAdmin::Config::Fields::Types::register(self)
|
10
|
+
|
11
|
+
register_instance_option :help do
|
12
|
+
"SVG не изменяется."
|
13
|
+
end
|
14
|
+
|
15
|
+
register_instance_option :jcrop_options do
|
16
|
+
"#{name}_jcrop_options".to_sym
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
|
26
|
+
if (properties.respond_to?(:name) ? properties.name : properties[:name]) == :enjoy_image
|
27
|
+
fields << RailsAdmin::Config::Fields::Types::EnjoyImage.new(parent, :enjoy_image, properties)
|
28
|
+
true
|
29
|
+
else
|
30
|
+
false
|
31
|
+
end
|
32
|
+
end
|
data/lib/enjoy_cms_gallery.rb
CHANGED
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.1
|
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-07-
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/enjoy/gallery/models/mongoid/embedded_image.rb
|
175
175
|
- lib/enjoy/gallery/models/mongoid/gallery.rb
|
176
176
|
- lib/enjoy/gallery/models/mongoid/image.rb
|
177
|
+
- lib/enjoy/gallery/rails_admin_ext/enjoy_image.rb
|
177
178
|
- lib/enjoy/gallery/version.rb
|
178
179
|
- lib/enjoy_cms_gallery.rb
|
179
180
|
- lib/generators/enjoy/gallery/config/install_generator.rb
|