polygallery 0.1.4 → 0.1.6
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/lib/polygallery/has_polygallery.rb +23 -10
- data/lib/polygallery/has_polyphotos.rb +3 -2
- data/lib/polygallery/version.rb +1 -1
- data/test/dummy/log/development.log +2542 -0
- data/test/dummy/log/test.log +3613 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/001/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/001/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/002/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/002/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/003/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/003/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/spec/features/events_spec.rb +2 -0
- data/{app → vendor}/assets/images/polygallery/thumbnail-missing.jpg +0 -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: d422469c1636c39daec91fdcc84c67df1972d4ea
|
4
|
+
data.tar.gz: 7a7322c270678788dab88181f1981423364d4540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11abda37d7563201ff480938f6b91737861edb72051fcc0489f2cd79f5b59cc77d8ca367a99d8b794d5246eb7339b29379937cb1f690e7f8a35c71ea44063108
|
7
|
+
data.tar.gz: da620e32ddb14c4225571e8c5d06d62f5d67ee9080fdcbed793d8952099269b62f7939f4bbdd97779c4083771712cfda1ae0dde028305e96086cf7ccc7c7b9fe
|
@@ -38,7 +38,7 @@ module Polygallery
|
|
38
38
|
:validates => {},
|
39
39
|
:paperclip => {
|
40
40
|
:styles => {:medium => '300x300#', :thumb => '100x100#'},
|
41
|
-
:default_url =>
|
41
|
+
:default_url => 'polygallery/thumbnail-missing.jpg'
|
42
42
|
},
|
43
43
|
:paperclip_validations => {
|
44
44
|
:content_type => /\Aimage\/.*\Z/,
|
@@ -94,9 +94,9 @@ module Polygallery
|
|
94
94
|
.select{|a| a.foreign_key == 'galleryable_id'}.map(&:name)
|
95
95
|
end
|
96
96
|
|
97
|
-
def has_polygallery?(
|
98
|
-
return polygalleries.any? if
|
99
|
-
polygalleries.include?(
|
97
|
+
def has_polygallery?(gallery_title=nil)
|
98
|
+
return polygalleries.any? if gallery_title.nil?
|
99
|
+
polygalleries.include?(gallery_title)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -109,9 +109,9 @@ module Polygallery
|
|
109
109
|
.map(&:title)
|
110
110
|
end
|
111
111
|
|
112
|
-
def has_polygallery?(
|
113
|
-
return polygalleries.any? if
|
114
|
-
polygalleries.include?(
|
112
|
+
def has_polygallery?(gallery_title=nil)
|
113
|
+
return polygalleries.any? if gallery_title.nil?
|
114
|
+
polygalleries.include?(gallery_title)
|
115
115
|
end
|
116
116
|
|
117
117
|
def build_galleries
|
@@ -120,17 +120,30 @@ module Polygallery
|
|
120
120
|
gallery_association = send pg
|
121
121
|
next if gallery_association.present?
|
122
122
|
gallery_settings = send :"#{pg.to_s}_settings"
|
123
|
-
gallery_association
|
124
|
-
|
123
|
+
gallery_association = send(:"#{pg.to_s}=", send(:"build_#{pg.to_s}",
|
124
|
+
:polygallery_options => gallery_settings)) if gallery_association.nil?
|
125
125
|
gallery_association.galleryable ||= self
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
129
|
def build_first_photos
|
130
|
-
build_galleries(&:build_first_photo)
|
131
130
|
return unless self.class.has_polygallery?
|
132
131
|
self.class.polygalleries.each {|pg| send(pg).build_first_photo }
|
133
132
|
end
|
133
|
+
|
134
|
+
def first_photo
|
135
|
+
return unless self.class.has_polygallery?
|
136
|
+
first_p = nil
|
137
|
+
self.class.polygalleries.each do |pg|
|
138
|
+
gallery_settings = send :"#{pg.to_s}_settings"
|
139
|
+
ptos = send(gallery_settings[:association_names][:photos])
|
140
|
+
.select{|p| p.photo.file? }
|
141
|
+
next if ptos.empty?
|
142
|
+
first_p = ptos.first.photo
|
143
|
+
break
|
144
|
+
end
|
145
|
+
first_p || Photo.new.photo
|
146
|
+
end
|
134
147
|
end
|
135
148
|
end
|
136
149
|
end
|
@@ -3,11 +3,12 @@ module Polygallery
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
attr_accessor :polygallery_options
|
7
6
|
end
|
8
7
|
|
9
8
|
module ClassMethods
|
10
9
|
def has_polyphotos(title=nil, options={})
|
10
|
+
attr_accessor :polygallery_options
|
11
|
+
|
11
12
|
defaults = self.polygallery_settings
|
12
13
|
association_names = (options[:association_names].present? ?
|
13
14
|
options : defaults)[:association_names]
|
@@ -46,7 +47,7 @@ module Polygallery
|
|
46
47
|
# end
|
47
48
|
|
48
49
|
def include_polygallery_settings(settings)
|
49
|
-
@polygallery_settings = settings
|
50
|
+
@polygallery_settings = self.polygallery_options = settings
|
50
51
|
self.initialize_polygallery
|
51
52
|
end
|
52
53
|
|
data/lib/polygallery/version.rb
CHANGED