Skip to content

Commit

Permalink
Merge pull request #741 from DFE-Digital/update-email-prefs-account-page
Browse files Browse the repository at this point in the history
Update email preferences display logic on user account page
  • Loading branch information
jack-coggin authored Sep 25, 2023
2 parents 4a7a42c + 9e40ccd commit fc72df5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ def role_applicable?
role_type != 'Not applicable'
end

# return [Boolean]
def training_emails_recipient?
training_emails || training_emails.nil?
end

# @return [Boolean]
def private_beta_registration_complete?
!!private_beta_registration_complete
Expand Down
2 changes: 1 addition & 1 deletion app/views/user/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- row.with_value { nil }
- email_preferences.with_row do |row|
- row.with_key { 'Email updates about this training course' }
- row.with_value(text: current_user.training_emails.nil? || current_user.training_emails ? t('my_account.training_emails_true') : t('my_account.training_emails_false'), classes: ['data-hj-suppress'])
- row.with_value(text: current_user.training_emails_recipient? ? t('my_account.training_emails_true') : t('my_account.training_emails_false'), classes: ['data-hj-suppress'])
- row.with_action(text: t('links.change'), href: edit_training_emails_user_path, visually_hidden_text: 'training_emails', html_attributes: { id: :edit_training_emails_user })

= content_resource 'my_account.closing.information'
Expand Down

0 comments on commit fc72df5

Please sign in to comment.