2018-03-05 17:43:11 +00:00
|
|
|
|
|
|
|
|
2016-11-01 03:18:27 +00:00
|
|
|
|
2018-03-05 18:18:51 +00:00
|
|
|
import React, { Component } from react
|
|
|
|
|
|
|
|
class MyComponent extends Component {
|
|
|
|
render = () => {
|
|
|
|
return (
|
2016-11-01 03:18:27 +00:00
|
|
|
<div id="yield">
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="centerContent withPadding back">
|
2018-03-04 02:25:42 +00:00
|
|
|
{ link_to 'Back to notifications', notifications_path }
|
2016-12-15 22:34:42 +00:00
|
|
|
</div>
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="centerContent notificationPage">
|
|
|
|
<h2 className="notification-title">
|
2018-03-04 02:25:42 +00:00
|
|
|
{ case @notification.notification_code
|
2017-02-11 14:06:01 +00:00
|
|
|
when MAP_ACCESS_REQUEST
|
2017-10-13 17:58:21 +00:00
|
|
|
request = @notification.notified_object
|
2018-03-04 02:25:42 +00:00
|
|
|
map = request.map }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ image_tag @notification.sender.image(:thirtytwo), className: 'thirty-two-avatar' } <span style='font-weight:bold;' className='requesterName'>{ request.user.name }</span> wants to collaborate on map <span style='font-weight:bold;'>{ map.name }</span>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ else }
|
|
|
|
{ @notification.subject }
|
|
|
|
{ end }
|
2017-02-11 14:06:01 +00:00
|
|
|
</h2>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ case @notification.notification_code
|
|
|
|
when MAP_ACCESS_REQUEST }
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="notification-body">
|
|
|
|
<p className="main-text">
|
2018-03-04 02:25:42 +00:00
|
|
|
{ if false && request.answered }
|
|
|
|
{ if request.approved }
|
2017-02-11 14:06:01 +00:00
|
|
|
You already responded to this access request, and allowed access.
|
2018-03-04 02:25:42 +00:00
|
|
|
{ elsif !request.approved }
|
2017-10-13 17:58:21 +00:00
|
|
|
You already responded to this access request, and declined access. If you changed your mind, you can still grant
|
2017-02-11 14:06:01 +00:00
|
|
|
them access by going to the map and adding them as a collaborator.
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
|
|
|
{ else }
|
2018-03-05 17:33:16 +00:00
|
|
|
{ image_tag asset_path('ellipsis.gif'), className: 'hidden' }
|
|
|
|
{ link_to 'Allow', approve_access_post_map_path(id: map.id, request_id: request.id), remote: true, method: :post, className: 'button allow' }
|
|
|
|
{ link_to 'Decline', deny_access_post_map_path(id: map.id, request_id: request.id), remote: true, method: :post, className: 'button decline' }
|
2017-02-11 14:06:01 +00:00
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.notification-body .button').click(function() {
|
2018-03-04 02:25:42 +00:00
|
|
|
$(this).html('<img src="{ asset_path('ellipsis.gif') }" />')
|
2017-02-11 14:06:01 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2017-02-11 14:06:01 +00:00
|
|
|
</p>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ link_to 'Go to map', map_url(map) }
|
|
|
|
{ link_to 'View mapper profile', explore_path(id: request.user.id) }
|
2017-02-11 14:06:01 +00:00
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ else }
|
2018-03-05 17:33:16 +00:00
|
|
|
<div className="notification-body">
|
2018-03-04 02:25:42 +00:00
|
|
|
{ raw @notification.body }
|
2017-02-11 14:06:01 +00:00
|
|
|
</div>
|
2018-03-04 02:25:42 +00:00
|
|
|
{ end }
|
2016-11-01 03:18:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-05 18:18:51 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MyComponent
|