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
|
puts e.message
|
||||||
raise e
|
raise e
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,8 @@ class Photo < Post
|
||||||
user.profile.update_attributes!(:image_url => nil)
|
user.profile.update_attributes!(:image_url => nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def thumb_hash
|
||||||
|
{:thumb_url => image.url(:thumb_medium), :id => id, :album_id => album_id}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@
|
||||||
-unless mine? @album
|
-unless mine? @album
|
||||||
%h4= "by #{@album.person.real_name}"
|
%h4= "by #{@album.person.real_name}"
|
||||||
|
|
||||||
- for photo in @album_photos
|
#thumbnails
|
||||||
.image_thumb
|
- for photo in @album_photos
|
||||||
= link_to (image_tag photo.image.url(:thumb_medium)), object_path(photo)
|
.image_thumb
|
||||||
|
= link_to (image_tag photo.image.url(:thumb_medium)), object_path(photo)
|
||||||
|
|
||||||
#content_bottom
|
#content_bottom
|
||||||
.back
|
.back
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
}else if (obj['class']=="comments"){
|
}else if (obj['class']=="comments"){
|
||||||
processComment(obj['post_id'], obj['html'])
|
processComment(obj['post_id'], obj['html'])
|
||||||
|
|
||||||
|
}else if (obj['class']=='photos' && onPageForClass('albums')){
|
||||||
|
processPhotoInAlbum(obj['photo_hash'])
|
||||||
}else{
|
}else{
|
||||||
processPost(obj['class'], obj['html'])
|
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){
|
function onPageForClass(className){
|
||||||
return ((location.href.indexOf(className) != -1 ) || (location.pathname == '/')) && onPageOne();
|
return ((location.href.indexOf(className) != -1 ) || (location.pathname == '/')) && onPageOne();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue