user contribution page
This commit is contained in:
parent
a5b119a9bc
commit
3992e57adc
2 changed files with 15 additions and 2 deletions
|
@ -1,7 +1,12 @@
|
|||
class ContributionsController < ApplicationController
|
||||
def index
|
||||
@contributions = Contribution.recent.paginate :page => params[:page],
|
||||
:include => :user
|
||||
if params[:user_id]
|
||||
@user = User.find params[:user_id]
|
||||
@contributions = @user.contributions
|
||||
else
|
||||
@contributions = Contribution.includes(:user)
|
||||
end
|
||||
@contributions = @contributions.recent.paginate :page => params[:page]
|
||||
Contribution.preload_contributeds_and_parents @contributions
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
- title 'Recent Contributions'
|
||||
%ul.buttons
|
||||
- if @user
|
||||
%li= link_to 'Recent Contributions', contributions_path, :class => 'button'
|
||||
%li= link_to 'Top Contributors', top_contributors_path, :class => 'button'
|
||||
- if @user
|
||||
%p
|
||||
= @user.name
|
||||
currently has
|
||||
= @user.points
|
||||
points
|
||||
- if @contributions.empty?
|
||||
%p No contributions to see here!
|
||||
- else
|
||||
|
|
Loading…
Reference in a new issue