polygallery 0.3.1 → 0.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49a28708abb8cca57bc55038fc319c6c282028cc
|
4
|
+
data.tar.gz: 7a743956ff2b910dae1c4bab9b569b4a6a9fa5e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5372a9227768bb0c008a246487cd33cb0937a09826c6fa743acd0d76317605a3f64a82ebe2bc25e95aca814b0d0fe87205767cb7a9f69c38d4192a425ee4b07
|
7
|
+
data.tar.gz: 1a8a04395a265f4ba928cb833beafd2c8571ea5f9586b897e06810ba870a24238d181c3aca952eeab809b9994cfbf5904c9df921b9b305bb38268146f87ddf11
|
@@ -10,11 +10,17 @@ module Polygallery
|
|
10
10
|
defaults = self.polygallery_settings
|
11
11
|
settings = defaults.deep_merge(options)
|
12
12
|
|
13
|
-
attr_accessor :photo_to_upload, :polygallery_options
|
13
|
+
attr_accessor :photo_to_upload, :polygallery_options,
|
14
|
+
:polyphoto_initialized
|
14
15
|
|
15
16
|
init_attachment settings[:paperclip]
|
16
17
|
init_associations settings
|
17
18
|
|
19
|
+
before_validation :process_photo_to_upload
|
20
|
+
# before_save {
|
21
|
+
# # puts "Photo changes: #{self.changes.inspect}"
|
22
|
+
# puts 'SAVING PHOTO!' }
|
23
|
+
|
18
24
|
after_initialize do
|
19
25
|
self.polygallery_options ||= self.polygallery_settings
|
20
26
|
self.initialize_polyphoto
|
@@ -36,12 +42,6 @@ module Polygallery
|
|
36
42
|
validates_attachment_content_type(:photo, :content_type =>
|
37
43
|
validations[:content_type]) if validations[:content_type]
|
38
44
|
validates_attachment_presence(:photo) if validations[:presence]
|
39
|
-
|
40
|
-
before_validation :process_photo_to_upload
|
41
|
-
# TODO: figure out why save gets called so much!
|
42
|
-
# before_save {
|
43
|
-
# # puts "Photo changes: #{self.changes.inspect}"
|
44
|
-
# puts 'SAVING PHOTO!' }
|
45
45
|
end
|
46
46
|
|
47
47
|
def init_associations(settings=HasPolygallery::DEFAULTS)
|
@@ -60,8 +60,10 @@ module Polygallery
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def initialize_polyphoto
|
63
|
+
return if self.polyphoto_initialized.present?
|
63
64
|
self.class.init_associations(self.polygallery_settings)
|
64
65
|
self.init_attachment
|
66
|
+
self.polyphoto_initialized = true
|
65
67
|
end
|
66
68
|
|
67
69
|
def polygallery_settings
|
@@ -11,7 +11,7 @@ module Polygallery
|
|
11
11
|
},
|
12
12
|
:photos => {
|
13
13
|
:class_name => '::Polygallery::Photo',
|
14
|
-
:before_add => :set_nest,
|
14
|
+
# :before_add => :set_nest,
|
15
15
|
:dependent => :destroy,
|
16
16
|
:foreign_key => :gallery_id
|
17
17
|
}
|
@@ -125,7 +125,6 @@ module Polygallery
|
|
125
125
|
|
126
126
|
def build_gallery_associations
|
127
127
|
return [] unless self.class.has_polygallery?
|
128
|
-
# puts 'BUILDING GALLERIES!'
|
129
128
|
gallery_associations = self.class.polygalleries.map{|pg|
|
130
129
|
self.build_gallery_association pg }
|
131
130
|
self.galleries_built = true
|
@@ -25,7 +25,6 @@ module Polygallery
|
|
25
25
|
after_initialize do
|
26
26
|
self.polygallery_options ||= self.polygallery_settings
|
27
27
|
self.initialize_polygallery
|
28
|
-
# self.build_polygallery_photos # if new_record? && !polygallery_photos_attributes.is_a?(Hash)
|
29
28
|
end
|
30
29
|
after_initialize :build_polygallery_photos, :if => :new_record?
|
31
30
|
before_validation :set_nested_attributes_to_correct_gallery
|
@@ -58,7 +57,7 @@ module Polygallery
|
|
58
57
|
photo.galleryable_type ||= galleryable_type
|
59
58
|
photo.galleryable ||= galleryable
|
60
59
|
photo.gallery_title ||= title
|
61
|
-
photo.polygallery_options
|
60
|
+
photo.polygallery_options ||= self.polygallery_settings
|
62
61
|
photo.initialize_polyphoto
|
63
62
|
photo.send(:"#{title}=", self) if photo.send(:"#{title}").nil?
|
64
63
|
end
|
@@ -144,9 +143,9 @@ module Polygallery
|
|
144
143
|
else
|
145
144
|
# puts 'Building a new photo'
|
146
145
|
# puts attrs_for_photo.inspect
|
147
|
-
#
|
148
|
-
|
149
|
-
set_nest built_photo
|
146
|
+
# built_photo =
|
147
|
+
self.polygallery_photos.build attrs_for_photo
|
148
|
+
# set_nest built_photo
|
150
149
|
# self.polygallery_photos_attributes[index][:built] = true
|
151
150
|
end
|
152
151
|
end
|
data/lib/polygallery/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polygallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MacKinley Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|