Sha256: c529f907e11edbe242cfd35bd2e86b5ba4c95e82672b784df3a3f14b6d91f843

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

class SplashController < ApplicationController
  skip_before_filter :authenticate

  def index
  end

  def signup
    if ENV['MAILCHIMP_SPLASH_SIGNUP_LIST_ID'].blank? or ENV['MAILCHIMP_API_KEY'].blank?

      @message = "The MAILCHIMP_API_KEY and MAILCHIMP_SPLASH_SIGNUP_LIST_ID environment variables need to be set for mailing list signup to work! If you don't want this feature, you can just remove the mailing list signup feature from app/views/splash/index.html.haml"

    else
      begin

        gb = Gibbon::API.new

        gb.lists.subscribe({
          :id => ENV['MAILCHIMP_SPLASH_SIGNUP_LIST_ID'],
          :email => {:email => params[:signup_email]},
          :double_optin => true
        })

        @message = 'Thanks for signing up!'

      rescue StandardError => e
        @error = true

        if e.message =~ /is already subscribed to list/
          @message = "You're already signed up to receive updates. Thanks for your enthusiasm!"
        else
          @message = "Oops! Looks like we ran into an error. How embarrassing. Please try again later!"
        end

      end
    end
  end


  private
  
    def gem_available?(name)
       Gem::Specification.find_by_name(name)
    rescue Gem::LoadError
       false
    rescue
       Gem.available?(name)
    end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
happy_seed-0.0.15 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.14 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.13 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.12 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.11 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.10 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.9 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.8 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.7 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
happy_seed-0.0.6 lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb