3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-26 04:32:37 +01:00
dbot/views/polls.jade

37 lines
1.3 KiB
Plaintext
Raw Normal View History

2012-06-15 18:58:33 +02:00
div#backlink
2012-06-15 19:23:36 +02:00
a(href='/polls/') « Poll list
2012-06-15 17:15:02 +02:00
h2 #{description}
p Voters (#{locals.totalVotes}):
-each voter in votees
2012-06-15 17:26:13 +02:00
| #{voter}
2012-06-15 17:15:02 +02:00
ul#votelist
-var hasYouTubeVids=false
-each votes,option in options
-var percentage = votes/locals.totalVotes*100
-if(options.hasOwnProperty(option))
-if(option.match(locals.url_regex))
li.option
-if(option.match(/(jpg|png|gif|jpeg|tiff)$/))
a(href=option)
img(src=option)
-else if(option.match(/youtube.com\/watch/))
-hasYouTubeVids = true
span(class='ytplaceholder')
=option
-else
a(href=option)
=option
-else
li.option #{option}
li.option-votes
.vote-track
-if(!isNaN(percentage))
.vote-percentage(style="width: #{percentage}%")
case votes
when 1: #{votes} vote
default: #{votes} votes
2012-06-15 17:15:02 +02:00
-if(!isNaN(percentage))
|(#{percentage.toFixed(2)}%)
-if(hasYouTubeVids)
script(src='/ytembed.js')