diff --git a/app/assets/images/fallback/profile_picture/medium_default.png b/app/assets/images/fallback/profile_picture/medium_default.png new file mode 100644 index 0000000..619f4fe Binary files /dev/null and b/app/assets/images/fallback/profile_picture/medium_default.png differ diff --git a/app/assets/images/fallback/profile_picture/schedule_default.png b/app/assets/images/fallback/profile_picture/schedule_default.png new file mode 100644 index 0000000..7f98cf5 Binary files /dev/null and b/app/assets/images/fallback/profile_picture/schedule_default.png differ diff --git a/app/assets/images/fallback/profile_picture/thumb_default.png b/app/assets/images/fallback/profile_picture/thumb_default.png new file mode 100644 index 0000000..c5f3820 Binary files /dev/null and b/app/assets/images/fallback/profile_picture/thumb_default.png differ diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index b70a7cf..5bffbbe 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -1,7 +1,7 @@ module Management class UsersController < ManagementController def index - @users = User.all + @users = User.includes(:speaker_profile) end def toggle_admin diff --git a/app/models/user.rb b/app/models/user.rb index e7cbc1f..3412dda 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index 0f60f9b..3dc3914 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -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] diff --git a/app/views/management/users/index.html.slim b/app/views/management/users/index.html.slim index d608b95..d807e5f 100644 --- a/app/views/management/users/index.html.slim +++ b/app/views/management/users/index.html.slim @@ -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?