Refactor settings routes and menu
Use sub controllers/routes for the sections
This commit is contained in:
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
|
||||
before_action :require_user_signed_in
|
||||
before_action :set_current_section
|
||||
|
||||
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
|
||||
private
|
||||
|
||||
def set_current_section
|
||||
@current_section = :settings
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user