Class: RailsWink::WinkController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_wink/wink_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


3
4
5
6
7
# File 'app/controllers/rails_wink/wink_controller.rb', line 3

def index
  @email = params[:email] || ''

  render
end

#submitObject


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/rails_wink/wink_controller.rb', line 9

def submit
  email = params[:email_addr]
  description = params[:desc]
  jsobj = params[:json]

  if email.nil? or email.empty?
    email = nil
  end

  @msg = 'Thanks, that should help!'

  if jsobj.nil?
    @msg = "Unfortunately that didn't work."
  end

  if jsobj && jsobj = JSON.parse(jsobj)
    WinkMailer.report(jsobj, description, email).deliver
  end

  render
end