metamaps--metamaps/app/views/notifications/index.html.erb
2016-12-16 16:25:13 -05:00

46 lines
1.7 KiB
Text

<% content_for :title, 'Notifications | Metamaps' %>
<% content_for :mobile_title, 'Notifications' %>
<div id="yield">
<div class="centerContent notificationsPage">
<header class="page-header">
<h2 class="title">My Notifications</h4>
</header>
<ul class="notifications">
<% @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-subject">
<%= notification.subject %>
</div>
<div class="notification-body">
<%= strip_tags(notification.body).truncate(70) %>
</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="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' %>