-
Notifications
You must be signed in to change notification settings - Fork 435
/
_notifications_list.html.haml
45 lines (43 loc) · 2.71 KB
/
_notifications_list.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.card
.card-body
- if notifications.empty?
%p
- case selected_filter[:type]
- when 'reviews', 'comments', 'requests'
There are no notifications for this filter
- when 'read'
Mark notifications as "Read" and they'll appear here
- else
There are no notifications, but there's a world of opportunities!
- else
.text-center
%span.ml-3= page_entries_info notifications, entry_name: 'notification'
= link_to_all unless notifications.total_pages == 1 && params[:show_all].nil?
.list-group.list-group-flush.mt-3
- notifications.each do |n|
- notification = NotificationPresenter.new(n)
.list-group-item.px-2.notifications-grid-container
.notifiable
- if notification.notifiable_type == 'BsRequest'
= image_tag('icons/request-icon.svg', height: 18, title: 'Request notification')
= link_to(notification.notifiable_link[:text], notification.notifiable_link[:path], class: 'mx-1 text-word-break-all')
%span.badge{ class: "badge badge-#{request_badge_color(notification.notifiable.state)}" }
= notification.notifiable.state
- else
%i.fas.fa-comments{ title: 'Comment notification' }
= link_to(notification.notifiable_link[:text], notification.notifiable_link[:path], class: 'mx-1 text-word-break-all')
.actions.ml-auto.align-self-end.align-self-md-start
- title, icon = notification.unread? ? ['Mark as "Read"', 'fa-check'] : ['Mark as "Unread"', 'fa-undo']
- update_path = my_notification_path(id: notification, type: selected_filter[:type], project: selected_filter[:project],
page: params[:page], show_all: params[:show_all])
= link_to(update_path, id: format('update-notification-%d', notification.id),
method: :put, class: 'btn btn-sm btn-outline-success px-3', title: title, remote: true) do
%i.fas{ class: "#{icon}" }
.content
- if notification.kind_of_request
%p.text-word-break-all.m-0.mb-2= notification.kind_of_request
%p.d-none.d-md-block.font-weight-light= notification.excerpt
%small.who-when.d-flex.align-self-center.align-self-md-start.justify-content-start.justify-content-md-end.font-weight-light
= render partial: 'notification_avatars', locals: { avatar_objects: notification.avatar_objects }
%span.d-inline-block.text-nowrap.ml-2 #{time_ago_in_words(notification.created_at)} ago
= paginate notifications, views_prefix: 'webui', window: 2, params: { action: 'index', id: nil }