RS IZ photos now fade in on the album upload page
This commit is contained in:
parent
a534d6424e
commit
f6495e2bec
4 changed files with 24 additions and 4 deletions
|
|
@ -18,7 +18,11 @@ module SocketsHelper
|
|||
puts e.message
|
||||
raise e
|
||||
end
|
||||
{:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object)}.to_json
|
||||
if object.is_a? Photo
|
||||
{:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object), :photo_hash => object.thumb_hash }.to_json
|
||||
else
|
||||
{:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object)}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -51,4 +51,8 @@ class Photo < Post
|
|||
user.profile.update_attributes!(:image_url => nil)
|
||||
end
|
||||
end
|
||||
|
||||
def thumb_hash
|
||||
{:thumb_url => image.url(:thumb_medium), :id => id, :album_id => album_id}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
-unless mine? @album
|
||||
%h4= "by #{@album.person.real_name}"
|
||||
|
||||
- for photo in @album_photos
|
||||
.image_thumb
|
||||
= link_to (image_tag photo.image.url(:thumb_medium)), object_path(photo)
|
||||
#thumbnails
|
||||
- for photo in @album_photos
|
||||
.image_thumb
|
||||
= link_to (image_tag photo.image.url(:thumb_medium)), object_path(photo)
|
||||
|
||||
#content_bottom
|
||||
.back
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
}else if (obj['class']=="comments"){
|
||||
processComment(obj['post_id'], obj['html'])
|
||||
|
||||
}else if (obj['class']=='photos' && onPageForClass('albums')){
|
||||
processPhotoInAlbum(obj['photo_hash'])
|
||||
}else{
|
||||
processPost(obj['class'], obj['html'])
|
||||
}
|
||||
|
|
@ -53,6 +55,15 @@
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
function processPhotoInAlbum(photoHash){
|
||||
if (location.href.indexOf(photoHash['album_id']) == -1){
|
||||
return ;
|
||||
}
|
||||
html = "<div class=\'image_thumb\'> <a href=\"/photos/"+ photoHash['id'] +"\"><img alt=\"New thumbnail\" src=\""+ photoHash['thumb_url'] +"\" style=\"display:inline;\" /> </a> </div>"
|
||||
$("#thumbnails").append( $(html).fadeIn("fast") )
|
||||
|
||||
}
|
||||
|
||||
function onPageForClass(className){
|
||||
return ((location.href.indexOf(className) != -1 ) || (location.pathname == '/')) && onPageOne();
|
||||
|
|
|
|||
Loading…
Reference in a new issue