astrochimp 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,7 @@ module Astrochimp
35
35
  format.html { render action: :index }
36
36
  format.json { render json: @signup.errors, status: :unprocessable_entity }
37
37
  else
38
+ SignupMailer.signup_complete(@signup).deliver
38
39
  format.html do
39
40
  redirect_to @signup, notice: ENV['AC_SIGNUP_SUCCESS_NOTICE']
40
41
  end
@@ -0,0 +1,10 @@
1
+ module Astrochimp
2
+ class SignupMailer < ActionMailer::Base
3
+ default from: ENV['AC_MAIL_FROM']
4
+
5
+ def signup_complete(signup)
6
+ @signup = signup
7
+ mail(to: signup.email, subject: ENV['AC_MAIL_SUBJECT'])
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ You have successfully signed up.
2
+
3
+ Your custom referral link: <%= referral_link_path(referrer_code: @signup.referral_code, only_path: false) %>
4
+
5
+ To view the status of your referrals, visit <%= signup_path(@signup.referral_code, only_path: false) %>
@@ -4,13 +4,16 @@ defaults: &defaults
4
4
  company_url : "http://mailchimp.com"
5
5
  twitter_user : "Brightbit"
6
6
  facebook_url : "http://www.facebook.com/brightbit"
7
- google_analytics_code : ""
8
- mailchimp_list_id : ""
9
- mailchimp_api_key : ""
7
+ google_analytics_code :
8
+ mailchimp_list_id :
9
+ mailchimp_api_key :
10
10
  email_format : "html"
11
11
  email_double_optin : false # true will require user to confirm their email address
12
12
  signup_success_notice : "Thanks! We'll drop you a line when we launch!"
13
13
  splash_layout : "astrochimp"
14
+ mail_from : "from@example.com"
15
+ mail_subject : "You have successfully signed up for Astrochimp"
16
+ host : "example.com"
14
17
 
15
18
  development:
16
19
  <<: *defaults
@@ -13,6 +13,8 @@ config.each do |key, value|
13
13
  ENV[key] = value.to_s if !value.kind_of?(Hash) && ENV[key].blank?
14
14
  end
15
15
 
16
+ ActionMailer::Base.default_url_options[:host] ||= ENV['AC_HOST']
17
+
16
18
  #if File.basename($0) != 'rake'
17
19
  #unless ActiveRecord::Base.connection.table_exists?('astrochimp_signups')
18
20
  #raise "\n\nThe Chimp wants you to run rake db:migrate\n\n"
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  Astrochimp::Engine.routes.draw do
2
2
  root to: "signups#index"
3
3
 
4
- resources :signups, only: [:index, :create, :show]
4
+ resources :signups, only: [:index, :create, :show], as: :signups
5
5
  get 'r/:referrer_code' => 'signups#index', as: :referral_link
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Astrochimp
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
data/test/dummy/Gemfile CHANGED
@@ -3,3 +3,4 @@ source "https://rubygems.org"
3
3
  gem "rails"
4
4
  gem "pg"
5
5
  gem "astrochimp", path: '../..'
6
+ gem 'letter_opener'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- astrochimp (0.1.2)
4
+ astrochimp (0.1.3)
5
5
  hominid (~> 3.0.5)
6
6
  jquery-rails
7
7
  rails (~> 3.2.8)
@@ -36,6 +36,7 @@ GEM
36
36
  activesupport (3.2.8)
37
37
  i18n (~> 0.6)
38
38
  multi_json (~> 1.0)
39
+ addressable (2.3.2)
39
40
  arel (3.0.2)
40
41
  builder (3.0.4)
41
42
  erubis (2.7.0)
@@ -47,6 +48,10 @@ GEM
47
48
  railties (>= 3.1.0, < 5.0)
48
49
  thor (~> 0.14)
49
50
  json (1.7.5)
51
+ launchy (2.1.2)
52
+ addressable (~> 2.3)
53
+ letter_opener (1.0.0)
54
+ launchy (>= 2.0.4)
50
55
  mail (2.4.4)
51
56
  i18n (>= 0.4.0)
52
57
  mime-types (~> 1.16)
@@ -96,5 +101,6 @@ PLATFORMS
96
101
 
97
102
  DEPENDENCIES
98
103
  astrochimp!
104
+ letter_opener
99
105
  pg
100
106
  rails
@@ -4,13 +4,16 @@ defaults: &defaults
4
4
  company_url : "http://mailchimp.com"
5
5
  twitter_user : "Brightbit"
6
6
  facebook_url : "http://www.facebook.com/brightbit"
7
- google_analytics_code : ""
8
- mailchimp_list_id : ""
9
- mailchimp_api_key : ""
7
+ google_analytics_code :
8
+ mailchimp_list_id :
9
+ mailchimp_api_key :
10
10
  email_format : "html"
11
11
  email_double_optin : false # true will require user to confirm their email address
12
12
  signup_success_notice : "Thanks! We'll drop you a line when we launch!"
13
13
  splash_layout : "astrochimp"
14
+ mail_from : "from@example.com"
15
+ mail_subject : "You have successfully signed up for Astrochimp"
16
+ host : "localhost:3000"
14
17
 
15
18
  development:
16
19
  <<: *defaults
@@ -34,4 +34,7 @@ Dummy::Application.configure do
34
34
 
35
35
  # Expands the lines which load the assets
36
36
  config.assets.debug = true
37
+
38
+ # "Deliver" mail through letter_opener
39
+ config.action_mailer.delivery_method = :letter_opener
37
40
  end