Note that these queries are a bit slow. I don't think these new subpages will be accessed anywhere near often enough for their ~2sec query time to be a big deal. But if we start getting into trouble with it (e.g. someone starts slamming us for fun), we can look into how how cache these values over time.
24 lines
706 B
Text
24 lines
706 B
Text
- title t('.title')
|
|
|
|
%ul.timeframe-nav
|
|
- ['all_time', 'this_year', 'this_month', 'this_week'].each do |tf|
|
|
%li
|
|
- if @timeframe == tf
|
|
%strong= t(".timeframes.#{tf}")
|
|
- else
|
|
= link_to t(".timeframes.#{tf}"), top_contributors_path(timeframe: tf)
|
|
|
|
= will_paginate @users
|
|
%table#top-contributors
|
|
%thead
|
|
%tr
|
|
%th{:scope => 'column'}= t('.rank')
|
|
%th{:scope => 'column'}= t('.user')
|
|
%th{:scope => 'column'}= t('.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.period_points
|
|
= will_paginate @users
|