1
0
Fork 0
forked from OpenNeo/impress

user contribution page

This commit is contained in:
Emi Matchu 2010-11-06 11:57:22 -04:00
parent a5b119a9bc
commit 3992e57adc
2 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -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