concordia-publishing-house/errbit

View on GitHub
app/views/problems/_tally_table.html.haml

Summary

Maintainability
Test Coverage
.head_and_tail
  %table.tally.head
    %tbody
      - head(rows).each do |row|
        %tr
          %td.percent= number_to_percentage(row[0], :precision => 1)
          %th.value= row[1]
    - if rows.size > head_size
      %tfoot
        %tr
          %td{:colspan => 2}
            = link_to 'Show more...', '#', :class => :show_tail
  %table.tally.tail{:style => "display: none"}
    %tbody
      - tail(rows).each do |row|
        %tr
          %td.percent= number_to_percentage(row[0], :precision => 1)
          %th.value= row[1]