Skip to content

Commit

Permalink
Add missing settings link and route
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan8902 committed May 13, 2024
1 parent bbb0474 commit af66c84
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
76 changes: 38 additions & 38 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<h2>Update Profile</h1>

<section class="row">

<article class="col-md-5">
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<div class="form-group<%= " has-error" if errors_for resource, :name %>">
<%= f.label :name, class: "control-label" %>
<%= f.text_field :name, class: "form-control", value: current_user.name, required: true %>
<span class="help-block"><%= errors_for resource, :name %></span>
</div>
<div class="form-group<%= " has-error" if errors_for resource, :email %>">
<%= f.label :email, class: "control-label" %>
<%= f.email_field :email, class: "form-control", value: current_user.email, required: true %>
<span class="help-block"><%= errors_for resource, :email %></span>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="form-group<%= " has-error" if errors_for resource, :password %>">
<%= f.label :password, class: "control-label" %>
<%= f.password_field :password, class: "form-control", autocomplete: false %>
<span class="help-block"><%= errors_for resource, :password %></span>
</div>
<div class="form-group<%= " has-error" if errors_for resource, :password_confirmation %>">
<%= f.label :password_confirmation, class: "control-label" %>
<%= f.password_field :password_confirmation, class: "form-control" %>
<span class="help-block"><%= errors_for resource, :password_confirmation %></span>
</div>
<div class="form-group<%= " has-error" if errors_for resource, :current_password %>">
<%= f.label :current_password, class: "control-label" %>
<%= f.password_field :current_password, class: "form-control" %>
<span class="help-block"><%= errors_for resource, :current_password %></span>
</div>
<div><%= f.submit "Update", class: "btn btn-primary" %></div>

<div class="form-group<%= " has-error" if errors_for resource, :name %>">
<%= f.label :name, class: "control-label" %>
<%= f.text_field :name, class: "form-control", value: current_user.name, required: true %>
<span class="help-block"><%= errors_for resource, :name %></span>
</div>

<div class="form-group<%= " has-error" if errors_for resource, :email %>">
<%= f.label :email, class: "control-label" %>
<%= f.email_field :email, class: "form-control", value: current_user.email, required: true %>
<span class="help-block"><%= errors_for resource, :email %></span>
</div>

<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>

<div class="form-group<%= " has-error" if errors_for resource, :password %>">
<%= f.label :password, class: "control-label" %>
<%= f.password_field :password, class: "form-control", autocomplete: false %>
<span class="help-block"><%= errors_for resource, :password %></span>
</div>

<div class="form-group<%= " has-error" if errors_for resource, :password_confirmation %>">
<%= f.label :password_confirmation, class: "control-label" %>
<%= f.password_field :password_confirmation, class: "form-control" %>
<span class="help-block"><%= errors_for resource, :password_confirmation %></span>
</div>

<div class="form-group<%= " has-error" if errors_for resource, :current_password %>">
<%= f.label :current_password, class: "control-label" %>
<%= f.password_field :current_password, class: "form-control" %>
<span class="help-block"><%= errors_for resource, :current_password %></span>
</div>

<div><%= f.submit "Update", class: "btn btn-primary" %></div>

<% end %>
</article>
Expand All @@ -48,7 +48,7 @@
<p>If you would like to close your account and have all your data deleted, then you can:</p>
<%= button_to "Close Account", registration_path(resource_name), class: "btn btn-danger", method: :delete %>
</article>

</section>

<%= link_to "Back", :back %>
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</a>
<ul class="dropdown-menu">
<li><%= link_to solid_icon("user") + " Profile", current_user %></li>
<li><%= link_to solid_icon("cog") + " Settings", "#" %></li>
<li><%= link_to solid_icon("cog") + " Settings", edit_user_registration_path %></li>
<li class="divider"></li>
<li><%= link_to solid_icon("power-off") + " Logout", logout_path %></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def matches?(request)
get "tweets/stats" => "tweets#stats", as: "tweets_stats"
resources :tweets, only: [:index, :show]

devise_for :users, path: "users", path_names: { sign_in: "login", sign_out: "logout", sign_up: "register" }
devise_for :users, path: "users", path_names: { sign_in: "login", sign_out: "logout", sign_up: "register", edit: "settings" }
as :user do
get "login" => "devise/sessions#new", as: "new_session"
get "logout" => "devise/sessions#destroy", as: "logout"
Expand Down

0 comments on commit af66c84

Please sign in to comment.