added translation to the likes popup, made the notification models a little clearer
This commit is contained in:
parent
f6765324da
commit
b8d9610877
11 changed files with 25 additions and 26 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
module NotificationsHelper
|
module NotificationsHelper
|
||||||
def object_link(note)
|
def object_link(note)
|
||||||
target_type = note.translation_key
|
target_type = note.popup_translation_key
|
||||||
if note.instance_of?(Notifications::Mentioned)
|
if note.instance_of?(Notifications::Mentioned)
|
||||||
post = Mention.find(note.target_id).post
|
post = Mention.find(note.target_id).post
|
||||||
if post
|
if post
|
||||||
|
|
@ -8,10 +8,6 @@ module NotificationsHelper
|
||||||
else
|
else
|
||||||
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
|
"#{translation(target_type)} #{t('notifications.deleted')} #{t('notifications.post')}"
|
||||||
end
|
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)
|
elsif note.instance_of?(Notifications::CommentOnPost)
|
||||||
post = Post.where(:id => note.target_id).first
|
post = Post.where(:id => note.target_id).first
|
||||||
if post
|
if post
|
||||||
|
|
@ -26,11 +22,13 @@ module NotificationsHelper
|
||||||
else
|
else
|
||||||
t('notifications.also_commented_deleted')
|
t('notifications.also_commented_deleted')
|
||||||
end
|
end
|
||||||
|
else #Notifications::NewRequest, Notifications::RequestAccepted, Notifications::Liked, etc.
|
||||||
|
translation(target_type)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def translation(target_type, post_author = nil)
|
def translation(target_type, post_author = nil)
|
||||||
t("notifications.#{target_type}", :post_author => post_author)
|
t("#{target_type}", :post_author => post_author)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::AlsoCommented < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailAlsoCommented
|
Job::MailAlsoCommented
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'also_commented'
|
'notifications.also_commented'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::CommentOnPost < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailCommentOnPost
|
Job::MailCommentOnPost
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'comment_on_post'
|
'notifications.comment_on_post'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::Liked < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailLiked
|
Job::MailLiked
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'liked'
|
'notifications.liked'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::Mentioned < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailMentioned
|
Job::MailMentioned
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'mentioned'
|
'notifications.mentioned'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::NewRequest < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailRequestReceived
|
Job::MailRequestReceived
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'new_request'
|
'notifications.new_request'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ class Notifications::PrivateMessage < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailPrivateMessage
|
Job::MailPrivateMessage
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'private_message'
|
'notifications.private_message'
|
||||||
end
|
end
|
||||||
def self.make_notification(recipient, target, actor, notification_type)
|
def self.make_notification(recipient, target, actor, notification_type)
|
||||||
n = notification_type.new(:target => target,
|
n = notification_type.new(:target => target,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Notifications::RequestAccepted < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Job::MailRequestAcceptance
|
Job::MailRequestAcceptance
|
||||||
end
|
end
|
||||||
def translation_key
|
def popup_translation_key
|
||||||
'request_accepted'
|
'notifications.request_accepted'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
= t('notifier.hello', :name => @receiver.profile.first_name)
|
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||||
%p
|
%p
|
||||||
= t('.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
|
= t('.liked', :name => "#{@sender.name} (#{@sender.diaspora_handle})")
|
||||||
|
= @like.post.text
|
||||||
|
|
||||||
%br
|
%br
|
||||||
= link_to t('.sign_in'), status_message_url(@like.post)
|
= link_to t('.sign_in'), status_message_url(@like.post)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
!= t('notifier.hello', :name => @receiver.profile.first_name)
|
!= 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')
|
!= t('notifier.diaspora')
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ en:
|
||||||
comment_on_post: "commented on your"
|
comment_on_post: "commented on your"
|
||||||
also_commented: "also commented on %{post_author}'s"
|
also_commented: "also commented on %{post_author}'s"
|
||||||
mentioned: "has mentioned you in a "
|
mentioned: "has mentioned you in a "
|
||||||
|
liked: "has just liked your post"
|
||||||
post: "post."
|
post: "post."
|
||||||
deleted: "deleted"
|
deleted: "deleted"
|
||||||
also_commented_deleted: "commented on a deleted post."
|
also_commented_deleted: "commented on a deleted post."
|
||||||
|
|
@ -343,7 +344,7 @@ en:
|
||||||
sign_in: "Sign in to view it."
|
sign_in: "Sign in to view it."
|
||||||
liked:
|
liked:
|
||||||
subject: "%{name} has just liked your post"
|
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"
|
sign_in: "Sign to view it"
|
||||||
|
|
||||||
people:
|
people:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue