diff options
-rw-r--r-- | app/controllers/admin_user_controller.rb | 15 | ||||
-rw-r--r-- | app/views/admin_user/show.rhtml | 11 | ||||
-rw-r--r-- | public/stylesheets/admin.css | 14 |
3 files changed, 40 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 diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml index f320f3aa0..a893498eb 100644 --- a/app/views/admin_user/show.rhtml +++ b/app/views/admin_user/show.rhtml @@ -2,6 +2,17 @@ <h1><%=@title%></h1> +<% if @admin_user.profile_photo %> + <div class="user_photo_on_admin"> + <% form_tag '../clear_profile_photo/' + @admin_user.id.to_s, :multipart => true do %> + <img src="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>"> + <br> + <%= submit_tag "Clear photo" %> + <% end %> + </div> +<% end %> + + <p> <strong>Id:</strong> <%= @admin_user.id%> <br> <% for column in User.content_columns %> diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 8ff4ec981..fa729991c 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -59,3 +59,17 @@ form { display: inline; } +.user_photo_on_admin { + float: right; +} + +.user_photo_on_admin img { + width: 96px; + height: 96px; + vertical-align: middle; + border: 1px solid #dddddd; + margin-right: 5px; + padding: 2px; +} + + |