Refactor settings routes and menu
Use sub controllers/routes for the sections
This commit is contained in:
parent
c5fa38fe3d
commit
96cf534d0a
6
app/controllers/settings/profile_controller.rb
Normal file
6
app/controllers/settings/profile_controller.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class Settings::ProfileController < SettingsController
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
13
app/controllers/settings/security_controller.rb
Normal file
13
app/controllers/settings/security_controller.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class Settings::SecurityController < SettingsController
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_password
|
||||||
|
current_user.send_reset_password_instructions
|
||||||
|
sign_out current_user
|
||||||
|
msg = "We have sent you an email with a link to reset your password."
|
||||||
|
redirect_to check_your_email_path, notice: msg
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,13 +1,13 @@
|
|||||||
class SettingsController < ApplicationController
|
class SettingsController < ApplicationController
|
||||||
before_action :require_user_signed_in
|
before_action :require_user_signed_in
|
||||||
|
before_action :set_current_section
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_password
|
private
|
||||||
current_user.send_reset_password_instructions
|
|
||||||
sign_out current_user
|
def set_current_section
|
||||||
msg = "We have sent you an email with a link to reset your password."
|
@current_section = :settings
|
||||||
redirect_to check_your_email_path, notice: msg
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<h2>Settings</h2>
|
|
9
app/views/settings/profile/index.html.erb
Normal file
9
app/views/settings/profile/index.html.erb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<%= render HeaderComponent.new(title: "Settings") %>
|
||||||
|
|
||||||
|
<%= render MainWithSidenavComponent.new(sidenav_partial: 'shared/sidenav_settings') do %>
|
||||||
|
<section>
|
||||||
|
<h3>Profile</h3>
|
||||||
|
<p class="mb-12">
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
@ -6,5 +6,5 @@
|
|||||||
class: main_nav_class(@current_section, :invitations) %>
|
class: main_nav_class(@current_section, :invitations) %>
|
||||||
<%= link_to "Wallet", wallet_path,
|
<%= link_to "Wallet", wallet_path,
|
||||||
class: main_nav_class(@current_section, :wallet) %>
|
class: main_nav_class(@current_section, :wallet) %>
|
||||||
<%= link_to "Settings", security_path,
|
<%= link_to "Settings", settings_profile_path,
|
||||||
class: main_nav_class(@current_section, :security) %>
|
class: main_nav_class(@current_section, :settings) %>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<%= render SidenavLinkComponent.new(
|
<%= render SidenavLinkComponent.new(
|
||||||
name: "Account", path: "#", icon: "user", disabled: true
|
name: "Profile", path: settings_profile_path, icon: "user",
|
||||||
|
active: current_page?(settings_profile_path)
|
||||||
) %>
|
) %>
|
||||||
<%= render SidenavLinkComponent.new(
|
<%= render SidenavLinkComponent.new(
|
||||||
name: "Password", path: security_path, icon: "key",
|
name: "Security", path: settings_security_path, icon: "key",
|
||||||
active: current_page?(security_path)
|
active: current_page?(settings_security_path)
|
||||||
) %>
|
) %>
|
||||||
<%= render SidenavLinkComponent.new(
|
<%= render SidenavLinkComponent.new(
|
||||||
name: "Security", path: "#", icon: "shield", disabled: true
|
name: "Security", path: "#", icon: "shield", disabled: true
|
||||||
|
@ -10,10 +10,11 @@ Rails.application.routes.draw do
|
|||||||
match 'signup/:step', to: 'signup#steps', as: :signup_steps, via: [:get, :post]
|
match 'signup/:step', to: 'signup#steps', as: :signup_steps, via: [:get, :post]
|
||||||
post 'signup_validate', to: 'signup#validate'
|
post 'signup_validate', to: 'signup#validate'
|
||||||
|
|
||||||
get 'settings', to: 'settings#index'
|
namespace :settings do
|
||||||
post 'settings_reset_password', to: 'settings#reset_password'
|
get 'profile', to: 'profile#index'
|
||||||
|
get 'security', to: 'security#index'
|
||||||
get 'security', to: 'security#index'
|
post 'reset_password', to: 'security#reset_password'
|
||||||
|
end
|
||||||
|
|
||||||
namespace :contributions do
|
namespace :contributions do
|
||||||
root to: 'donations#index'
|
root to: 'donations#index'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user