Skip to content

Commit

Permalink
[proposal-options] - Show/hide results and vote-box in different situ…
Browse files Browse the repository at this point in the history
…ations. #34
  • Loading branch information
cristiandouce committed Oct 11, 2013
1 parent 9c20cd9 commit 38ca9b3
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions lib/proposal-options/options.jade
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@
- && proposal.abstentions.map(function(v) { return v.author }) )
- || []

- var participants = proposal.participants

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

.proposal-options(class= showOptions ? '' : 'hide')
.vote-box
.proposal-options
.vote-box(class= !!citizen.id ? '' : 'hide')
.meta-data
- if(~positives.indexOf(citizen.id))
p.alert.alert-success(style="margin:0;") #{t('You voted Yea')}.
- else if (~negatives.indexOf(citizen.id))
p.alert.alert-danger(style="margin:0;") #{t('You voted Nay')}.
- else if (~neutrals.indexOf(citizen.id))
p.alert.alert-info(style="margin:0;") #{t('You abstained from voting')}.
a.meta-item.change-vote(href="#", class= voted ? '' : 'hide')
a.meta-item.change-vote(href="#", class= voted && !closed ? '' : 'hide')
small #{t('I want to change my vote')}.

.vote-options(class= voted ? 'hide' : '')
.vote-options(class= voted || closed ? 'hide' : '')
h5= t('Vote')
.direct-vote
a.vote-option.vote-yes(href="#", data-proposal=proposal.id)
Expand All @@ -49,29 +51,34 @@
//- label= t('Delegate to')
//- input.delegation-input(type="text", name="q")
a.toggle-results.btn.btn-default.btn-block.btn-success(class= voted ? '' : 'hide')
.votes-cast
em.text-muted= t('{num} votes cast', { num: census.length })


a.toggle-results.btn.btn-default.btn-block.btn-success(class= closed ? '' : 'hide')
span.glyphicon.glyphicon-stats
| #{t('Partial results')}

.results-box(class='hide')
h5= t('Yea')
- var width = census.length ? (positives.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-success(role="progress-bar", aria-valuenow=positives.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{positives.length}
| #{t('votes')}
h5= t('Nay')
- var width = census.length ? (negatives.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-danger(role="progress-bar", aria-valuenow=negatives.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{negatives.length}
| #{t('votes')}
h5= t('Abstain')
- var width = census.length ? (neutrals.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-info(role="progress-bar", aria-valuenow=neutrals.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{neutrals.length}
| #{t('votes')}
- if (closed)
.results-box(class='hide')
h5= t('Yea')
- var width = census.length ? (positives.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-success(role="progress-bar", aria-valuenow=positives.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{positives.length}
| #{t('votes')}
h5= t('Nay')
- var width = census.length ? (negatives.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-danger(role="progress-bar", aria-valuenow=negatives.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{negatives.length}
| #{t('votes')}
h5= t('Abstain')
- var width = census.length ? (neutrals.length/census.length)*100 : 0;
.progress
.progress-bar.progress-bar-info(role="progress-bar", aria-valuenow=neutrals.length, aria-valuemin="0", aria-valuemax=census.length, style="width: #{width}%;")
span.sr-only
| #{neutrals.length}
| #{t('votes')}

0 comments on commit 38ca9b3

Please sign in to comment.