openaustralia/publicwhip

View on GitHub
app/views/divisions/_summary.html.haml

Summary

Maintainability
Test Coverage
.page-section.clearfix#votes
  %figure.voter-table.col-md-7
    %h2
      Votes
      %small.division-outcome-summary{class: "#{division_outcome_class(division)}"}
        = division_outcome_with_majority_strength(division)

    .division-policies#related-policies
      = render "current_policies_list", division: division

    %p.division-rebellions-sentence
      - if division.rebellions > 0
        There
        = division.rebellions == 1 ? "was" : "were"
        %span.rebel= pluralize(division.rebellions, 'rebellion')
        in this division.
      - else
        Nobody rebelled against their party.

    - if rebellions
      %ul.list-unstyled.small
        - rebellions.each do |vote|
          %li
            = link_to vote.member.name, member_path_simple(vote.member)
            voted
            = vote_display vote.vote
            against the majority of the #{vote.member.party}.

    = render 'summary_table', division: division, whips: whips, votes: votes, members_vote_null: members_vote_null

    %figcaption.panel-footer.small
      - if division.rebellions > 0
        %p <span class="rebel">Red entries</span> are rebel votes against the majority of a party.
      %p Turnout is the percentage of members eligible to vote that did vote.