polygallery 0.1.8 → 0.1.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f9abf3f0bd4b6b0b456186e42035e1c8e5eb303
|
4
|
+
data.tar.gz: 52b44ca2121ff52b0f69b67d834e878ec4edd402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582fdfffbac40a713ecf29ab2b927b2b342fea7e87a51ab236b0f44ad9f3c17f801874c568e4a161227ceb284ddcdfb665e190a2c939edbef4ed86d3df5a3551
|
7
|
+
data.tar.gz: f57230bd322d74bfd5a1f959260ca0337b73b8893e62bac7f339278eea7b5d754c1a660cb30a5e24b24b7fd0447004765300834f430df799524b3cfaaa27116b
|
@@ -13,6 +13,8 @@ module Polygallery
|
|
13
13
|
defaults = self.polygallery_settings
|
14
14
|
settings = defaults.deep_merge(options)
|
15
15
|
|
16
|
+
init_attachment settings[:paperclip]
|
17
|
+
|
16
18
|
after_initialize do
|
17
19
|
@polygallery_settings = settings if settings == HasPolygallery::DEFAULTS
|
18
20
|
self.initialize_polyphoto
|
@@ -24,6 +26,17 @@ module Polygallery
|
|
24
26
|
def polygallery_settings
|
25
27
|
@polygallery_settings || HasPolygallery::DEFAULTS
|
26
28
|
end
|
29
|
+
|
30
|
+
def init_attachment(paperclip_settings)
|
31
|
+
has_attached_file :photo,
|
32
|
+
:styles => paperclip_settings[:styles],
|
33
|
+
:default_url => paperclip_settings[:default_url]
|
34
|
+
validations = polygallery_settings[:paperclip_validations]
|
35
|
+
validates_attachment_content_type(:photo, :content_type =>
|
36
|
+
validations[:content_type]) if validations[:content_type]
|
37
|
+
validates_attachment_presence(:photo) if validations[:presence]
|
38
|
+
end
|
39
|
+
|
27
40
|
end
|
28
41
|
|
29
42
|
module LocalInstanceMethods
|
@@ -66,13 +79,7 @@ module Polygallery
|
|
66
79
|
end
|
67
80
|
|
68
81
|
def init_attachment
|
69
|
-
self.class.
|
70
|
-
:styles => paperclip_settings[:styles],
|
71
|
-
:default_url => paperclip_settings[:default_url]
|
72
|
-
validations = polygallery_settings[:paperclip_validations]
|
73
|
-
self.class.validates_attachment_content_type(:photo, :content_type =>
|
74
|
-
validations[:content_type]) if validations[:content_type]
|
75
|
-
self.class.validates_attachment_presence(:photo) if validations[:presence]
|
82
|
+
self.class.init_attachment paperclip_settings
|
76
83
|
end
|
77
84
|
|
78
85
|
end
|
@@ -82,8 +82,7 @@ module Polygallery
|
|
82
82
|
accepts_nested_attributes_for settings[:association_names][:gallery],
|
83
83
|
settings[:nested_attributes][:gallery]
|
84
84
|
accepts_nested_attributes_for settings[:association_names][:photos],
|
85
|
-
|
86
|
-
:source => settings[:association_names][:photos] })
|
85
|
+
settings[:nested_attributes][:photos]
|
87
86
|
|
88
87
|
after_initialize :build_galleries
|
89
88
|
|
@@ -20,10 +20,9 @@ module Polygallery
|
|
20
20
|
|
21
21
|
settings = defaults.deep_merge options
|
22
22
|
|
23
|
-
has_many association_names[:photos],
|
24
|
-
settings[:associations][:photos].deep_merge({})
|
23
|
+
has_many association_names[:photos], settings[:associations][:photos]
|
25
24
|
accepts_nested_attributes_for association_names[:photos],
|
26
|
-
|
25
|
+
settings[:nested_attributes][:photos]
|
27
26
|
|
28
27
|
after_initialize do
|
29
28
|
@polygallery_settings = settings if settings == HasPolygallery::DEFAULTS
|
@@ -57,8 +56,8 @@ module Polygallery
|
|
57
56
|
end
|
58
57
|
|
59
58
|
def initialize_polygallery
|
60
|
-
settings = self.polygallery_settings
|
61
|
-
association_names = settings[:association_names]
|
59
|
+
# settings = self.polygallery_settings
|
60
|
+
# association_names = settings[:association_names]
|
62
61
|
# self.class.has_many association_names[:photos],
|
63
62
|
# settings[:associations][:photos].deep_merge({})
|
64
63
|
# self.class.accepts_nested_attributes_for association_names[:photos],
|
data/lib/polygallery/version.rb
CHANGED