RS, IZ fixed the url for the image
This commit is contained in:
parent
f6892b88d6
commit
5cae2b21b1
3 changed files with 9 additions and 3 deletions
|
|
@ -44,12 +44,13 @@ class Photo < Post
|
||||||
def remote_photo= remote_path
|
def remote_photo= remote_path
|
||||||
name_start = remote_path.rindex '/'
|
name_start = remote_path.rindex '/'
|
||||||
self.remote_photo_path = remote_path.slice(0, name_start )
|
self.remote_photo_path = remote_path.slice(0, name_start )
|
||||||
self.remote_photo_name = remote_path.slice(name_start, remote_path.length)
|
self.remote_photo_name = remote_path.slice(name_start + 1, remote_path.length)
|
||||||
end
|
end
|
||||||
|
|
||||||
def url(name = nil)
|
def url(name = nil)
|
||||||
if remote_photo_path
|
if remote_photo_path
|
||||||
person.url.chop + remote_photo_path + name.to_s + remote_photo_name
|
name = name.to_s + "_" if name
|
||||||
|
person.url.chop + remote_photo_path + "/" + name.to_s + remote_photo_name
|
||||||
else
|
else
|
||||||
image.url name
|
image.url name
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
= link_to post.album.name, object_path(post.album)
|
= link_to post.album.name, object_path(post.album)
|
||||||
|
|
||||||
%br
|
%br
|
||||||
= link_to (image_tag post.image.url(:thumb_large)), object_path(post)
|
= link_to (image_tag post.url(:thumb_large)), object_path(post)
|
||||||
|
|
||||||
%div.time
|
%div.time
|
||||||
= link_to(how_long_ago(post), photo_path(post))
|
= link_to(how_long_ago(post), photo_path(post))
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,9 @@ describe Photo do
|
||||||
@photo.save
|
@photo.save
|
||||||
@photo.reload
|
@photo.reload
|
||||||
|
|
||||||
|
url = @photo.url
|
||||||
|
thumb_url = @photo.url :thumb_medium
|
||||||
|
|
||||||
xml = @photo.to_diaspora_xml
|
xml = @photo.to_diaspora_xml
|
||||||
id = @photo.id
|
id = @photo.id
|
||||||
|
|
||||||
|
|
@ -123,6 +126,8 @@ describe Photo do
|
||||||
|
|
||||||
new_photo = Photo.first(:id => id)
|
new_photo = Photo.first(:id => id)
|
||||||
new_photo.url.nil?.should be false
|
new_photo.url.nil?.should be false
|
||||||
|
new_photo.url.include?(url).should be true
|
||||||
|
new_photo.url(:thumb_medium).include?(thumb_url).should be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue