diff --git a/app/assets/stylesheets/feedback.scss b/app/assets/stylesheets/feedback.scss index 2dfd6a03..96d8d529 100644 --- a/app/assets/stylesheets/feedback.scss +++ b/app/assets/stylesheets/feedback.scss @@ -2,7 +2,7 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ -.bento-field-email { +.bento-field-email, .bento-field-text { width: 80%; padding: 6px 12px; } diff --git a/app/controllers/feedback_controller.rb b/app/controllers/feedback_controller.rb index e3932451..07a5e5b1 100644 --- a/app/controllers/feedback_controller.rb +++ b/app/controllers/feedback_controller.rb @@ -7,7 +7,7 @@ def index; end def submit FeedbackMailer.feedback_email(params[:feedback_message], request.remote_ip, params[:previous_page], - params[:contact_email], + params[:contact_email], params[:contact_name], request.env['HTTP_USER_AGENT']).deliver_now end diff --git a/app/mailers/feedback_mailer.rb b/app/mailers/feedback_mailer.rb index 303c2f38..c79f5b7d 100644 --- a/app/mailers/feedback_mailer.rb +++ b/app/mailers/feedback_mailer.rb @@ -1,10 +1,11 @@ class FeedbackMailer < ApplicationMailer - def feedback_email(msg, ip, page, contact_email, ua) + def feedback_email(msg, ip, page, contact_email, contact_name, ua) @ip = ip @msg = msg @page = page @ua = ua @contact_email = contact_email + @contact_name = contact_name mail(to: ENV['FEEDBACK_MAIL_TO'], subject: 'MIT Bento Feedback') end end diff --git a/app/views/feedback/index.html.erb b/app/views/feedback/index.html.erb index be649c6f..1d3aad16 100644 --- a/app/views/feedback/index.html.erb +++ b/app/views/feedback/index.html.erb @@ -5,12 +5,17 @@
<%= @msg %>
+Contact Name: <%= @contact_name %>
+Contact Email: <%= @contact_email %>
Client IP: <%= @ip %>
diff --git a/test/controllers/feedback_controller_test.rb b/test/controllers/feedback_controller_test.rb index d2e4fda4..6b5e8699 100644 --- a/test/controllers/feedback_controller_test.rb +++ b/test/controllers/feedback_controller_test.rb @@ -11,6 +11,7 @@ class FeedbackControllerTest < ActionDispatch::IntegrationTest post feedback_submit_url, params: { feedback_message: 'Popcorn is cool.', contact_email: 'yo@example.com', + contact_name: 'Firsty Lastoson', previous_page: 'http://example.com/hi' } end @@ -26,6 +27,8 @@ class FeedbackControllerTest < ActionDispatch::IntegrationTest feedback_email.body.to_s) assert_match(/Contact Email: yo@example.com/, feedback_email.body.to_s) + assert_match(/Contact Name: Firsty Lastoson/, + feedback_email.body.to_s) assert_match(%r{Originating page: http://example.com/hi}, feedback_email.body.to_s) end diff --git a/test/fixtures/feedback_mailer/feedback_email b/test/fixtures/feedback_mailer/feedback_email index 7a25814b..83130f55 100644 --- a/test/fixtures/feedback_mailer/feedback_email +++ b/test/fixtures/feedback_mailer/feedback_email @@ -12,6 +12,8 @@This is an important message!
+Contact Name: Firsty Lastoson
+Contact Email: yo@example.com
Client IP: 0.0.0.0
diff --git a/test/mailers/feedback_mailer_test.rb b/test/mailers/feedback_mailer_test.rb index 5651f110..e44de0ad 100644 --- a/test/mailers/feedback_mailer_test.rb +++ b/test/mailers/feedback_mailer_test.rb @@ -5,7 +5,8 @@ def test_feedback_email # Create the email and store it for further assertions email = FeedbackMailer.feedback_email('This is an important message!', '0.0.0.0', 'http://example.com/stuff', - 'yo@example.com', 'Netscape 4.0') + 'yo@example.com', 'Firsty Lastoson', + 'Netscape 4.0') # Send the email, then test that it got queued assert_emails 1 do