metamaps--metamaps/app/views/notifications/index.html.erb
Devin Howard 3706cd83e7 helper function and notification setup for messages from the devs to be sent to all users (#1064)
* message from devs notification type

* helper function for messages from devs

* don't use find_by_email

* temporary fix
2017-02-09 10:37:35 -05:00

52 lines
2 KiB
Plaintext

<% content_for :title, 'Notifications | Metamaps' %>
<% content_for :mobile_title, 'Notifications' %>
<div id="yield">
<div class="centerContent notificationsPage">
<header class="page-header">
<h2 class="title">Notifications</h4>
</header>
<ul class="notifications">
<% notifications = @notifications.to_a.delete_if{|n| n.notified_object.nil? || n.notified_object.map.nil? }%>
<% notifications.each do |notification| %>
<% receipt = @receipts.find_by(notification_id: notification.id) %>
<li class="notification <%= receipt.is_read? ? 'read' : 'unread' %>" id="notification-<%= notification.id %>">
<%= link_to notification_path(notification.id) do %>
<div class="notification-actor">
<%= image_tag notification.sender.image(:thirtytwo) %>
</div>
<div class="notification-body">
<div class="in-bold"><%= notification.sender.name %></div>
<%= raw NotificationService.text_for_notification(notification) %>
</div>
<% end %>
<div class="notification-read-unread">
<% if receipt.is_read? %>
<%= link_to 'mark as unread', mark_unread_notification_path(notification.id), remote: true, method: :put %>
<% else %>
<%= link_to 'mark as read', mark_read_notification_path(notification.id), remote: true, method: :put %>
<% end %>
</div>
<div class="notification-date">
<%= notification.created_at.strftime("%b %d") %>
</div>
<div class="clearfloat"></div>
</li>
<% end %>
<% if notifications.count == 0 %>
<div class="emptyInbox">
You have no notifications. More time for dancing.
</div>
<% end %>
</ul>
</div>
<% if @notifications.total_pages > 1 %>
<div class="centerContent withPadding pagination">
<%= paginate @notifications %>
</div>
<% end %>
</div>
<%= render partial: 'notifications/header' %>