metamaps--metamaps/views/notifications/index.html.erb

79 lines
3.8 KiB
Text
Raw Normal View History

2018-03-05 17:43:11 +00:00
<div id="yield">
2018-03-05 17:33:16 +00:00
<div className="centerContent notificationsPage">
<header className="page-header">
<h2 className="title">Notifications</h4>
</header>
2018-03-05 17:33:16 +00:00
<ul className="notifications">
2018-03-04 02:25:42 +00:00
{ blacklist = [MAP_ACCESS_REQUEST, MAP_ACCESS_APPROVED, MAP_INVITE_TO_EDIT] }
{ notifications = @notifications.to_a.delete_if{|n| blacklist.include?(n.notification_code) && (n.notified_object.nil? || n.notified_object.map.nil?) }}
{ notifications.each do |notification| }
{ receipt = @receipts.find_by(notification_id: notification.id) }
2018-03-05 17:33:16 +00:00
<li className="notification { receipt.is_read? ? 'read' : 'unread' }" id="notification-{ notification.id }">
2018-03-04 02:25:42 +00:00
{ link_to notification_path(notification.id) do }
2018-03-05 17:33:16 +00:00
<div className="notification-actor">
2018-03-04 02:25:42 +00:00
{ image_tag notification.sender.image(:thirtytwo) }
</div>
2018-03-05 17:33:16 +00:00
<div className="notification-body">
<div className="in-bold">{ notification.sender.name }</div>
2018-03-04 02:25:42 +00:00
{
case notification.notification_code
2018-03-04 02:25:42 +00:00
when MAP_ACCESS_APPROVED }
{ map = notification.notified_object.map }
2018-03-05 17:33:16 +00:00
granted your request to edit map <span className="in-bold">{ map.name }</span>
2018-03-04 02:25:42 +00:00
{ when MAP_ACCESS_REQUEST }
{ map = notification.notified_object.map }
2018-03-05 17:33:16 +00:00
wants permission to map with you on <span className="in-bold">{ map.name }</span>
2018-03-04 02:25:42 +00:00
{ if !notification.notified_object.answered }
2018-03-05 17:33:16 +00:00
&nbsp;&nbsp;<div className="action">Offer a response</div>
2018-03-04 02:25:42 +00:00
{ end }
{ when MAP_INVITE_TO_EDIT }
{ map = notification.notified_object.map }
2018-03-05 17:33:16 +00:00
gave you edit access to map <span className="in-bold">{ map.name }</span>
2018-03-04 02:25:42 +00:00
{ when TOPIC_ADDED_TO_MAP }
{ topic = notification.notified_object.eventable
map = notification.notified_object.map }
2018-03-05 17:33:16 +00:00
added topic <span className="in-bold">{ topic.name }</span> to map <span className="in-bold">{ map.name }</span>
2018-03-04 02:25:42 +00:00
{ when TOPIC_CONNECTED_1 }
{ topic1 = notification.notified_object&.topic1 }
{ topic2 = notification.notified_object&.topic2 }
2018-03-05 17:33:16 +00:00
connected <span className="in-bold">{ topic1&.name }</span> to <span className="in-bold">{ topic2&.name }</span>
2018-03-04 02:25:42 +00:00
{ when TOPIC_CONNECTED_2 }
{ topic1 = notification.notified_object&.topic1 }
{ topic2 = notification.notified_object&.topic2 }
2018-03-05 17:33:16 +00:00
connected <span className="in-bold">{ topic2&.name }</span> to <span className="in-bold">{ topic1&.name }</span>
2018-03-04 02:25:42 +00:00
{ when MESSAGE_FROM_DEVS }
{ notification.subject }
{ end }
</div>
2018-03-04 02:25:42 +00:00
{ end }
2018-03-05 17:33:16 +00:00
<div className="notification-read-unread">
2018-03-04 02:25:42 +00:00
{ 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>
2018-03-05 17:33:16 +00:00
<div className="notification-date">
2018-03-04 02:25:42 +00:00
{ notification.created_at.strftime("%b %d") }
2016-12-16 04:57:37 +00:00
</div>
2018-03-05 17:33:16 +00:00
<div className="clearfloat"></div>
</li>
2018-03-04 02:25:42 +00:00
{ end }
{ if notifications.count == 0 }
2018-03-05 17:33:16 +00:00
<div className="emptyInbox">
2016-12-15 22:34:42 +00:00
You have no notifications. More time for dancing.
2016-12-13 07:42:33 +00:00
</div>
2018-03-04 02:25:42 +00:00
{ end }
</ul>
</div>
2016-12-11 22:29:48 +00:00
2018-03-04 02:25:42 +00:00
{ if @notifications.total_pages > 1 }
2018-03-05 17:33:16 +00:00
<div className="centerContent withPadding pagination">
2018-03-04 02:25:42 +00:00
{ paginate @notifications }
2016-12-11 22:29:48 +00:00
</div>
2018-03-04 02:25:42 +00:00
{ end }
</div>