-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure app to send survey and handle unsubscribes
- Loading branch information
Eli Fatsi
committed
Aug 6, 2020
1 parent
8def7eb
commit 7465d10
Showing
15 changed files
with
140 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class UnsubscribesController < ApplicationController | ||
def new | ||
end | ||
|
||
def create | ||
if unsubscribe_email.present? | ||
if user = User.find_by(email: unsubscribe_email) | ||
user.update(can_be_emailed: false) | ||
end | ||
|
||
render :success | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
private | ||
|
||
def unsubscribe_email | ||
params[:unsubscribe][:email] | ||
end | ||
helper_method :unsubscribe_email | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.btn { | ||
background-color: #404458; | ||
border: none; | ||
color: white; | ||
padding: 15px 32px; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
font-size: 16px; | ||
border-radius: 3px; | ||
} | ||
|
||
.btn:hover { | ||
background-color: #525670; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: 'from@example.com' | ||
default from: '[email protected].com' | ||
layout 'mailer' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class SurveyMailer < ApplicationMailer | ||
default from: "Storyboard Team <[email protected]>" | ||
|
||
def initial_feedback(user) | ||
@user = user | ||
|
||
mail(to: user.email, subject: "Storyboard User Survey") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<p> | ||
Hello, | ||
</p> | ||
|
||
<p> | ||
Storyboard is conducting an online survey to gather user feedback and to learn more about how people use Storyboard. Your input would be incredibly helpful, and be used to inform the future of Storyboard. | ||
</p> | ||
|
||
<p> | ||
All respondents who complete the survey will be entered in a drawing to win a $20 Amazon.com gift card. | ||
</p> | ||
|
||
<p> | ||
It should take 5-10 minutes to complete. You may access the survey using the link below. | ||
</p> | ||
|
||
<p> | ||
<%= link_to "https://www.surveygizmo.com/s3/5759951/Storyboard-User-Survey", "https://www.surveygizmo.com/s3/5759951/Storyboard-User-Survey" %> | ||
</p> | ||
|
||
<p> | ||
If you have any questions, you can contact Laura Sweltz at [email protected]. | ||
</p> | ||
|
||
<p> | ||
Thank you, | ||
<br> | ||
Storyboard Team | ||
</p> | ||
|
||
<br> | ||
<hr> | ||
|
||
<p> | ||
Don’t want to hear from us again? <%= link_to "Unsubscribe here", new_unsubscribe_url(email: @user.email) %>. | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Hello, | ||
|
||
Storyboard is conducting an online survey to gather user feedback and to learn more about how people use Storyboard. Your input would be incredibly helpful. | ||
|
||
All respondents who complete the survey will be entered in a drawing to win a $20 Amazon.com gift card. | ||
|
||
It should take 5-10 minutes to complete. You may access the survey using the link below. | ||
|
||
https://www.surveygizmo.com/s3/5759951/Storyboard-User-Survey | ||
|
||
If you have any questions, you can contact Laura Sweltz at [email protected]. | ||
|
||
Thank you, | ||
Storyboard Team | ||
|
||
================================================================ | ||
Don’t want to hear from us again? Unsubscribe here: <%= new_unsubscribe_url(email: @user.email) %>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="AccountForm Container"> | ||
<%= form_for :unsubscribe, url: unsubscribes_path do |f| %> | ||
<div class="Field"> | ||
<%= f.label :email %> | ||
<%= f.email_field :email, value: params[:email] %> | ||
</div> | ||
|
||
<%= f.submit "Unsubscribe", class: "btn" %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="Container"> | ||
<p> | ||
We've removed <%= unsubscribe_email %> from our mailing list. Fare thee well. | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddCanBeEmailedToUsers < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :users, :can_be_emailed, :boolean, default: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class SurveyMailerPreview < ActionMailer::Preview | ||
def initial_feedback | ||
SurveyMailer.initial_feedback(User.first) | ||
end | ||
end |