Profile pictures in user list

This commit is contained in:
Andrew Radev 2015-05-25 11:41:11 +03:00
parent 56995a8dec
commit aa43ab12dd
7 changed files with 14 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

View File

@ -1,7 +1,7 @@
module Management
class UsersController < ManagementController
def index
@users = User.all
@users = User.includes(:speaker_profile)
end
def toggle_admin

View File

@ -20,4 +20,12 @@ class User < ActiveRecord::Base
def toggle_admin!
update admin: !admin
end
def profile_picture
if speaker_profile.present?
speaker_profile.picture
else
PictureUploader.new
end
end
end

View File

@ -15,12 +15,9 @@ class PictureUploader < CarrierWave::Uploader::Base
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
def default_url
ActionController::Base.helpers.asset_path("fallback/profile_picture/" + [version_name, "default.png"].compact.join('_'))
end
# Process files as they are uploaded:
# process :scale => [200, 300]

View File

@ -7,12 +7,14 @@
table.table.table-striped.table-hover.record-table#conferences
thead
tr
th = User.human_attribute_name :picture
th = User.human_attribute_name :title
th = User.human_attribute_name :admin
th.actions
tbody
- @users.each do |user|
tr
td= image_tag(user.profile_picture.thumb.url)
td= user.name
td.boolean-col
- if user.admin?