From bd52f77f698dafb39f938d818c00b399d5f07e48 Mon Sep 17 00:00:00 2001 From: Cristian Douce Date: Mon, 31 Dec 2012 03:37:59 -0300 Subject: [PATCH] #11, some content to separated files --- views/issue-final-results.jade | 21 +++++++++++ views/issue-preliminar-results.jade | 31 +++++++++++++++++ views/issue.jade | 54 ++--------------------------- 3 files changed, 54 insertions(+), 52 deletions(-) create mode 100644 views/issue-final-results.jade create mode 100644 views/issue-preliminar-results.jade diff --git a/views/issue-final-results.jade b/views/issue-final-results.jade new file mode 100644 index 0000000..887c562 --- /dev/null +++ b/views/issue-final-results.jade @@ -0,0 +1,21 @@ +.span9.box.block-results + h3.block-title + i.icon + span Resultados final + - var totalVoters = element.vote.voters.length; + .box-content.clearfix + h4 + span.number= element.vote.voters.length + | votos contados + + - element.vote.choices.forEach(function(choice) { + .partial(style="width:100%;float:left;") + - var partial = choice.result / (totalVoters || 1) * 100; + h5 + strong #{choice.idea.title} + a(data-toggle="modal", role="button", href="#choice-full-#{choice.id}") + | Leer... + .bar(style="width:#{partial.toFixed(0)}%;") + span.tt(rel="tooltip", data-placement="top", title="#{choice.result} votos") + | #{partial.toFixed(0)} % + - }); diff --git a/views/issue-preliminar-results.jade b/views/issue-preliminar-results.jade new file mode 100644 index 0000000..e536248 --- /dev/null +++ b/views/issue-preliminar-results.jade @@ -0,0 +1,31 @@ +.span9.box.block-results + h3.block-title + i.icon + span Resultados preliminares + + .box-content.clearfix + h4 + | Hay + span.number= element.vote.voters.length + | votos contados + - element.vote.voters.forEach(function(voter) { + a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") + img(src="#{voter.imageUrlMini}") + - }); + + h4 + span.number= element.vote.voters.length + | votos por delegados + - element.vote.voters.forEach(function(voter) { + a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") + img(src="#{voter.imageUrlMini}") + - }) + + h4 + | y + span.number= element.vote.voters.length + | votos unipersonales + - element.vote.voters.forEach(function(voter) { + a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") + img(src="#{voter.imageUrlMini}") + - }) diff --git a/views/issue.jade b/views/issue.jade index 217dcfa..a003d7c 100644 --- a/views/issue.jade +++ b/views/issue.jade @@ -78,62 +78,12 @@ block content //- Preliminar results - if( voted && (Date.now() < element.votingEndDate) ) { - .span9.box.block-results - h3.block-title - i.icon - span Resultados preliminares - - .box-content.clearfix - h4 - | Hay - span.number= element.vote.voters.length - | votos contados - - element.vote.voters.forEach(function(voter) { - a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") - img(src="#{voter.imageUrlMini}") - - }); - - h4 - span.number= element.vote.voters.length - | votos por delegados - - element.vote.voters.forEach(function(voter) { - a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") - img(src="#{voter.imageUrlMini}") - - }) - - h4 - | y - span.number= element.vote.voters.length - | votos unipersonales - - element.vote.voters.forEach(function(voter) { - a(href="/profiles/#{voter.id}", rel="tooltip", title="#{voter.fullName}", data-placement="bottom", class="tt") - img(src="#{voter.imageUrlMini}") - - }) + include issue-preliminar-results - } //- Final results - if(Date.now() > element.votingEndDate) { - .span9.box.block-results - h3.block-title - i.icon - span Resultados final - - var totalVoters = element.vote.voters.length; - .box-content.clearfix - h4 - span.number= element.vote.voters.length - | votos contados - - - element.vote.choices.forEach(function(choice) { - .partial(style="width:100%;float:left;") - - var partial = choice.result / (totalVoters || 1) * 100; - h5 - strong #{choice.idea.title} - a(data-toggle="modal", role="button", href="#choice-full-#{choice.id}") - | Leer... - .bar(style="width:#{partial.toFixed(0)}%;") - span.tt(rel="tooltip", data-placement="top", title="#{choice.result} votos") - | #{partial.toFixed(0)} % - - }); + include issue-final-results - }; .modals