diff options
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 85d09abc7..fd9eb9fbf 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -419,6 +419,34 @@ class UserController < ApplicationController render_for_text(@display_user.profile_photo.data) end + # Change about me text on your profile page + def set_profile_about_me + if authenticated_user.nil? + flash[:error] = "You need to be logged in to change the text about you on your profile." + redirect_to frontpage_url + return + end + + if !params[:submitted_about_me] + params[:about_me] = {} + params[:about_me][:about_me] = @user.about_me + @about_me = AboutMeValidator.new(params[:about_me]) + render :action => 'set_profile_about_me' + return + end + + @about_me = AboutMeValidator.new(params[:about_me]) + if !@about_me.valid? + render :action => 'set_profile_about_me' + return + end + + @user.about_me = @about_me.about_me + @user.save! + flash[:notice] = "You have now changed the text about you on your profile." + redirect_to user_url(@user) + end + private # Decide where we are going to redirect back to after signin/signup, and record that |