Completely remove the enterprise/company information functionality from the onboarding flow to simplify the user experience: - Remove company information toggle section and form fields from view - Delete unused Stimulus toggle controller (toggle_section_controller.js) - Update onboarding controller to only process first/last name parameters - Remove company_name from permitted parameters and validation logic - Update tests to remove company name assertions and test cases - Simplify onboarding to only collect essential personal information The onboarding now focuses solely on collecting required first and last names, providing a cleaner and faster user experience. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
956 B
Ruby
39 lines
956 B
Ruby
class OnboardingController < ApplicationController
|
|
before_action :authenticate_user!
|
|
before_action :redirect_if_onboarding_complete, except: [:complete]
|
|
|
|
def index
|
|
# Display the onboarding form
|
|
end
|
|
|
|
def complete
|
|
if onboarding_params_valid?
|
|
current_user.update!(onboarding_params)
|
|
current_user.complete_onboarding!
|
|
|
|
flash[:notice] = "Bienvenue sur AperoNight ! Votre profil a été configuré avec succès."
|
|
redirect_to dashboard_path
|
|
else
|
|
flash.now[:alert] = "Veuillez remplir tous les champs requis."
|
|
render :index
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def onboarding_params
|
|
params.require(:user).permit(:first_name, :last_name)
|
|
end
|
|
|
|
def onboarding_params_valid?
|
|
onboarding_params[:first_name].present? &&
|
|
onboarding_params[:last_name].present?
|
|
end
|
|
|
|
def redirect_if_onboarding_complete
|
|
if current_user&.onboarding_completed?
|
|
redirect_to dashboard_path
|
|
end
|
|
end
|
|
end
|