diff --git a/app/views/status_messages/_status_message.haml b/app/views/status_messages/_status_message.haml index cd1aa377c..8c9f5306d 100644 --- a/app/views/status_messages/_status_message.haml +++ b/app/views/status_messages/_status_message.haml @@ -5,14 +5,17 @@ - if photos.size > 0 .photo_attachments - = link_to (image_tag photos.first.url(:scaled_full)), photo_path(photos.first) + .key_photo + = link_to (image_tag photos.first.url(:scaled_full)), photo_path(photos.first) + %br - if photos.size > 1 - if photos.size >= 8 - for photo in photos[1..8] = link_to (image_tag photo.url(:thumb_small)), photo_path(photo) - else - - for photo in photos[1..photos.size] - = link_to (image_tag photo.url(:thumb_small)), photo_path(photo) + .thumbs + - for photo in photos + = link_to (image_tag photo.url(:thumb_small)), photo_path(photo) = markdownify(post.message, :youtube_maps => post[:youtube_titles]) - else diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 83da99d72..70eb60826 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -16,7 +16,9 @@ var Stream = { $(this).parent().html("");} }); - + $('.thumbs img').live('hover', function(){ + Stream.replaceKeyPhoto($(this)); + }); // comment link form focus $stream.delegate(".focus_comment_textarea", "click", function(e){ Stream.focusNewComment($(this), e); @@ -127,7 +129,19 @@ var Stream = { commentBlock.find('textarea').focus(); } } + }, + + replaceKeyPhoto: function(photo){ + var show_url = photo.parent().first()[0].href + var img_url = photo.first()[0].src; + var large_url = img_url.replace("thumb_small", "scaled_full"); + var key_photo = photo.parent().parent().siblings('.key_photo') + var key_photo_img = key_photo.find('img'); + key_photo_img.attr('height', key_photo_img.height()); + key_photo_img.attr('src', large_url); + key_photo.find('a').attr('href', show_url); } + }; $(document).ready(Stream.initialize);