Skip to content

Commit

Permalink
Merge branch 'production'
Browse files Browse the repository at this point in the history
  • Loading branch information
tashian committed Apr 20, 2011
2 parents f76aeef + 16430e5 commit c1c0ade
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/votes/_vote.html.haml
Expand Up @@ -34,7 +34,7 @@
%span.other-votes.rounded= vote.other_count.round
%span.small-label other votes

.vote-bar.grid_8.alpha
.vote-bar.grid_8.alpha{:'data-vote-count' => vote.total_count}
%span{:class => 'vote-yes-block', :style => "width: #{vote.yes_pct}%;"}  
%span{:class => 'vote-no-block', :style => "width: #{vote.no_pct}%;"}  
%span{:class => 'vote-other-block', :style => "width: #{vote.other_pct}%;"}  
Expand Down
12 changes: 12 additions & 0 deletions public/javascripts/application.js
Expand Up @@ -106,6 +106,18 @@ $(document).ready(function() {
}
);

// On pages with votes, resize the vote bar to show votes relative to one another.
if ($('.vote-bar')) {
vote_counts = $('.vote-bar').map(function () { return $(this).data('vote-count'); });

max_vote_count = 0
vote_counts.each(function () { if (this > max_vote_count) { max_vote_count = this; } });

$('.vote-bar').each(function () {
$(this).width( (($(this).data('vote-count') / max_vote_count) * 100).toString() + "%" );
});
}

});

function replaceURLWithHTMLLinks(text) {
Expand Down

0 comments on commit c1c0ade

Please sign in to comment.