From 9865a1e0634d3a42955fc78d66b76ac3d8a4051d Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 8 Dec 2016 16:48:50 -0500 Subject: [PATCH] fix invited to edit mailer's notified_object, and fix css/view for notifications#show --- app/assets/stylesheets/notifications.scss.erb | 10 ++++++++-- app/controllers/access_controller.rb | 3 +-- app/mailers/application_mailer.rb | 4 ++-- app/views/notifications/show.html.erb | 12 ++++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/notifications.scss.erb b/app/assets/stylesheets/notifications.scss.erb index a866af04..d7942135 100644 --- a/app/assets/stylesheets/notifications.scss.erb +++ b/app/assets/stylesheets/notifications.scss.erb @@ -30,7 +30,7 @@ $unread_notifications_dot_size: 8px; margin-top: 1em + $menu_bar_height; font-family: 'din-regular', Sans-Serif; - & > .title { + & > .notification-title { border-bottom: 1px solid #eee; padding-bottom: 0.25em; margin-bottom: 0.5em; @@ -42,7 +42,7 @@ $unread_notifications_dot_size: 8px; } - .notification { + .notificationsPage .notification { .notification-subject { width: 25%; } @@ -68,4 +68,10 @@ $unread_notifications_dot_size: 8px; } } } + + .notificationPage .notification-body { + p, div { + margin: 1em auto; + } + } } diff --git a/app/controllers/access_controller.rb b/app/controllers/access_controller.rb index 12cff322..a287ca1b 100644 --- a/app/controllers/access_controller.rb +++ b/app/controllers/access_controller.rb @@ -36,9 +36,8 @@ class AccessController < ApplicationController @map.add_new_collaborators(user_ids).each do |user_id| # add_new_collaborators returns array of added users, # who we then send an email to - user = User.find(user_id) mail = MapMailer.invite_to_edit_email(@map, current_user, User.find(user_id)) - user.notify(mail.subject, 'invite to edit', @map, true, MAILBOXER_CODE_INVITED_TO_EDIT) + user.notify(mail.subject, 'invite to edit', UserMap.find_by(user_id: user_id, map: @map), true, MAILBOXER_CODE_INVITED_TO_EDIT) end @map.remove_old_collaborators(user_ids) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 30f44080..338f38ee 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -13,8 +13,8 @@ class ApplicationMailer < ActionMailer::Base request = notification.notified_object MapMailer.access_request_email(request, request.map) elsif notification.notification_code == MAILBOXER_CODE_INVITED_TO_EDIT - map = notification.notified_object - MapMailer.invite_to_edit_email(map, map.user, 'TODO invited user') + user_map = notification.notified_object + MapMailer.invite_to_edit_email(user_map.map, user_map.map.user, user_map.user) end end end diff --git a/app/views/notifications/show.html.erb b/app/views/notifications/show.html.erb index 1d61ccc3..1c555954 100644 --- a/app/views/notifications/show.html.erb +++ b/app/views/notifications/show.html.erb @@ -3,12 +3,16 @@
-

<%= @notification.subject %>

- <%= raw @notification.body %> -
- <%= link_to 'Back', notifications_path %> +

<%= @notification.subject %>

+
+ <%= raw @notification.body %>
+ +
+ <%= link_to 'Back', notifications_path %> +
+ <%= render partial: 'shared/back_to_mapping' %>