aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-02-20 08:00:09 +0000
committerfrancis <francis>2008-02-20 08:00:09 +0000
commit5432e516c218e821f416e92fbcb3250bfe913d5c (patch)
treeb60c07a46aac222cf909180c8c5a56bc642187c8
parentc70d54942ab8d789c82ef9740d6c1c711f3632ae (diff)
Use login email for contact form if logged in.
-rw-r--r--app/controllers/help_controller.rb8
-rw-r--r--app/views/help/contact.rhtml20
-rw-r--r--todo.txt2
3 files changed, 17 insertions, 13 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 26db31e62..d37aeb86f 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: help_controller.rb,v 1.2 2008-02-19 17:41:58 francis Exp $
+# $Id: help_controller.rb,v 1.3 2008-02-20 08:00:09 francis Exp $
class HelpController < ApplicationController
@@ -13,6 +13,10 @@ class HelpController < ApplicationController
def contact
if params[:submitted_contact_form]
+ if @user
+ params[:contact][:email] = @user.email
+ params[:contact][:name] = @user.name
+ end
@contact = ContactValidator.new(params[:contact])
if @contact.valid?
ContactMailer.deliver_message(
@@ -20,7 +24,7 @@ class HelpController < ApplicationController
params[:contact][:email],
params[:contact][:subject],
params[:contact][:message],
- "IP #{request.env['REMOTE_HOST']}"
+ "IP #{request.env['REMOTE_HOST']}" + (@user ? (", logged in as user " + @user.email) : ", not logged in")
)
flash[:notice] = "Your message has been sent. Thank you for getting in touch! We'll get back to you soon."
redirect_to home_url
diff --git a/app/views/help/contact.rhtml b/app/views/help/contact.rhtml
index 348628b6f..2d37d4c57 100644
--- a/app/views/help/contact.rhtml
+++ b/app/views/help/contact.rhtml
@@ -17,15 +17,17 @@
answer your question quicker.
</p>
- <p>
- <label class="form_label" for="contact_name">Your name:</label>
- <%= f.text_field :name, :size => 20 %>
- </p>
-
- <p>
- <label class="form_label" for="contact_email">Your email:</label>
- <%= f.text_field :email, :size => 20 %>
- </p>
+ <% if not @user %>
+ <p>
+ <label class="form_label" for="contact_name">Your name:</label>
+ <%= f.text_field :name, :size => 20 %>
+ </p>
+
+ <p>
+ <label class="form_label" for="contact_email">Your email:</label>
+ <%= f.text_field :email, :size => 20 %>
+ </p>
+ <% end %>
<p>
<label class="form_label" for="contact_subject">Subject:</label>
diff --git a/todo.txt b/todo.txt
index e4ae21e9f..19973ae4c 100644
--- a/todo.txt
+++ b/todo.txt
@@ -38,8 +38,6 @@ Go through all requests and check status is shiny
Next
====
-Contact page
-
Forgotten password link - make go to contact form
Put the admin "Public page" link on request page somewhere clearer