openaustralia/publicwhip

View on GitHub
app/views/members/_policy_comparisons.html.haml

Summary

Maintainability
Test Coverage
%section.page-section#voting-stace
  %h2 How do they vote?

  - if member.person.policy_person_distances.empty?
    %ul
      %li
        No policies match this person's votes. You can
        = link_to "edit or make a policy", policies_path
        that will appear here.
  - else
    - distances = member.person.policy_person_distances.published.includes(:policy)
    - PolicyPersonDistance.all_categories.each do |c|
      = render "policy_comparisons_block", member: member, distances: distances.select{ |d| d.category == c }, title: category_words_sentence(c).capitalize, label: c.to_s

  %p.small.text-muted
    Please note that #{link_to "our voting records start in #{formatted_month(Division.date_earliest_division)}", help_faq_path(anchor: "timeperiod"), class: 'text-muted'}.