18F/identity-idp

View on GitHub
app/views/accounts/_phone.html.erb

Summary

Maintainability
Test Coverage
<h2 class="margin-top-0">
  <%= t('account.index.phone') %>
</h2>
<% if flash[:phone_error] %>
  <%= render AlertComponent.new(type: :error, id: 'phones', class: 'margin-bottom-1', message: flash[:phone_error]) %>
<% end %>
<div class="border-bottom border-primary-light">
  <% MfaContext.new(current_user).phone_configurations.each do |phone_configuration| %>
    <div class="padding-1 border-top border-left border-right border-primary-light">
      <div class="grid-row grid-gap-2">
        <div class="grid-col-fill">
          <%= PhoneFormatter.format(phone_configuration.phone) %>
          <% if current_user.default_phone_configuration == phone_configuration && MfaContext.new(current_user).phone_configurations.count > 1 %>
            (<%= I18n.t('account.index.default') %>)
          <% end %>
        </div>
        <div class="grid-col-auto">
          <%= render 'accounts/actions/manage_action_button',
                     path: manage_phone_path(id: phone_configuration.id),
                     name: t('account.index.phone') %>
        </div>
      </div>
    </div>
  <% end %>
</div>
<% if current_user.phone_configurations.count < IdentityConfig.store.max_phone_numbers_per_account %>
  <%= render ButtonComponent.new(
        url: phone_setup_path,
        outline: true,
        icon: :add,
        class: 'margin-top-2',
      ).with_content(t('account.index.phone_add')) %>
<% end %>