Codeminer42/cm42-central

View on GitHub
app/views/registrations/edit.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title_bar do %>
  <span class="navbar-brand"><%= t('edit') %> <%= resource.class.name.humanize %></span>
<% end %>

<div class="row">
  <div class="col-xs-12 col-md-8 col-md-offset-2">
    <div class="page-header">
      <h4 class="page-header-title">
        <i class="mi md-20">account_circle</i> <%= t('edit') %> <%= resource.class.name.humanize %>
      </h4>
    </div>
  </div>

  <div class="col-xs-12 col-md-5 col-md-offset-2">
    <div class="panel panel-default card">
      <div class="panel-body">
        <div class="edit-user">
          <%= render 'form' %>
        </div>
      </div>
    </div>
  </div>

  <div class="col-xs-12 col-sm-3">
    <div class="panel panel-default card user-profile">
      <div class="panel-body">
        <div class="text-center">
          <% cache "user/#{@user.email}/avatar_edit_page", expires_in: 1.hour do %>
            <img class="user-image" src="<%= avatar_url(@user) %>">
            <div class="user-name"><%= @user.name %></div>
          <% end %>
          <small><%= t('visit') %> <a href="//gravatar.com" target="blank">Gravatar</a> <%= t('update_avatar') %> </small>
        </div>
        <hr />
        <div class="account-options">
          <% if @user.finished_tour? %>
            <%= link_to t('reset_tour'), user_reset_tour_path(@user), method: :put, class: 'btn btn-info btn-block' %>
          <% end %>
          <% if resource.authy_enabled %>
            <%= link_to t('disable_2fa'), user_verify_two_factor_path, class: 'btn btn-warning btn-block' %>
          <% else %>
            <%= link_to t('enable_2fa'), user_enable_authy_path, class: 'btn btn-success btn-block' %>
          <% end %>
          <%= link_to t("cancel_account"), registration_path(resource_name), data: {confirm: t('cancel_account_confirmation_question')}, method: :delete, class: 'btn btn-danger btn-block' %>
        </div>
      </div>
    </div>
  </div>

</div>