actually add some code here

This commit is contained in:
nilsding 2015-01-26 17:50:45 +01:00
parent 45e08651af
commit c8b02bbf50
1 changed files with 56 additions and 38 deletions

View File

@ -1,43 +1,61 @@
= nav_entry "Notifications", notifications_path, badge: notification_count .visible-xs= nav_entry "Notifications", notifications_path, badge: notification_count
- notifications = Notification.for(current_user).limit(4)
%li.dropdown.hidden-xs %li.dropdown.hidden-xs
%a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"} %a.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
Notifications Notifications
%span.badge= notification_count %span.badge= notification_count
%ul.dropdown-menu.notification--dropdown %ul.dropdown-menu.notification--dropdown
%li - if notifications.count == 0
.media.notification--dropdown-media %p New notifications will appear here.
.pull-left - else
%img.img-rounded.notification--dropdown-img - notifications.each do |notification|
.media-body %li{class: (notification.new? ? 'list-group-item-warning' : '')}
%h6.media-heading.notification--dropdown-user .media.notification--dropdown-media
username - case notification.target_type
.notification--dropdown-text - when "Answer"
followed you 33 minutes ago .pull-left
%li %img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
.media.notification--dropdown-media .media-body
.pull-left %h6.media-heading.notification--dropdown-user
%img.img-rounded.notification--dropdown-img = user_screen_name notification.target.user
.media-body .notification--dropdown-text
%h6.media-heading.notification--dropdown-user answered
username %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 }}
.notification--dropdown-text your question
smiled at your answer about 1 hour ago = time_ago_in_words notification.target.created_at
%li ago
.media.notification--dropdown-media - when "Relationship"
.pull-left .pull-left
%img.img-rounded.notification--dropdown-img %img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.source)}
.media-body .media-body
%h6.media-heading.notification--dropdown-user %h6.media-heading.notification--dropdown-user
username = user_screen_name notification.target.source
.notification--dropdown-text .notification--dropdown-text
answered your question about 4 hours ago followed you
%li = time_ago_in_words notification.target.created_at
.media.notification--dropdown-media ago
.pull-left - when "Smile"
%img.img-rounded.notification--dropdown-img .pull-left
.media-body %img.img-rounded.notification--dropdown-img{src: gravatar_url(notification.target.user)}
%h6.media-heading.notification--dropdown-user .media-body
username %h6.media-heading.notification--dropdown-user
.notification--dropdown-text = user_screen_name notification.target.user
commented on your answer about 5 hours ago .notification--dropdown-text
%li= link_to "Show all Notifications", notifications_path 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
- 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
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 }}
your 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