- var positives = proposal.upvotes || []
- var negatives = proposal.downvotes || []
- var neutrals = proposal.abstentions || []
- var census = neutrals.concat(negatives).concat(positives) || []

- var participants = proposal.participants || []

- var closed = proposal.closingAt && +new Date(proposal.closingAt) < Date.now()
- var voted = citizen && ~census.indexOf(citizen.id)

.inner-container.commentable-container(class=proposal.votable ? '' : 'hide')

  .proposal-options
    .vote-box
      .meta-data(class= !!citizen.id ? '' : 'hide')
        - if(~positives.indexOf(citizen.id))
          include vote-positive
        - else if (~negatives.indexOf(citizen.id))
          include vote-negative
        - else if (~neutrals.indexOf(citizen.id))
          include vote-neutral

        a.meta-item.change-vote(href="#", class= voted && !closed ? '' : 'hide')
          i.icon-refresh
          small #{t('I want to change my vote')}.

      .vote-options(class= voted || closed ? 'hide' : '')
        h5= t('Vote')
        .direct-vote
          a.vote-option.vote-yes(href="#", data-proposal=proposal.id)
            i.flaticon.solid.thumbs-up-1
            span= t('Yea')
          a.vote-option.vote-abstain(href="#", data-proposal=proposal.id)
            i.flaticon.solid.pause
            span= t('Abstain')
          a.vote-option.vote-no(href="#", data-proposal=proposal.id)
            i.flaticon.solid.thumbs-up-1
            span= t('Nay')

      .votes-cast
        em.text-muted= t('{num} votes cast', { num: census.length || "0" })

    - if (!citizen.id)
      p.text-mute.hide= t('You must be signed in to vote on this law')
        | . 
        a(href="/signin")= t('Login')
        |  #{t('common.or')} 
        a(href="/signup?reference=" + proposal.id)= t('Signup')
        | .

    - if (closed)
      .results-box.row.clearfix
        p.alert.alert-info(class=census.length ? 'hide' : ''): label= t('No votes cast')
        .results-chart(class= census.length ? '' : 'hide').col-sm-6
          canvas#results-chart(width="220", height="220")
        .results-summary(class= census.length ? '' : 'hide').col-sm-6
          - if (positives.length)
            .votes-afirmative.votes-results
              h5= t('Yea')
              - var width = census.length ? (positives.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === positives.length ? '' : 's'
              span.percent #{width} % 
              span.votes #{positives.length} #{t('vote') + s}

          - if (negatives.length)
            .votes-negative.votes-results
              h5= t('Nay')
              - var width = census.length ? (negatives.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === negatives.length ? '' : 's'
                span.percent #{width} % 
                span.votes #{negatives.length} #{t('vote') + s}

          - if (neutrals.length)
            .votes-neutral.votes-results
              h5= t('Abstain')
              - var width = census.length ? (neutrals.length/census.length)*100 : 0;
              - var width = Math.round(width*100)/100
              - var s = 1 === neutrals.length ? '' : 's'
                span.percent #{width} % 
                span.votes #{neutrals.length} #{t('vote') + s}