el_finder2 0.1.3 → 0.1.4
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/el_finder2/document.rb +1 -1
- data/app/models/el_finder2/image.rb +2 -3
- data/lib/el_finder2/version.rb +1 -1
- data/lib/el_finder2.rb +36 -0
- 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: ff59a1ef1adf040108a8458744fcadca984298a3
|
4
|
+
data.tar.gz: a2d3ff1f92269aa7b9b94b0313233d4335fddb8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74bf38071a64e6d5d128c885c56376c4d96b1a4252126483c83b1bb25dfef9efdbc0f104dcebf84c2b7af4f89f3ef19bf0b422ff7789db1f70f24f6cda825e4e
|
7
|
+
data.tar.gz: c7c059cfec7dcb13e10e1a54ef04d0582a05667d925c26ae127413ff92be311ff7ff83b50ce5baa8996c284a58898cafcf35d8c131a8302348611a3ba1c8f910
|
@@ -2,7 +2,7 @@ module ElFinder2
|
|
2
2
|
class Document < ElFinder2::File
|
3
3
|
has_attached_file :content
|
4
4
|
|
5
|
-
|
5
|
+
validates_attachment :content, ElFinder2.configuration.document_validations
|
6
6
|
|
7
7
|
delegate :content_type, :size, :url, to: :content
|
8
8
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module ElFinder2
|
2
2
|
class Image < ElFinder2::File
|
3
|
-
has_attached_file :content,
|
3
|
+
has_attached_file :content, ElFinder2.configuration.image_attachment
|
4
4
|
|
5
|
-
validates_attachment :content,
|
6
|
-
content_type: { content_type: ElFinder2::IMAGE_MIME_REGEX }
|
5
|
+
validates_attachment :content, ElFinder2.configuration.image_validations
|
7
6
|
|
8
7
|
delegate :content_type, :size, :url, to: :content
|
9
8
|
|
data/lib/el_finder2/version.rb
CHANGED
data/lib/el_finder2.rb
CHANGED
@@ -7,4 +7,40 @@ module ElFinder2
|
|
7
7
|
API_VERSION = '2.1'
|
8
8
|
VOLUME_ID = 'v0'
|
9
9
|
IMAGE_MIME_REGEX = /\A(image|(x-)?application)\/(bmp|gif|p?jpeg|jpg|(x-)?png)\Z/
|
10
|
+
|
11
|
+
def self.configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configure(&block)
|
16
|
+
configuration.tap(&block)
|
17
|
+
end
|
18
|
+
|
19
|
+
class Configuration
|
20
|
+
attr_accessor :document_validations
|
21
|
+
attr_accessor :image_styles
|
22
|
+
attr_accessor :image_validations
|
23
|
+
attr_accessor :paperclip_defaults
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@document_validations = {
|
27
|
+
presence: true,
|
28
|
+
file_type_ignorance: {}
|
29
|
+
}
|
30
|
+
@image_styles = { thumb: '100x100>' }
|
31
|
+
@image_validations = {
|
32
|
+
presence: true,
|
33
|
+
content_type: { content_type: ElFinder2::IMAGE_MIME_REGEX }
|
34
|
+
}
|
35
|
+
@paperclip_defaults = {}
|
36
|
+
end
|
37
|
+
|
38
|
+
def image_attachment
|
39
|
+
@paperclip_defaults.merge(styles: @image_styles)
|
40
|
+
end
|
41
|
+
|
42
|
+
def document_attachment
|
43
|
+
@paperclip_defaults
|
44
|
+
end
|
45
|
+
end
|
10
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: el_finder2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuintEvents
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|