users: add /settings page.

Add /settings page and link to it instead of /users/:id/edit.
This commit is contained in:
evazion
2019-09-01 14:57:57 -05:00
parent ff92b32f02
commit f673552743
5 changed files with 26 additions and 9 deletions

View File

@@ -13,6 +13,16 @@ class UsersController < ApplicationController
respond_with(@user)
end
def settings
@user = CurrentUser.user
if @user.is_anonymous?
redirect_to new_session_path
else
respond_with(@user, template: "users/edit")
end
end
def index
if params[:name].present?
@user = User.find_by_name!(params[:name])

View File

@@ -120,7 +120,7 @@
<li><%= link_to "Sign up", new_user_path %></li>
<% else %>
<li><%= link_to "Profile", profile_path %></li>
<li><%= link_to "Settings", edit_user_path(CurrentUser.user) %></li>
<li><%= link_to "Settings", settings_path %></li>
<% if CurrentUser.is_gold? %>
<li><%= link_to "Change name", new_user_name_change_request_path %></li>
<% end %>

View File

@@ -11,8 +11,8 @@
<% if @user && !@user.new_record? && !CurrentUser.user.is_anonymous? %>
<li>|</li>
<% if @user.id == CurrentUser.user.id %>
<%= subnav_link_to "Settings", edit_user_path(CurrentUser.user) %>
<%= subnav_link_to "Profile", profile_path %>
<%= subnav_link_to "Settings", settings_path %>
<%= subnav_link_to "Messages #{CurrentUser.user.dmail_count}", dmails_current_folder_path %>
<% if !@user.is_platinum? %>