Sha256: ac7fad2c3fb14d2cd5eccb63e4d80aa81ca72ef062b257c9007436fde1cc85fa

Contents?: true

Size: 889 Bytes

Versions: 17

Compression:

Stored size: 889 Bytes

Contents

# -*- encoding : utf-8 -*-
class FeedbackController < ApplicationController
  
  # http://expressica.com/simple_captcha/
  # include SimpleCaptcha::ControllerHelpers
  
  # show the feedback form
  def show
    @errors=[]
    if request.post?
      if validate
        Notifier.feedback(params)
        redirect_to feedback_complete_path
      end
    end
  end
  
  protected
  
  # validates the incoming params
  # returns either an empty array or an array with error messages
  def validate
    unless params[:name] =~ /\w+/
      @errors << 'A valid name is required'
    end
    unless params[:email] =~ /\w+@\w+\.\w+/
      @errors << 'A valid email address is required'
    end
    unless params[:message] =~ /\w+/
      @errors << 'A message is required'
    end
    #unless simple_captcha_valid?
    #  @errors << 'Captcha did not match'
    #end
    @errors.empty?
  end
  
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
blacklight-3.4.2 app/controllers/feedback_controller.rb
blacklight-3.4.1 app/controllers/feedback_controller.rb
blacklight-3.4.0 app/controllers/feedback_controller.rb
blacklight-3.3.2 app/controllers/feedback_controller.rb
blacklight-3.3.1 app/controllers/feedback_controller.rb
blacklight-3.3.0 app/controllers/feedback_controller.rb
blacklight-3.2.2 app/controllers/feedback_controller.rb
blacklight-3.2.1 app/controllers/feedback_controller.rb
blacklight-3.2.0 app/controllers/feedback_controller.rb
blacklight-3.2.0pre2 app/controllers/feedback_controller.rb
blacklight-3.2.0pre1 app/controllers/feedback_controller.rb
blacklight-3.1.2 app/controllers/feedback_controller.rb
blacklight-3.1.1 app/controllers/feedback_controller.rb
blacklight-3.1.0 app/controllers/feedback_controller.rb
blacklight-3.0.0 app/controllers/feedback_controller.rb
blacklight-3.0.0pre8 app/controllers/feedback_controller.rb
blacklight-3.0.0pre7 app/controllers/feedback_controller.rb