diff --git a/dashboard/app/mailers/parent_mailer.rb b/dashboard/app/mailers/parent_mailer.rb index 0dcaeae7bf202..f40c198fc8ce9 100644 --- a/dashboard/app/mailers/parent_mailer.rb +++ b/dashboard/app/mailers/parent_mailer.rb @@ -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 diff --git a/dashboard/app/views/parent_mailer/parent_email_added_to_student_account.haml b/dashboard/app/views/parent_mailer/parent_email_added_to_student_account.haml new file mode 100644 index 0000000000000..f145fbe1970f4 --- /dev/null +++ b/dashboard/app/views/parent_mailer/parent_email_added_to_student_account.haml @@ -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. diff --git a/dashboard/config/locales/en.yml b/dashboard/config/locales/en.yml index fe9abd7ceabcb..24435b271d8c2 100644 --- a/dashboard/config/locales/en.yml +++ b/dashboard/config/locales/en.yml @@ -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' diff --git a/dashboard/test/mailers/parent_mailer_test.rb b/dashboard/test/mailers/parent_mailer_test.rb index 527171ff792a7..35df622065d2a 100644 --- a/dashboard/test/mailers/parent_mailer_test.rb +++ b/dashboard/test/mailers/parent_mailer_test.rb @@ -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 diff --git a/dashboard/test/mailers/previews/parent_mailer_preview.rb b/dashboard/test/mailers/previews/parent_mailer_preview.rb new file mode 100644 index 0000000000000..dd97f4cd2a672 --- /dev/null +++ b/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 diff --git a/dashboard/test/mailers/previews/traverse_mail_previews_test.rb b/dashboard/test/mailers/previews/traverse_mail_previews_test.rb index 1814f615ae968..ddc25f892bf2d 100644 --- a/dashboard/test/mailers/previews/traverse_mail_previews_test.rb +++ b/dashboard/test/mailers/previews/traverse_mail_previews_test.rb @@ -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|