answers are now shown on the user page
This commit is contained in:
parent
57dc1f51c6
commit
b1a1c83163
|
@ -1,6 +1,7 @@
|
||||||
class UserController < ApplicationController
|
class UserController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@user = User.find_by_screen_name!(params[:username])
|
@user = User.find_by_screen_name!(params[:username])
|
||||||
|
@answers = @user.answers.reverse_order.paginate(page: params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -15,4 +15,12 @@
|
||||||
Followings
|
Followings
|
||||||
%span.badge#friend-count= @user.friend_count
|
%span.badge#friend-count= @user.friend_count
|
||||||
.col-md-9.col-xs-12.col-sm-9
|
.col-md-9.col-xs-12.col-sm-9
|
||||||
= render 'shared/questionbox'
|
= render 'shared/questionbox'
|
||||||
|
- @answers.each do |a|
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-body
|
||||||
|
%p
|
||||||
|
%strong= a.question.content
|
||||||
|
%small= user_screen_name a.question.user, a.question.author_is_anonymous
|
||||||
|
%hr/
|
||||||
|
%p= a.content
|
||||||
|
|
|
@ -30,7 +30,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
match '/inbox', to: 'inbox#show', via: 'get'
|
match '/inbox', to: 'inbox#show', via: 'get'
|
||||||
|
|
||||||
match '/user/:username', to: 'user#show', via: 'get'
|
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
|
||||||
match '/@:username', to: 'user#show', via: 'get', as: :show_user_profile
|
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
|
||||||
match '/:username', to: 'user#show', via: 'get', as: :show_user_profile_alt
|
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue