Skip to content

Commit a5c0d46

Browse files
author
piks3l
authored
Merge pull request #192 from tosdr/fix-user-delete-account
Fix user delete account
2 parents 8be8df9 + 9a9ff5b commit a5c0d46

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

app/controllers/points_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
class PointsController < ApplicationController
32
before_action :set_point, only: [:show, :edit,:featured, :update, :destroy]
43

+25-19
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
<h2>Edit <%= resource_name.to_s.humanize %></h2>
1+
<div class="container mwd">
2+
<div class="row">
23

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

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

10-
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
7+
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
8+
<%= f.error_notification %>
9+
10+
<div class="form-inputs">
11+
<%= f.input :username, required: true, autofocus: true %>
12+
<%= f.input :email, required: true, autofocus: true %>
13+
14+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
1115
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
12-
<% end %>
16+
<% end %>
1317

14-
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
15-
<%= f.input :password_confirmation, required: false %>
16-
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
17-
</div>
18+
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
19+
<%= f.input :password_confirmation, required: false %>
20+
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
21+
</div>
1822

19-
<div class="form-actions">
20-
<%= f.button :submit, "Update" %>
21-
</div>
22-
<% end %>
23+
<div class="form-actions">
24+
<%= f.button :submit, "Update" %>
25+
</div>
26+
<% end %>
2327

24-
<h3>Cancel my account</h3>
28+
<h3>Cancel my account</h3>
2529

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

28-
<%= link_to "Back", :back %>
32+
<%= link_to "Back", :back %>
33+
</div>
34+
</div>

app/views/shared/_navbar.html.erb

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
<i class="fa fa-check-square-o"></i> <%= t(".profile", default: "My points") %>
4444
<% end %>
4545
</li>
46+
<li>
47+
<%= link_to edit_user_registration_path do %>
48+
<i class="fa fa-cogs"></i> <%= t(".profile", default: "Settings") %>
49+
<% end %>
50+
</li>
4651
<li>
4752
<%= link_to destroy_user_session_path, method: :delete do %>
4853
<i class="fa fa-sign-out"></i> <%= t(".profile", default: "Log out") %>
@@ -65,6 +70,7 @@
6570
<li><%= link_to "Points", points_path %></li>
6671
<li><%= link_to "Topics", topics_path %></li>
6772
<li><%= link_to "Services", services_path %></li>
73+
<li><%= link_to "Setting", edit_user_registration_path %></li>
6874
<li><%= link_to "Log out", destroy_user_session_path, method: :delete %></li>
6975
<% else %>
7076
<li><%= link_to "About", about_path, class: "navbar-tosdr-item navbar-tosdr-link" %></li>

0 commit comments

Comments
 (0)