Skip to content
Extraits de code Groupes Projets
Valider b8d96108 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

added translation to the likes popup, made the notification models a little clearer

parent f6765324
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
module NotificationsHelper
def object_link(note)
target_type = note.translation_key
target_type = note.popup_translation_key
if note.instance_of?(Notifications::Mentioned)
post = Mention.find(note.target_id).post
if post
......@@ -8,10 +8,6 @@ module NotificationsHelper
else
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
end
elsif note.instance_of?(Notifications::RequestAccepted)
translation(target_type)
elsif note.instance_of?(Notifications::NewRequest)
translation(target_type)
elsif note.instance_of?(Notifications::CommentOnPost)
post = Post.where(:id => note.target_id).first
if post
......@@ -26,11 +22,13 @@ module NotificationsHelper
else
t('notifications.also_commented_deleted')
end
else #Notifications::NewRequest, Notifications::RequestAccepted, Notifications::Liked, etc.
translation(target_type)
end
end
def translation(target_type, post_author = nil)
t("notifications.#{target_type}", :post_author => post_author)
t("#{target_type}", :post_author => post_author)
end
......
......@@ -2,7 +2,7 @@ class Notifications::AlsoCommented < Notification
def mail_job
Job::MailAlsoCommented
end
def translation_key
'also_commented'
def popup_translation_key
'notifications.also_commented'
end
end
......@@ -2,7 +2,7 @@ class Notifications::CommentOnPost < Notification
def mail_job
Job::MailCommentOnPost
end
def translation_key
'comment_on_post'
def popup_translation_key
'notifications.comment_on_post'
end
end
......@@ -2,7 +2,7 @@ class Notifications::Liked < Notification
def mail_job
Job::MailLiked
end
def translation_key
'liked'
def popup_translation_key
'notifications.liked'
end
end
......@@ -2,7 +2,7 @@ class Notifications::Mentioned < Notification
def mail_job
Job::MailMentioned
end
def translation_key
'mentioned'
def popup_translation_key
'notifications.mentioned'
end
end
......@@ -2,7 +2,7 @@ class Notifications::NewRequest < Notification
def mail_job
Job::MailRequestReceived
end
def translation_key
'new_request'
def popup_translation_key
'notifications.new_request'
end
end
......@@ -2,8 +2,8 @@ class Notifications::PrivateMessage < Notification
def mail_job
Job::MailPrivateMessage
end
def translation_key
'private_message'
def popup_translation_key
'notifications.private_message'
end
def self.make_notification(recipient, target, actor, notification_type)
n = notification_type.new(:target => target,
......
......@@ -2,7 +2,7 @@ class Notifications::RequestAccepted < Notification
def mail_job
Job::MailRequestAcceptance
end
def translation_key
'request_accepted'
def popup_translation_key
'notifications.request_accepted'
end
end
......@@ -2,11 +2,12 @@
= t('notifier.hello', :name => @receiver.profile.first_name)
%p
= t('.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
= @like.post.text
%br
= link_to t('.sign_in'), status_message_url(@like.post)
%br
= t('notifier.love')
= t('notifier.love')
%br
= t('notifier.diaspora')
!= t('notifier.hello', :name => @receiver.profile.first_name)
!= t('.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
!= t('notifier.liked.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
!= @like.post.text
!= link_to t('.sign_in'), status_message_url(@like.post)
!= t('notifier.love')
!= t('notifier.love')
!= t('notifier.diaspora')
......@@ -290,6 +290,7 @@ en:
comment_on_post: "commented on your"
also_commented: "also commented on %{post_author}'s"
mentioned: "has mentioned you in a "
liked: "has just liked your post"
post: "post."
deleted: "deleted"
also_commented_deleted: "commented on a deleted post."
......@@ -343,7 +344,7 @@ en:
sign_in: "Sign in to view it."
liked:
subject: "%{name} has just liked your post"
liked: "%{name} has just liked your post"
liked: "%{name} has just liked your post: "
sign_in: "Sign to view it"
people:
......
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