top contributors

This commit is contained in:
Emi Matchu 2010-11-06 12:15:10 -04:00
parent 3992e57adc
commit 446a117ec8
6 changed files with 58 additions and 1 deletions

View file

@ -0,0 +1,5 @@
class UsersController < ApplicationController
def top_contributors
@users = User.top_contributors.paginate :page => params[:page], :per_page => 20
end
end

View file

@ -3,7 +3,7 @@ class User < ActiveRecord::Base
has_many :contributions
scope :top_contributors, order('points DESC')
scope :top_contributors, order('points DESC').where(arel_table[:points].gt(0))
def self.find_or_create_from_remote_auth_data(user_data)
user = find_or_initialize_by_remote_id_and_auth_server_id(

View file

@ -11,3 +11,4 @@
@import outfits/new
@import pets/bulk
@import static/terms
@import users/top_contributors

View file

@ -0,0 +1,15 @@
body.users-top_contributors
text-align: center
#top-contributors
border:
spacing: 0
width: 1px 1px 0 0
margin: 1em auto
&, td, th
border:
color: $text-color
style: solid
td, th
border-width: 0 0 1px 1px
padding: .5em 1em

View file

@ -0,0 +1,15 @@
- title 'Top Contributors'
= will_paginate @users
%table#top-contributors
%thead
%tr
%th{:scope => 'column'} Rank
%th{:scope => 'column'} User
%th{:scope => 'column'} Points
%tbody
- @users.each_with_index do |user, rank|
%tr
%th{:scope => 'row'}= @users.offset + rank + 1
%td= link_to user.name, user_contributions_path(user)
%td= user.points
= will_paginate @users

View file

@ -956,3 +956,24 @@ body.pets-bulk .script-only {
body.static-terms {
text-align: center;
}
/* line 1, ../../../app/stylesheets/users/_top_contributors.sass */
body.users-top_contributors {
text-align: center;
}
/* line 4, ../../../app/stylesheets/users/_top_contributors.sass */
body.users-top_contributors #top-contributors {
border-spacing: 0;
border-width: 1px 1px 0 0;
margin: 1em auto;
}
/* line 9, ../../../app/stylesheets/users/_top_contributors.sass */
body.users-top_contributors #top-contributors, body.users-top_contributors #top-contributors td, body.users-top_contributors #top-contributors th {
border-color: #004400;
border-style: solid;
}
/* line 13, ../../../app/stylesheets/users/_top_contributors.sass */
body.users-top_contributors #top-contributors td, body.users-top_contributors #top-contributors th {
border-width: 0 0 1px 1px;
padding: 0.5em 1em;
}