diff --git a/app/controllers/contributions_controller.rb b/app/controllers/contributions_controller.rb index 600d8b5d..20a4f8e9 100644 --- a/app/controllers/contributions_controller.rb +++ b/app/controllers/contributions_controller.rb @@ -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 diff --git a/app/views/contributions/index.html.haml b/app/views/contributions/index.html.haml index 28864361..95bd7de2 100644 --- a/app/views/contributions/index.html.haml +++ b/app/views/contributions/index.html.haml @@ -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