Skip to content

Commit

Permalink
Merge pull request #34015 from code-dot-org/parent-email-confirmation
Browse files Browse the repository at this point in the history
Add parent email confirmation when added to a student account
  • Loading branch information
bethanyaconnor committed Apr 3, 2020
2 parents 60c8e13 + a437e0b commit d02ac31
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dashboard/app/mailers/parent_mailer.rb
Expand Up @@ -7,4 +7,10 @@ def student_associated_with_parent_email(parent_email, student)

mail to: parent_email, subject: I18n.t('parent_mailer.student_associated_subject')
end

def parent_email_added_to_student_account(parent_email, student)
@student = student

mail to: parent_email, subject: I18n.t('parent_mailer.parent_email_added_subject')
end
end
@@ -0,0 +1,53 @@
%p
Welcome to Code.org! You have successfully linked your email to your child’s account.
We're thrilled that you have taken the next step in supporting #{@student.name} in their learning and exploration of
computer science. If you are not #{@student.name}’s parent, please reply to this email or contact support@code.org.

%h3
Looking for a place to get started?
%p
We’ve collected a set of
%a{href:"https://code.org/athome"}resources for learning at home,
including fun introductory tutorials, short educational videos, express courses, and open-ended projects.

%p
You and your student can also participate in Code Break each Wednesday at 10 am PST / 1 pm ET.
Code Break is a live, interactive classroom with weekly challenges to engage students of all abilities,
even those without computers. Learn more about
%a{href:"https://code.org/break"}Code Break.

%p
Don’t have a computer? We can suggest some options that work great on mobile phones or tablets too!
%a{href:"https://code.org/athome#apps"}See smartphone options.

%h3
Keep track of what your child is learning
%p
Parent excitement and involvement can help keep kids motivated as they learn - try checking in with your student when
you can to see what they’ve built. Encourage them to browse the
%a{href:"https://studio.code.org/projects/public"}games or artwork project gallery
and get inspired to make their own code artwork. You can print it and hang it up, email it to a relative, or share it on social media.
%a{href:"https://support.code.org/hc/en-us/articles/360041539831-How-can-I-keep-track-of-what-my-child-is-working-on-on-Code-org-"}Learn more.
%h3
Stay involved with CS Education
%p
Code.org believes every student in every school should have the opportunity to learn computer science.
Our coding platform and K-12 computer science curriculum are the most broadly used in the world,
and generous donors make them free for your student. Please consider
%a{href:"https://donate.code.org/campaign/support-computer-science-education/c172233"}supporting our work
to enable more children to learn for free. And explore other
%a{href:"https://code.org/help"}ways to get involved.
%p
Thank you for supporting and encouraging your child’s learning!
%p
Hadi Partovi
%br
Founder, Code.org
%p
P.S. We take student privacy very seriously at Code.org. Read our
%a{href:"https://code.org/privacy"}privacy policy
for details.
1 change: 1 addition & 0 deletions dashboard/config/locales/en.yml
Expand Up @@ -250,6 +250,7 @@ en:
%{name}
parent_mailer:
student_associated_subject: 'Login information for Code.org'
parent_email_added_subject: 'Welcome to Code.org!'
teacher_mailer:
new_teacher_subject: 'Welcome to Code.org!'
delete_teacher_subject: 'Code.org notification: Your account has been deleted'
Expand Down
11 changes: 11 additions & 0 deletions dashboard/test/mailers/parent_mailer_test.rb
Expand Up @@ -11,4 +11,15 @@ class ParentMailerTest < ActionMailer::TestCase
assert_equal ['hadi_partovi@code.org'], mail.from
assert links_are_complete_urls?(mail)
end

test 'parent email added to student account' do
student = create :user
parent_email = 'molly.weasley@ministryofmagic.wiz.uk'
mail = ParentMailer.parent_email_added_to_student_account(parent_email, student)

assert_equal I18n.t('parent_mailer.parent_email_added_subject'), mail.subject
assert_equal [parent_email], mail.to
assert_equal ['hadi_partovi@code.org'], mail.from
assert links_are_complete_urls?(mail)
end
end
9 changes: 9 additions & 0 deletions dashboard/test/mailers/previews/parent_mailer_preview.rb
@@ -0,0 +1,9 @@
# This can be viewed on non-production environments at /rails/mailers/parent_mailer
class ParentMailerPreview < ActionMailer::Preview
include FactoryGirl::Syntax::Methods

def parent_email_added_to_student_account_preview
student = build :student
ParentMailer.parent_email_added_to_student_account('fake_email@fake.com', student)
end
end
Expand Up @@ -4,7 +4,11 @@ class TraverseMailPreviewsTest < ActiveSupport::TestCase
test 'Verify all mailers can be run' do
classes = Dir['./test/mailers/previews/*_preview.rb'].map do |file|
require file
Object.const_get('Pd::' + file.scan(/\/pd_([\w_]+).rb/).first.first.camelize)
if file.scan(/\/pd_([\w_]+).rb/).empty?
Object.const_get(file.scan(/\/([\w_]+).rb/).first.first.camelize)
else
Object.const_get('Pd::' + file.scan(/\/pd_([\w_]+).rb/).first.first.camelize)
end
end

classes.each do |klass|
Expand Down

0 comments on commit d02ac31

Please sign in to comment.