openaustralia/planningalerts

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

Summary

Maintainability
Test Coverage
<h3>Edit account</h3>

<%= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
  <%= render "devise/shared/error_messages", resource: %>

  <%= f.inputs do %>
    <%= f.input :name, hint: "Please use your full name", input_html: { autofocus: true, autocomplete: "name" } %>
    <%= f.input :email, input_html: { autocomplete: "email" } %>
    <% if resource.pending_reconfirmation? %>
      <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
    <% end %>
    <%= f.input :password, required: false, hint: "leave blank if you don't want to change it", input_html: { autocomplete: "new-password" } %>
    <%= f.input :current_password, required: true, hint: "we need your current password to confirm your changes", input_html: { autocomplete: "current-password" } %>
  <% end %>

  <%= f.actions do %>
    <%= f.action :submit, label: "Update", button_html: { class: "button button-rounded button-large button-action" } %>
  <% end %>
<% end %>

<h3>Cancel my account</h3>

<p>Warning! This <strong>permanently</strong> removes your account and any alerts you have and can <strong>not be undone</strong>.</p>

<% unless resource.comments.visible.empty? %>
  <p>
    Note that the <%= link_to pluralize(resource.comments.visible.count, "comment"), comments_profile_path %> you have made (including the name attached
    to the comment) will <strong>not</strong> be removed
    as it is part of the public record. However the private information, your email address, <strong>will</strong> be removed.
  </p>
<% end %>

<p><%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "This will permanently remove your account and can not be undone. Are you sure?" }, method: :delete, class: "button button-rounded button-action" %></p>