18F/identity-idp

View on GitHub
app/views/accounts/connected_accounts/selected_email/edit.html.erb

Summary

Maintainability
Test Coverage
<% self.title = t('titles.select_email') %>

<%= render StatusPageComponent.new(status: :info, icon: :question) do |c| %>
  <% c.with_header(id: 'select-email-heading') { t('titles.select_email') } %>

  <p id="select-email-intro">
    <%= t('help_text.select_preferred_email', sp: @identity.display_name, app_name: APP_NAME) %>
  </p>

  <%= simple_form_for(
        @select_email_form,
        url: connected_account_selected_email_path(identity_id: @identity.id),
        method: :patch,
      ) do |f| %>
    <%= f.input(
          :selected_email_id,
          as: :radio_buttons,
          label: false,
          wrapper_html: {
            aria: {
              labelledby: 'select-email-heading',
              describedby: 'select-email-intro',
            },
          },
          collection: current_user.confirmed_email_addresses.map do |email|
            [
              email.email,
              email.id,
              checked: email.id == @identity.email_address_id,
            ]
          end,
        ) %>
    <%= f.submit(t('help_text.requested_attributes.change_email_link'), class: 'margin-top-1') %>
  <% end %>

  <%= render ButtonComponent.new(
        url: add_email_path,
        outline: true,
        big: true,
        wide: true,
        class: 'margin-top-2',
      ).with_content(t('account.index.email_add')) %>

  <% c.with_footer { link_to t('forms.buttons.back'), account_connected_accounts_path } %>
<% end %>