Retrospring/app/views/layouts/_notifications.html.haml

121 lines
6.3 KiB
Plaintext
Raw Normal View History

2015-06-08 12:51:46 -07:00
= nav_entry t('views.navigation.notifications'), notifications_path, badge: notification_count, class: 'visible-xs'
- notifications = Notification.for(current_user).where(new: true).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-center
2015-01-26 08:50:45 -08:00
- if notifications.count == 0
%li.text-center
.notifications--none
%i.fa.fa-bell-o.no-notifications
%p No new notifications.
%li.text-center
%a{href: notifications_path('all')}
%i.fa.fa-fw.fa-chevron-right
Show all notifications
2015-01-26 08:50:45 -08:00
- else
- notifications.each do |notification|
%li
2015-01-26 08:50:45 -08:00
.media.notification--dropdown-media
- case notification.target_type
- when "Answer"
.pull-left
%i.fa.fa-2x.fa-fw.fa-exclamation
2015-01-26 08:50:45 -08:00
.media-body
.notification--heading
%img.notification--img-sm{src: notification.target.user.profile_picture.url(:small)}
2015-01-26 08:50:45 -08:00
= user_screen_name notification.target.user
answered
= link_to "your question", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id)
= time_tooltip(notification.target)
ago
.list-group.notification--list
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading question
.notification--list-content= markdown notification.target.question.content
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading answer
.notification--list-content= markdown notification.target.content
2015-01-26 08:50:45 -08:00
- when "Relationship"
.pull-left
%img.img-rounded.notification--dropdown-img{src: notification.target.source.profile_picture.url(:small)}
2015-01-26 08:50:45 -08:00
.media-body
%h6.media-heading.notification--dropdown-user
= user_screen_name notification.target.source
.notification--dropdown-text
= 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
%i.fa.fa-2x.fa-fw.fa-smile-o
2015-01-26 08:50:45 -08:00
.media-body
.notification--heading
%img.notification--img-sm{src: notification.target.user.profile_picture.url(:small)}
2015-01-26 08:50:45 -08:00
= user_screen_name notification.target.user
smiled
= link_to "your answer", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)
= time_tooltip(notification.target)
ago
.list-group.notification--list
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading answer
.notification--list-content= markdown notification.target.answer.content
- when "CommentSmile"
.pull-left
%i.fa.fa-2x.fa-fw.fa-smile-o
.media-body
.notification--heading
%img.notification--img-sm{src: notification.target.user.profile_picture.url(:small)}
= user_screen_name notification.target.user
smiled
= link_to "your comment", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.comment.answer.id)
= time_tooltip(notification.target)
ago
.list-group.notification--list
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading comment
.notification--list-content= markdown notification.target.comment.content
2015-01-26 08:50:45 -08:00
- when "Comment"
.pull-left
%i.fa.fa-2x.fa-fw.fa-comments
2015-01-26 08:50:45 -08:00
.media-body
.notification--heading
%img.notification--img-sm{src: notification.target.user.profile_picture.url(:small)}
2015-01-26 08:50:45 -08:00
= user_screen_name notification.target.user
commented on
- if notification.target.answer.user == current_user
= link_to "your answer", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)
- elsif notification.target.user == notification.target.answer.user
= link_to "their answer", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)
- else
= link_to "#{notification.target.answer.user.screen_name}'s answer", show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)
= time_tooltip(notification.target)
ago
.list-group.notification--list
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading answer
.notification--list-content= markdown notification.target.answer.content
.list-group-item
.media.question-media
.media-body
%h6.notification--list-heading comment
.notification--list-content= markdown notification.target.content
%li.text-center
%a{href: notifications_path}
%i.fa.fa-fw.fa-chevron-right
Show all new notifications