- i = 0 - block(:top_authors_of_year) do .blocktable %table %thead %th Year %th Author %th Commits %th Total %tbody - stats.year_stats.sort{ |a, b| b[0] <=> a[0] }.each do |year, authorstats| - authors = authorstats.sort{ |a, b| b[1].commits <=> a[1].commits }[0, top_author_count] - authors.each do |author| - c = author[1].commits - first = author == authors.first - i += 1 if first %tr{:class => first ? 'top' : "yearauthor_sub#{i}"} %td{:class => first ? "yearauthor_top#{i}" : ""}&= first ? year : '' %td{:class => first ? "yearauthor_top#{i}" : ""}&= author[0] %td{:class => first ? "yearauthor_top#{i}" : ""}&= '%d of %d (%.2f%%)' % [c, authorstats.commits.to_f, c * 100.0 / authorstats.commits.to_f] %td{:class => first ? "yearauthor_top#{i}" : ""}&= first ? authorstats.count : '' - for j in 1..i :javascript $(document).ready(function() { $(".yearauthor_sub#{j}").hide(); $(".yearauthor_top#{j}").click(function() { $(".yearauthor_sub#{j}").toggle(); return false; }); });