diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index e8a1d30cf4ce66b876ccdf677e8eaf5ff78f2ccf..b60e9a0b0af5c4974fb9ae4d41b465f59b224495 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -15,14 +15,14 @@ module NotificationsHelper elsif note.instance_of?(Notifications::CommentOnPost) post = Post.where(:id => note.target_id).first if post - "#{translation(target_type)} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type)} #{link_to t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link'}".html_safe else "#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}" end elsif note.instance_of?(Notifications::AlsoCommented) post = Post.where(:id => note.target_id).first if post - "#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), object_path(post)}".html_safe + "#{translation(target_type, post.author.name)} #{link_to t('notifications.post'), object_path(post), 'data-ref' => post.id, :class => 'hard_object_link'}".html_safe else t('notifications.also_commented_deleted') end diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml index ffe72755387b906d3382858fb131eb971cd64d60..cd1b8c108dbe604c3d4e1d5226507620feef77a4 100644 --- a/app/views/comments/_comment.html.haml +++ b/app/views/comments/_comment.html.haml @@ -2,7 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -%li.comment{:data=>{:guid => comment.id}, :class => ("hidden" if(defined? hidden))} +%li.comment.posted{:data=>{:guid => comment.id}, :class => ("hidden" if(defined? hidden))} = person_image_link(comment.author) .content .from diff --git a/public/javascripts/view.js b/public/javascripts/view.js index ed0caf9504c506d5b4a6f65f9919ee225720c4df..d9c9cf93212cdb7506ac6c8fc99f3ee802b1e6e9 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -61,6 +61,17 @@ var View = { /* facebox 'done' buttons */ $("a[rel*=close]").live('click', function(){ $.facebox.close() }); + + /* notification routing */ + $("#notification").delegate('.hard_object_link', 'click', function(evt){ + var post = $("*[data-guid='"+ $(this).attr('data-ref') +"']"), + lastComment = post.find('.comment.posted').last(); + + if(post.length > 0){ + evt.preventDefault(); + $('html, body').animate({scrollTop: parseInt(lastComment.offset().top)-80 }, 'fast'); + } + }); }, addAspectButton: {