polygallery 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15e72642e0f8c0612f6f1bb63e143a82d7dd4a01
|
4
|
+
data.tar.gz: caa241c4e009957b8e25ba9a8f0c7aeed7fdbcdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c6fefcd47df94447684084c53dd205d86f1876183015f98765d4a4c18d27ae541f87c62c51ed25d5d8044c6feb291dd3724c385924406533d3f4ec7e554c718
|
7
|
+
data.tar.gz: 178ce2a28fedabfffe6de98bd9668f52299a9ec8fd9d9d8f46164c42942ceca071f65d058315273c971debae5f9482d218a99179fb5b8b88462e75299f28d07d
|
@@ -10,6 +10,7 @@ module Polygallery
|
|
10
10
|
|
11
11
|
attr_accessor :photo_to_upload, :polygallery_options,
|
12
12
|
:polyphoto_initialized
|
13
|
+
attr_reader :photo_remote_url
|
13
14
|
|
14
15
|
init_attachment settings[:paperclip]
|
15
16
|
init_associations settings
|
@@ -116,7 +117,7 @@ module Polygallery
|
|
116
117
|
# could find a better way, though...
|
117
118
|
#
|
118
119
|
# This part runs the second try.
|
119
|
-
if photo_updated_at_changed? && gallery.present? &&
|
120
|
+
if (new_record? || photo_updated_at_changed?) && gallery.present? &&
|
120
121
|
photo_to_upload.present? && File.exists?(photo_to_upload)
|
121
122
|
# puts 'Running the swaparoo!'
|
122
123
|
File.open(photo_to_upload, 'rb') {|h| self.photo = h }
|
@@ -149,6 +150,16 @@ module Polygallery
|
|
149
150
|
end
|
150
151
|
def thumb_url; remote_url(:thumb) end
|
151
152
|
|
153
|
+
def process_remote_uri(uri)
|
154
|
+
require 'open-uri'
|
155
|
+
require 'open_uri_redirections'
|
156
|
+
open(uri, allow_redirections: :safe) {|r| r.base_uri.to_s }
|
157
|
+
end
|
158
|
+
def photo_remote_url=(url_value)
|
159
|
+
self.photo = URI.parse process_remote_uri(url_value)
|
160
|
+
@photo_remote_url = url_value
|
161
|
+
end
|
162
|
+
|
152
163
|
end
|
153
164
|
end
|
154
165
|
end
|
@@ -7,7 +7,8 @@ FactoryGirl.define do
|
|
7
7
|
|
8
8
|
factory :polygallery_photo, :class => Polygallery::Photo do
|
9
9
|
caption { [nil, MFaker::BaconIpsum.paragraph].sample }
|
10
|
-
photo
|
11
|
-
# photo_to_upload
|
10
|
+
# photo {
|
11
|
+
# File.new(get_random_photo) if photo_to_upload.nil? && photo_remote_url.nil? }
|
12
|
+
photo_to_upload { get_random_photo if photo.nil? && photo_remote_url.nil? }
|
12
13
|
end
|
13
14
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
MFaker = defined?(Faker) ? Faker : FFaker
|
2
2
|
|
3
|
-
require 'polygallery/factories/polygallery/galleries'
|
4
|
-
require 'polygallery/factories/polygallery/photos'
|
5
|
-
|
6
3
|
def get_random_photo
|
7
4
|
photos_dir = Rails.root.join 'spec', 'upload_files'
|
5
|
+
raise "No test files found at #{photos_dir}." unless File.exists? photos_dir
|
8
6
|
Dir.glob(photos_dir.join('*.{jpg,png,gif}')).sample
|
9
7
|
end
|
8
|
+
|
9
|
+
require 'polygallery/factories/polygallery/galleries'
|
10
|
+
require 'polygallery/factories/polygallery/photos'
|
@@ -7,8 +7,8 @@ module Polygallery
|
|
7
7
|
:_destroy, polyphoto_params(photos_title) ] }
|
8
8
|
end
|
9
9
|
def self.polyphoto_params(title=:photos)
|
10
|
-
{:"#{title}_attributes" => [:id, :photo, :
|
11
|
-
:gallery_id,
|
10
|
+
{:"#{title}_attributes" => [:id, :photo, :photo_remote_url, :photo_to_upload,
|
11
|
+
:title, :caption, :gallery_title, :gallery_id,
|
12
12
|
:galleryable_id, :galleryable_type, :_destroy] }
|
13
13
|
end
|
14
14
|
def polygallery_params(title=:gallery, photos_title=:photos)
|
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.4.
|
4
|
+
version: 0.4.4
|
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-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: zeus
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: paperclip
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|