aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/help_controller.rb
blob: 15a846e50a07f5916bc6282448c3e41cf7312415 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# app/controllers/help_controller.rb:
# Show information about one particular request.
#
# 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.7 2008-07-09 14:12:56 francis Exp $

class HelpController < ApplicationController
    
    def about
    end

    def contact
        @contact_email = MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')
        @contact_email = @contact_email.gsub(/@/, "&#64;")

        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(
                    params[:contact][:name],
                    params[:contact][:email],
                    params[:contact][:subject],
                    params[:contact][:message],
                    (@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 frontpage_url 
                return
            end
        end
         
    end

end