aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_user_controller.rb1
-rw-r--r--app/controllers/user_controller.rb28
2 files changed, 29 insertions, 0 deletions
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
index f55c04e90..857457cc6 100644
--- a/app/controllers/admin_user_controller.rb
+++ b/app/controllers/admin_user_controller.rb
@@ -40,6 +40,7 @@ class AdminUserController < AdminController
@admin_user.email = params[:admin_user][:email]
@admin_user.admin_level = params[:admin_user][:admin_level]
@admin_user.ban_text = params[:admin_user][:ban_text]
+ @admin_user.about_me = params[:admin_user][:about_me]
if @admin_user.valid?
@admin_user.save!
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