diff --git a/app/assets/stylesheets/notifications.scss.erb b/app/assets/stylesheets/notifications.scss.erb index 16f96407..2f750f90 100644 --- a/app/assets/stylesheets/notifications.scss.erb +++ b/app/assets/stylesheets/notifications.scss.erb @@ -83,6 +83,7 @@ $unread_notifications_dot_size: 8px; .notification-body { margin-left: 50px; + line-height: 20px; .in-bold { font-family: 'din-medium', Sans-Serif; @@ -130,9 +131,35 @@ $unread_notifications_dot_size: 8px; - .notificationPage .notification-body { - p, div { - margin: 1em auto; + .notificationPage { + .thirty-two-avatar { + display: inline-block; + width: 32px; + height: 32px; + border-radius: 16px; + vertical-align: middle; + } + + .button { + line-height: 32px; + + img { + margin-top: 8px; + } + + &.decline { + background: #DB5D5D; + &:hover { + background: #DC4B4B; + } + } + } + + .notification-body { + p, div { + margin: 1em auto; + line-height: 20px; + } } } } diff --git a/app/controllers/access_controller.rb b/app/controllers/access_controller.rb index 7c93e1eb..4ce85022 100644 --- a/app/controllers/access_controller.rb +++ b/app/controllers/access_controller.rb @@ -61,6 +61,7 @@ class AccessController < ApplicationController request = AccessRequest.find(params[:request_id]) request.approve respond_to do |format| + format.js format.json do head :ok end @@ -72,6 +73,7 @@ class AccessController < ApplicationController request = AccessRequest.find(params[:request_id]) request.deny respond_to do |format| + format.js format.json do head :ok end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 16049fc0..210c0b43 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -21,7 +21,18 @@ class NotificationsController < ApplicationController def show @receipt.update(is_read: true) respond_to do |format| - format.html + format.html do + case @notification.notification_code + when MAP_ACCESS_APPROVED, MAP_INVITE_TO_EDIT + redirect_to map_path(@notification.notified_object.map) + when TOPIC_ADDED_TO_MAP + redirect_to map_path(@notification.notified_object.map) + when TOPIC_CONNECTED_1 + redirect_to topic_path(@notification.notified_object.topic1) + when TOPIC_CONNECTED_2 + redirect_to topic_path(@notification.notified_object.topic2) + end + end format.json do render json: @notification.as_json.merge( is_read: @receipt.is_read diff --git a/app/views/access/approve_access_post.js.erb b/app/views/access/approve_access_post.js.erb new file mode 100644 index 00000000..24db9b80 --- /dev/null +++ b/app/views/access/approve_access_post.js.erb @@ -0,0 +1 @@ +$('.main-text').text($('.requesterName').text() + ' has been shared on the map and notified.') \ No newline at end of file diff --git a/app/views/access/deny_access_post.js.erb b/app/views/access/deny_access_post.js.erb new file mode 100644 index 00000000..64b89256 --- /dev/null +++ b/app/views/access/deny_access_post.js.erb @@ -0,0 +1 @@ +$('.main-text').text('Fair enough.') \ No newline at end of file diff --git a/app/views/notifications/index.html.erb b/app/views/notifications/index.html.erb index 77de7f65..e965f481 100644 --- a/app/views/notifications/index.html.erb +++ b/app/views/notifications/index.html.erb @@ -18,34 +18,35 @@
+ <% if false && request.answered %> + <% if request.approved %> + You already responded to this access request, and allowed access. + <% elsif !request.approved %> + You already responded to this access request, and declined access. If you changed your mind, you can still grant + them access by going to the map and adding them as a collaborator. + <% end %> + <% else %> + <%= image_tag asset_path('ellipsis.gif'), class: 'hidden' %> + <%= link_to 'Allow', approve_access_post_map_path(id: map.id, request_id: request.id), remote: true, method: :post, class: 'button allow' %> + <%= link_to 'Decline', deny_access_post_map_path(id: map.id, request_id: request.id), remote: true, method: :post, class: 'button decline' %> + + <% end %> +
+ <%= link_to 'Go to map', map_url(map) %> + <%= link_to 'View mapper profile', explore_path(id: request.user.id) %> +