localize notifications (except comments)

This commit is contained in:
pixeldesu 2015-06-07 01:28:10 +02:00
parent 45ec9ebdff
commit b8c0032986
5 changed files with 43 additions and 54 deletions

View File

@ -23,11 +23,7 @@
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
answered
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id), title: "#{notification.target.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your question
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.answer.body', question: link_to(t('views.notifications.answer.question'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id)), time: time_ago_in_words(notification.target.created_at))
- when "Relationship"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.source)}
@ -35,9 +31,7 @@
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.source
.notification--dropdown-text
followed you
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.relationship.body', time: time_ago_in_words(notification.target.created_at))
- when "Smile"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
@ -45,11 +39,7 @@
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your answer
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.smile.body', content: link_to(t('views.notifications.smile.answer'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_ago_in_words(notification.target.created_at))
- when "CommentSmile"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
@ -57,11 +47,7 @@
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.comment.answer.id), title: "#{notification.target.comment.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your comment
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.smile.body', content: link_to(t('views.notifications.smile.comment'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_ago_in_words(notification.target.created_at))
- when "Comment"
.pull-left
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
@ -69,6 +55,7 @@
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.user
.notification--dropdown-text
/ TODO: holy fuck I'm not going to touch this with locales for now, this one will be complicated.
commented on
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
- if notification.target.answer.user == current_user
@ -80,4 +67,4 @@
answer
= time_ago_in_words notification.target.created_at
ago
%li= link_to "Show all notifications#{" and mark them as read" if notifications.pluck(:new).any?}", notifications_path
%li= link_to "#{t('views.notifications.show')}#{t('views.notifications.mark') if notifications.pluck(:new).any?}", notifications_path

View File

@ -8,12 +8,7 @@
%h6.media-heading.notification--user
= user_screen_name notification.target.user
%p.notification--text
answered
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id), title: "#{notification.target.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your question
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.answer.body', question: link_to(t('views.notifications.answer.question'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id)), time: time_tooltip(notification.target))
.notification--icon
%i.fa.fa-exclamation
- when "Relationship"
@ -23,10 +18,7 @@
%h6.media-heading.notification--user
= user_screen_name notification.target.source
%p.notification--text
followed you
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.relationship.body', time: time_tooltip(notification.target))
.notification--icon
%i.fa.fa-users
- when "Smile"
@ -36,12 +28,7 @@
%h6.media-heading.notification--user
= user_screen_name notification.target.user
%p.notification--text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your answer
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.smile.body', content: link_to(t('views.notifications.smile.answer'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_tooltip(notification.target))
.notification--icon
%i.fa.fa-smile-o
- when "CommentSmile"
@ -51,12 +38,7 @@
%h6.media-heading.notification--user
= user_screen_name notification.target.user
%p.notification--text
smiled at
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.comment.answer.id), title: "#{notification.target.comment.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
your comment
%span{title: notification.target.created_at, data: { toggle: :tooltip, placement: :bottom }}
= time_ago_in_words notification.target.created_at
ago
= raw t('views.notifications.smile.body', content: link_to(t('views.notifications.smile.comment'), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_tooltip(notification.target))
.notification--icon
%i.fa.fa-smile-o
- when "Comment"
@ -66,6 +48,7 @@
%h6.media-heading.notification--user
= user_screen_name notification.target.user
%p.notification--text
/ TODO: holy fuck I'm not going to touch this with locales for now, this one will be complicated.
commented on
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
- if notification.target.answer.user == current_user

View File

@ -6,12 +6,12 @@
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{href: "/"} Notifications
%a.navbar-brand{href: notifications_path} Notifications
#j2-tl-navbar-collapse.collapse.navbar-collapse
%ul.nav.navbar-nav
= nav_entry "All notifications", notifications_path
= nav_entry "Answers", notifications_path('answer')
= nav_entry "Smiles", notifications_path('smile')
= nav_entry "Comments", notifications_path('comment')
= nav_entry "Comment Smiles", notifications_path('commentsmile')
= nav_entry "Followers", notifications_path('relationship')
= nav_entry t('views.notifications.tabs.all'), notifications_path
= nav_entry t('views.notifications.tabs.answer'), notifications_path('answer')
= nav_entry t('views.notifications.tabs.smile'), notifications_path('smile')
= nav_entry t('views.notifications.tabs.comment'), notifications_path('comment')
= nav_entry t('views.notifications.tabs.commentsmile'), notifications_path('commentsmile')
= nav_entry t('views.notifications.tabs.relationship'), notifications_path('relationship')

View File

@ -1,9 +1,9 @@
.col-md-3.col-xs-12.col-sm-3
.panel.panel-default.hidden-xs
.list-group
= list_group_item "All notifications", notifications_path, badge: Notification.for(current_user).where(new: true).count
= list_group_item "Answers", notifications_path('answer'), badge: Notification.for(current_user).where(target_type: "Answer", new: true).count
= list_group_item "Smiles", notifications_path('smile'), badge: Notification.for(current_user).where(target_type: "Smile", new: true).count
= list_group_item "Comments", notifications_path('comment'), badge: Notification.for(current_user).where(target_type: "Comment", new: true).count
= list_group_item "Comment Smiles", notifications_path('commentsmile'), badge: Notification.for(current_user).where(target_type: "CommentSmile", new: true).count
= list_group_item "Followers", notifications_path('relationship'), badge: Notification.for(current_user).where(target_type: "Relationship", new: true).count
= list_group_item t('views.notifications.tabs.all'), notifications_path, badge: Notification.for(current_user).where(new: true).count
= list_group_item t('views.notifications.tabs.answer'), notifications_path('answer'), badge: Notification.for(current_user).where(target_type: "Answer", new: true).count
= list_group_item t('views.notifications.tabs.smile'), notifications_path('smile'), badge: Notification.for(current_user).where(target_type: "Smile", new: true).count
= list_group_item t('views.notifications.tabs.comment'), notifications_path('comment'), badge: Notification.for(current_user).where(target_type: "Comment", new: true).count
= list_group_item t('views.notifications.tabs.commentsmile'), notifications_path('commentsmile'), badge: Notification.for(current_user).where(target_type: "CommentSmile", new: true).count
= list_group_item t('views.notifications.tabs.relationship'), notifications_path('relationship'), badge: Notification.for(current_user).where(target_type: "Relationship", new: true).count

View File

@ -23,6 +23,25 @@ en:
views:
messages:
noscript: "Please activate JavaScript."
notifications:
show: "Show all notifications"
mark: " and mark them as read"
answer:
body: "answered %{question} %{time} ago"
question: "your question"
relationship:
body: "followed you %{time} ago"
smile:
body: "smiled at %{content} %{time} ago" # content v
answer: "your answer" # content if smile
comment: "your comment" # content if commentsmile
tabs:
all: "All notifications"
answer: "Answers"
smile: "Smiles"
comment: "Comments"
commentsmile: "Comment Smiles"
relationship: "Followers"
inbox:
empty: "Nothing to see here."
sidebar: