Skip to content
Extraits de code Groupes Projets
Valider b6d5165f rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

scroll to post on page if you can see it (via notification popup)

parent 18c7c467
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
......
......@@ -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
......
......@@ -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: {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter