This commit is contained in:
nilsding 2014-12-08 17:10:09 +01:00
parent 4d5cad0c0d
commit 742bba0b12
4 changed files with 14 additions and 16 deletions

View File

@ -24,14 +24,14 @@ class UserController < ApplicationController
def followers
@title = 'Followers'
@user = User.find_by_screen_name!(params[:username])
@users = @user.followers.paginate(page: params[:page])
@users = @user.followers.reverse_order.paginate(page: params[:page])
render 'show_follow'
end
def following
@title = 'Following'
@user = User.find_by_screen_name!(params[:username])
@users = @user.friends.paginate(page: params[:page])
@users = @user.friends.reverse_order.paginate(page: params[:page])
render 'show_follow'
end
end

View File

@ -6,16 +6,14 @@
%img.img-rounded.img-profile{src: gravatar_url(user)}
.media-body
- if user.display_name.blank?
%h2= user.screen_name
%h2
%a{href: show_user_profile_path(user.screen_name)}
= user.screen_name
- else
%h2.user-displayname= user.display_name
%h2.user-displayname
%a{href: show_user_profile_path(user.screen_name)}
= user.display_name
%h4.text-muted.user-username= user.screen_name
- if user.admin?
%p.user-admin
%i.fa.fa-flask
Admin
- unless user.bio.blank?
%p.user-profiletext= user.bio
.row
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#asked-count= user.asked_count
@ -23,4 +21,4 @@
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#answered-count= user.answered_count
%h6.entry-subtext Answers
= render 'user/actions'
= render 'user/actions', user: user

View File

@ -1,10 +1,10 @@
- if user_signed_in?
- if @user == current_user
- if user == current_user
%a.btn.btn-default.btn-block{href: edit_user_profile_path} Edit profile
- else
- if current_user.following? @user
%button#editprofile.btn.btn-default.btn-block{type: :button, name: 'user-action', data: { action: :unfollow, target: @user.screen_name }}
- if current_user.following? user
%button#editprofile.btn.btn-default.btn-block{type: :button, name: 'user-action', data: { action: :unfollow, target: user.screen_name }}
Unfollow
- else
%button#editprofile.btn.btn-primary.btn-block{type: :button, name: 'user-action', data: { action: :follow, target: @user.screen_name }}
%button#editprofile.btn.btn-primary.btn-block{type: :button, name: 'user-action', data: { action: :follow, target: user.screen_name }}
Follow

View File

@ -37,4 +37,4 @@
.col-md-6.col-sm-6.col-xs-6
%h4.entry-text#answered-count= @user.answered_count
%h6.entry-subtext Answers
= render 'user/actions'
= render 'user/actions', user: @user