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 module Management
class UsersController < ManagementController class UsersController < ManagementController
def index def index
@users = User.all @users = User.includes(:speaker_profile)
end end
def toggle_admin def toggle_admin

View File

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

View File

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

View File

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