polygallery 0.3.0 → 0.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0a3c6b4e971bb81a4dd78e1a5ec302567ed4cb8
|
4
|
+
data.tar.gz: ec32be1af52c2330bc71e19c5c7fefe1661b4e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1610028948fd06e4aef2f24ac1e827abe7d0a847d0f402b282ca59f308bf9d9ef947f60ea77a137a855a49d90f4b07cc29755d51fba5ca394412d2f59823d2c
|
7
|
+
data.tar.gz: 20abcb8fa59f46442c4ca5d998f917122d6f6b570d74bc9ff8dd870edbba9aabd804c5490c8f430d7ef4daadcb0d1163b5d68608db1060307e9c7034fadbb175
|
@@ -114,6 +114,15 @@ module Polygallery
|
|
114
114
|
self.class.init_attachment paperclip_settings
|
115
115
|
end
|
116
116
|
|
117
|
+
def remote_url(style=nil)
|
118
|
+
host = ActionController::Base.asset_host
|
119
|
+
host = "http://#{host}" unless host.nil? || host =~ /^http/
|
120
|
+
path = photo.url(style)
|
121
|
+
url = (host||'') + (path||'')
|
122
|
+
url unless url.blank?
|
123
|
+
end
|
124
|
+
def thumb_url; remote_url(:thumb) end
|
125
|
+
|
117
126
|
end
|
118
127
|
end
|
119
128
|
end
|
@@ -183,19 +183,13 @@ module Polygallery
|
|
183
183
|
build_gallery_associations.map(&:build_first_photo)
|
184
184
|
end
|
185
185
|
|
186
|
-
def
|
187
|
-
return unless
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
ptos = send(settings_for_this_gallery[:association_names][:photos])
|
192
|
-
.select{|p| p.photo.file? }
|
193
|
-
next if ptos.empty?
|
194
|
-
first_p = ptos.first.photo
|
195
|
-
break
|
196
|
-
end
|
197
|
-
first_p || Photo.new.photo
|
186
|
+
def first_polyphoto
|
187
|
+
return Photo.new unless gallery_associations.any?
|
188
|
+
fg = gallery_associations.to_a.find{|pg| pg.photos.any? }
|
189
|
+
return Photo.new if fg.nil?
|
190
|
+
fg.first_photo
|
198
191
|
end
|
192
|
+
def first_photo; first_polyphoto.photo end
|
199
193
|
|
200
194
|
def ensure_galleryable_set
|
201
195
|
gallery_associations.each do |ga|
|
@@ -211,6 +205,10 @@ module Polygallery
|
|
211
205
|
def prune_empty_photos
|
212
206
|
gallery_associations.each(&:prune_empty_photos) end
|
213
207
|
|
208
|
+
def remote_urls_for_polyphotos(style=nil)
|
209
|
+
gallery_associations.map{|ga| ga.remote_urls(style) }.flatten end
|
210
|
+
def thumb_url; first_polyphoto.thumb_url end
|
211
|
+
|
214
212
|
end
|
215
213
|
end
|
216
214
|
end
|
@@ -165,6 +165,13 @@ module Polygallery
|
|
165
165
|
end }
|
166
166
|
end
|
167
167
|
|
168
|
+
def remote_urls(style=nil); photos.map{|p| p.remote_url style } || [] end
|
169
|
+
def thumb_url; first_photo.thumb_url end
|
170
|
+
def first_photo
|
171
|
+
# TODO: some kind of selection
|
172
|
+
photos.first || Photo.new
|
173
|
+
end
|
174
|
+
|
168
175
|
end
|
169
176
|
end
|
170
177
|
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.1
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|