From b1e68922a462a4a9ddaa62adefb3bcf350c75798 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Wed, 6 Sep 2017 18:28:09 +0200 Subject: refactored the account confirmation into a partial. Also made the text in the `.text` version consistent with the `.html` version --- .../_confirmation_instructions_account.html.haml | 15 +++++++++++++++ .../_confirmation_instructions_account.text.erb | 14 ++++++++++++++ .../_confirmation_instructions_secondary.html.haml | 2 +- .../_confirmation_instructions_secondary.text.erb | 4 ++-- .../mailer/confirmation_instructions.html.haml | 20 +++----------------- .../devise/mailer/confirmation_instructions.text.erb | 14 +++----------- 6 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 app/views/devise/mailer/_confirmation_instructions_account.html.haml create mode 100644 app/views/devise/mailer/_confirmation_instructions_account.text.erb (limited to 'app/views/devise') diff --git a/app/views/devise/mailer/_confirmation_instructions_account.html.haml b/app/views/devise/mailer/_confirmation_instructions_account.html.haml new file mode 100644 index 00000000000..a508b7537a2 --- /dev/null +++ b/app/views/devise/mailer/_confirmation_instructions_account.html.haml @@ -0,0 +1,15 @@ +- if @resource.unconfirmed_email.present? + #content + = email_default_heading(@resource.unconfirmed_email) + %p Click the link below to confirm your email address. + #cta + = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) +- else + #content + - if Gitlab.com? + = email_default_heading('Thanks for signing up to GitLab!') + - else + = email_default_heading("Welcome, #{@resource.name}!") + %p To get started, click the link below to confirm your account. + #cta + = link_to 'Confirm your account', confirmation_url(@resource, confirmation_token: @token) diff --git a/app/views/devise/mailer/_confirmation_instructions_account.text.erb b/app/views/devise/mailer/_confirmation_instructions_account.text.erb new file mode 100644 index 00000000000..01f09aa763d --- /dev/null +++ b/app/views/devise/mailer/_confirmation_instructions_account.text.erb @@ -0,0 +1,14 @@ +<% if @resource.unconfirmed_email.present? %> +<%= @resource.unconfirmed_email %>, + +Use the link below to confirm your email address. +<% else %> + <% if Gitlab.com? %> +Thanks for signing up to GitLab! + <% else %> +Welcome, <%= @resource.name %>! + <% end %> +To get started, use the link below to confirm your account. +<% end %> + +<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml b/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml index a716d98415c..83f5edbde7a 100644 --- a/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml +++ b/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml @@ -1,5 +1,5 @@ #content - = email_default_heading("#{@resource.user.name}, you've added a secondary email!") + = email_default_heading("#{@resource.user.name}, you've added an additional email!") %p Click the link below to confirm your email address (#{@resource.email}) #cta = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) diff --git a/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb b/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb index 2d8de854cf6..a3b28cb0b84 100644 --- a/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb +++ b/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb @@ -1,6 +1,6 @@ -<%= @resource.user.name %>, you've added a secondary email! +<%= @resource.user.name %>, you've added an additional email! -You can confirm your email (<%= @resource.email %>) through the link below: +Use the link below to confirm your email address (<%= @resource.email %>) <%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml index c9e13a636d7..a0fb687e152 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.haml +++ b/app/views/devise/mailer/confirmation_instructions.html.haml @@ -1,18 +1,4 @@ -- if @resource.is_a?(Email) - = render partial: 'confirmation_instructions_secondary' +- if @resource.is_a?(User) + = render partial: 'confirmation_instructions_account' - else - - if @resource.unconfirmed_email.present? - #content - = email_default_heading(@resource.unconfirmed_email) - %p Click the link below to confirm your email address. - #cta - = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) - - else - #content - - if Gitlab.com? - = email_default_heading('Thanks for signing up to GitLab!') - - else - = email_default_heading("Welcome, #{@resource.name}!") - %p To get started, click the link below to confirm your account. - #cta - = link_to 'Confirm your account', confirmation_url(@resource, confirmation_token: @token) + = render partial: 'confirmation_instructions_secondary' diff --git a/app/views/devise/mailer/confirmation_instructions.text.erb b/app/views/devise/mailer/confirmation_instructions.text.erb index d4bfb3af76f..057bb0b23f9 100644 --- a/app/views/devise/mailer/confirmation_instructions.text.erb +++ b/app/views/devise/mailer/confirmation_instructions.text.erb @@ -1,13 +1,5 @@ -<% if @resource.is_a?(Email) %> -<%= render partial: 'confirmation_instructions_secondary' %> -<% else %> -Welcome, <%= @resource.name %>! - -<% if @resource.unconfirmed_email.present? %> -You can confirm your email (<%= @resource.unconfirmed_email %>) through the link below: +<% if @resource.is_a?(User) %> +<%= render partial: 'confirmation_instructions_account' %> <% else %> -You can confirm your account through the link below: -<% end %> - -<%= confirmation_url(@resource, confirmation_token: @token) %> +<%= render partial: 'confirmation_instructions_secondary' %> <% end %> -- cgit v1.2.3