Show votes as a bar

This commit is contained in:
Riyad Preukschas 2012-09-08 16:44:56 +02:00
parent 5ca31aa252
commit a5164ea2ed
5 changed files with 70 additions and 27 deletions

View file

@ -23,7 +23,12 @@
authored by #{merge_request.author_name}
= time_ago_in_words(merge_request.created_at)
ago
- if merge_request.upvotes > 0
%span.badge.badge-success= "+#{merge_request.upvotes}"
- if merge_request.downvotes > 0
%span.badge.badge-important= "-#{merge_request.downvotes}"
- if merge_request.votes_count > 0
.votes.votes-inline
.upvotes= merge_request.upvotes
.progress
- up_percent = 100.0/merge_request.votes_count*merge_request.upvotes
- down_percent = 100.0-up_percent
.bar.bar-success{style: "width: #{up_percent}%;"}
.bar.bar-danger{style: "width: #{down_percent}%;"}
.downvotes= merge_request.downvotes

View file

@ -23,12 +23,15 @@
%i.icon-edit
Edit
%br
.votes#votes
Votes:
.upvotes#upvotes= "#{@merge_request.upvotes} up"
.downvotes#downvotes= "#{@merge_request.downvotes} down"
.right
.span3.votes.votes-block#votes
.progress
- up_percent = 100.0/@merge_request.votes_count*@merge_request.upvotes
- down_percent = 100.0-up_percent
.bar.bar-success{style: "width: #{up_percent}%;"}
.bar.bar-danger{style: "width: #{down_percent}%;"}
.upvotes= "#{@merge_request.upvotes} up"
.downvotes= "#{@merge_request.downvotes} down"
.back_link
= link_to project_merge_requests_path(@project) do