Module: Enjoy::Feedback::Controllers::Contacts

Extended by:
ActiveSupport::Concern
Included in:
Enjoy::Feedback::ContactsController
Defined in:
lib/enjoy/feedback/controllers/contacts.rb

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/enjoy/feedback/controllers/contacts.rb', line 24

def create
  @contact_message = model.new(message_params)
  after_initialize

  if Enjoy::Feedback.config.captcha
    if Enjoy::Feedback.config.recaptcha_support
      if verify_recaptcha
        meth = :save
      else
        meth = :valid?
        @recaptcha_error = I18n.t('enjoy.errors.feedback.recaptcha')
      end

    elsif Enjoy::Feedback.config.simple_captcha_support
      meth = :save_with_captcha

    else
      meth = :save
    end
  else
    meth = :save
  end

  if @contact_message.send(meth)
    after_create
    if request.xhr? && process_ajax
      ajax_success
    else
      redirect_after_done
    end
  else
    render_contacts_error
  end
end

#indexObject



12
13
14
15
16
# File 'lib/enjoy/feedback/controllers/contacts.rb', line 12

def index
  @contact_message = model.new
  after_initialize
  xhr_checker
end

#newObject



18
19
20
21
22
# File 'lib/enjoy/feedback/controllers/contacts.rb', line 18

def new
  @contact_message = model.new
  after_initialize
  xhr_checker
end

#sentObject



59
60
# File 'lib/enjoy/feedback/controllers/contacts.rb', line 59

def sent
end