2015-01-26 08:53:23 -08:00
|
|
|
= nav_entry "Notifications", notifications_path, badge: notification_count, class: 'visible-xs'
|
2015-01-26 08:50:45 -08:00
|
|
|
- notifications = Notification.for(current_user).limit(4)
|
2015-01-26 08:16:32 -08:00
|
|
|
%li.dropdown.hidden-xs
|
|
|
|
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
|
2015-02-09 07:48:31 -08:00
|
|
|
- if notification_count.nil?
|
|
|
|
%i.fa.fa-bell-o
|
|
|
|
- else
|
|
|
|
%i.fa.fa-bell
|
|
|
|
%span.sr-only Notifications
|
2015-01-26 08:16:32 -08:00
|
|
|
%span.badge= notification_count
|
|
|
|
%ul.dropdown-menu.notification--dropdown
|
2015-01-26 08:50:45 -08:00
|
|
|
- if notifications.count == 0
|
2015-01-26 08:53:23 -08:00
|
|
|
%li.centre.text-muted New notifications will appear here.
|
2015-01-26 08:50:45 -08:00
|
|
|
- else
|
|
|
|
- notifications.each do |notification|
|
|
|
|
%li{class: (notification.new? ? 'list-group-item-warning' : '')}
|
|
|
|
.media.notification--dropdown-media
|
|
|
|
- case notification.target_type
|
|
|
|
- when "Answer"
|
|
|
|
.pull-left
|
|
|
|
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
|
|
|
|
.media-body
|
|
|
|
%h6.media-heading.notification--dropdown-user
|
|
|
|
= user_screen_name notification.target.user
|
|
|
|
.notification--dropdown-text
|
2015-06-06 16:28:10 -07:00
|
|
|
= 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))
|
2015-01-26 08:50:45 -08:00
|
|
|
- when "Relationship"
|
|
|
|
.pull-left
|
|
|
|
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.source)}
|
|
|
|
.media-body
|
|
|
|
%h6.media-heading.notification--dropdown-user
|
|
|
|
= user_screen_name notification.target.source
|
|
|
|
.notification--dropdown-text
|
2015-06-06 16:28:10 -07:00
|
|
|
= raw t('views.notifications.relationship.body', time: time_ago_in_words(notification.target.created_at))
|
2015-01-26 08:50:45 -08:00
|
|
|
- when "Smile"
|
|
|
|
.pull-left
|
|
|
|
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
|
|
|
|
.media-body
|
|
|
|
%h6.media-heading.notification--dropdown-user
|
|
|
|
= user_screen_name notification.target.user
|
|
|
|
.notification--dropdown-text
|
2015-06-06 16:28:10 -07:00
|
|
|
= 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))
|
2015-05-03 18:39:41 -07:00
|
|
|
- when "CommentSmile"
|
|
|
|
.pull-left
|
|
|
|
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
|
|
|
|
.media-body
|
|
|
|
%h6.media-heading.notification--dropdown-user
|
|
|
|
= user_screen_name notification.target.user
|
|
|
|
.notification--dropdown-text
|
2015-06-06 16:28:10 -07:00
|
|
|
= 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))
|
2015-01-26 08:50:45 -08:00
|
|
|
- when "Comment"
|
|
|
|
.pull-left
|
|
|
|
%img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
|
|
|
|
.media-body
|
|
|
|
%h6.media-heading.notification--dropdown-user
|
|
|
|
= user_screen_name notification.target.user
|
|
|
|
.notification--dropdown-text
|
2015-06-06 16:28:10 -07:00
|
|
|
/ TODO: holy fuck I'm not going to touch this with locales for now, this one will be complicated.
|
2015-01-26 08:50:45 -08:00
|
|
|
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 }}
|
2015-04-21 06:46:43 -07:00
|
|
|
- if notification.target.answer.user == current_user
|
|
|
|
your
|
|
|
|
- elsif notification.target.user == notification.target.answer.user
|
|
|
|
their
|
|
|
|
- else
|
|
|
|
= user_screen_name(notification.target.answer.user, false, false) + "'s"
|
|
|
|
answer
|
2015-01-26 08:50:45 -08:00
|
|
|
= time_ago_in_words notification.target.created_at
|
|
|
|
ago
|
2015-06-06 16:28:10 -07:00
|
|
|
%li= link_to "#{t('views.notifications.show')}#{t('views.notifications.mark') if notifications.pluck(:new).any?}", notifications_path
|