Skip to content

Commit

Permalink
Merge pull request #192 from tosdr/fix-user-delete-account
Browse files Browse the repository at this point in the history
Fix user delete account
  • Loading branch information
piks3l authored Dec 15, 2017
2 parents 8be8df9 + 9a9ff5b commit a5c0d46
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
1 change: 0 additions & 1 deletion app/controllers/points_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class PointsController < ApplicationController
before_action :set_point, only: [:show, :edit,:featured, :update, :destroy]

Expand Down
44 changes: 25 additions & 19 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<div class="container mwd">
<div class="row">

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :username, required: true, autofocus: true %>
<%= f.input :email, required: true, autofocus: true %>
<h2>Edit <%= resource_name.to_s.humanize %></h2>

<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :username, required: true, autofocus: true %>
<%= f.input :email, required: true, autofocus: true %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
<% end %>
<% end %>
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
<%= f.input :password_confirmation, required: false %>
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
</div>
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
<%= f.input :password_confirmation, required: false %>
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
</div>

<div class="form-actions">
<%= f.button :submit, "Update" %>
</div>
<% end %>
<div class="form-actions">
<%= f.button :submit, "Update" %>
</div>
<% end %>

<h3>Cancel my account</h3>
<h3>Cancel my account</h3>

<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>

<%= link_to "Back", :back %>
<%= link_to "Back", :back %>
</div>
</div>
6 changes: 6 additions & 0 deletions app/views/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
<i class="fa fa-check-square-o"></i> <%= t(".profile", default: "My points") %>
<% end %>
</li>
<li>
<%= link_to edit_user_registration_path do %>
<i class="fa fa-cogs"></i> <%= t(".profile", default: "Settings") %>
<% end %>
</li>
<li>
<%= link_to destroy_user_session_path, method: :delete do %>
<i class="fa fa-sign-out"></i> <%= t(".profile", default: "Log out") %>
Expand All @@ -65,6 +70,7 @@
<li><%= link_to "Points", points_path %></li>
<li><%= link_to "Topics", topics_path %></li>
<li><%= link_to "Services", services_path %></li>
<li><%= link_to "Setting", edit_user_registration_path %></li>
<li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
<% else %>
<li><%= link_to "About", about_path, class: "navbar-tosdr-item navbar-tosdr-link" %></li>
Expand Down

0 comments on commit a5c0d46

Please sign in to comment.