diff options
author | Francis Irving <francis@mysociety.org> | 2010-07-20 02:18:53 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-07-20 02:18:53 +0100 |
commit | 7a87c62a55129124b3191ec22568dfe6c48575a3 (patch) | |
tree | 69af2dd6dcef0219f98f2dacb9d18139de9007e9 /app/controllers/admin_user_controller.rb | |
parent | 09a4d1bcd59a8d040cb6c10bc35152e2498a30c3 (diff) |
Show profile photos on admin page and allow clearing.
Diffstat (limited to 'app/controllers/admin_user_controller.rb')
-rw-r--r-- | app/controllers/admin_user_controller.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb index 857457cc6..404c4c3fe 100644 --- a/app/controllers/admin_user_controller.rb +++ b/app/controllers/admin_user_controller.rb @@ -68,6 +68,21 @@ class AdminUserController < AdminController redirect_to url end + def clear_profile_photo + @admin_user = User.find(params[:id]) + + if !request.post? + raise "Can only clear profile photo from POST request" + end + + if @admin_user.profile_photo + @admin_user.profile_photo.destroy + end + + flash[:notice] = "Profile photo cleared" + redirect_to user_admin_url(@admin_user) + end + private end |