openaustralia/publicwhip

View on GitHub
app/views/people_distances/policy.html.haml

Summary

Maintainability
Test Coverage
- content_for :title do
  Compare how
  = @person_distance.person1.name
  and
  = @person_distance.person2.name
  voted on
  = @policy.name

%h1.long-title= yield :title

.page-header
  .row
    - ppd1 = PolicyPersonDistance.find_by(policy: @policy, person: @person_distance.person1)
    - ppd2 = PolicyPersonDistance.find_by(policy: @policy, person: @person_distance.person2)
    .col-sm-6.member-block
      .media= render "member", member: @person_distance.person1.latest_member
      = link_to member_policy_path_simple(ppd1.person.latest_member, ppd1.policy) do
        = capitalise_initial_character(policy_agreement_summary(ppd1, with_person: false, with_policy: true))
    .col-sm-6.member-block
      .media= render "member", member: @person_distance.person2.latest_member
      = link_to member_policy_path_simple(ppd2.person.latest_member, ppd2.policy) do
        = capitalise_initial_character(policy_agreement_summary(ppd2, with_person: false, with_policy: true))

  .row
    .col-sm-12
      %p
        How they
        voted compared with each other and someone who agrees that
        = link_to @policy.description, @policy

  -# TODO: This is only roughly placed for the time being
  = render "social_share"

%p
  Now this is where it gets a bit tricky…
  Two people might vote the same way on votes they both attended, so their votes are 100% in agreement.
  They might also have voted in a way we’d describe differently when looking at all of one person's votes.
  If the other person didn’t or couldn’t have attended those votes we leave those out of the comparison.
  Because that just wouldn’t be fair now, would it?

= render 'policies/vote_summary', people: [@person_distance.person1, @person_distance.person2], policy: @policy