Commit 0bfcc574b660108646bd2c99a611163a0c847251
1 parent
f7c70eaa
Exists in
master
and in
4 other branches
Extract displaying votes into partials
Showing
6 changed files
with
17 additions
and
32 deletions
Show diff stats
app/views/issues/_show.html.haml
@@ -35,11 +35,4 @@ | @@ -35,11 +35,4 @@ | ||
35 | | 35 | |
36 | 36 | ||
37 | - if issue.votes_count > 0 | 37 | - if issue.votes_count > 0 |
38 | - .votes.votes-inline | ||
39 | - .upvotes= issue.upvotes | ||
40 | - .progress | ||
41 | - - up_percent = 100.0/issue.votes_count*issue.upvotes | ||
42 | - - down_percent = 100.0-up_percent | ||
43 | - .bar.bar-success{style: "width: #{up_percent}%;"} | ||
44 | - .bar.bar-danger{style: "width: #{down_percent}%;"} | ||
45 | - .downvotes= issue.downvotes | 38 | + = render 'votes/votes_inline', votable: issue |
app/views/issues/show.html.haml
@@ -17,14 +17,7 @@ | @@ -17,14 +17,7 @@ | ||
17 | Edit | 17 | Edit |
18 | 18 | ||
19 | .right | 19 | .right |
20 | - .span3.votes.votes-block#votes | ||
21 | - .progress | ||
22 | - - up_percent = 100.0/@issue.votes_count*@issue.upvotes | ||
23 | - - down_percent = 100.0-up_percent | ||
24 | - .bar.bar-success{style: "width: #{up_percent}%;"} | ||
25 | - .bar.bar-danger{style: "width: #{down_percent}%;"} | ||
26 | - .upvotes= "#{@issue.upvotes} up" | ||
27 | - .downvotes= "#{@issue.downvotes} down" | 20 | + .span3#votes= render 'votes/votes_block', votable: @issue |
28 | 21 | ||
29 | .back_link | 22 | .back_link |
30 | = link_to project_issues_path(@project) do | 23 | = link_to project_issues_path(@project) do |
app/views/merge_requests/_merge_request.html.haml
@@ -23,12 +23,6 @@ | @@ -23,12 +23,6 @@ | ||
23 | authored by #{merge_request.author_name} | 23 | authored by #{merge_request.author_name} |
24 | = time_ago_in_words(merge_request.created_at) | 24 | = time_ago_in_words(merge_request.created_at) |
25 | ago | 25 | ago |
26 | + | ||
26 | - if merge_request.votes_count > 0 | 27 | - if merge_request.votes_count > 0 |
27 | - .votes.votes-inline | ||
28 | - .upvotes= merge_request.upvotes | ||
29 | - .progress | ||
30 | - - up_percent = 100.0/merge_request.votes_count*merge_request.upvotes | ||
31 | - - down_percent = 100.0-up_percent | ||
32 | - .bar.bar-success{style: "width: #{up_percent}%;"} | ||
33 | - .bar.bar-danger{style: "width: #{down_percent}%;"} | ||
34 | - .downvotes= merge_request.downvotes | 28 | + = render 'votes/votes_inline', votable: merge_request |
app/views/merge_requests/show/_mr_title.html.haml
@@ -24,14 +24,7 @@ | @@ -24,14 +24,7 @@ | ||
24 | Edit | 24 | Edit |
25 | 25 | ||
26 | .right | 26 | .right |
27 | - .span3.votes.votes-block#votes | ||
28 | - .progress | ||
29 | - - up_percent = 100.0/@merge_request.votes_count*@merge_request.upvotes | ||
30 | - - down_percent = 100.0-up_percent | ||
31 | - .bar.bar-success{style: "width: #{up_percent}%;"} | ||
32 | - .bar.bar-danger{style: "width: #{down_percent}%;"} | ||
33 | - .upvotes= "#{@merge_request.upvotes} up" | ||
34 | - .downvotes= "#{@merge_request.downvotes} down" | 27 | + .span3#votes= render 'votes/votes_block', votable: @merge_request |
35 | 28 | ||
36 | .back_link | 29 | .back_link |
37 | = link_to project_merge_requests_path(@project) do | 30 | = link_to project_merge_requests_path(@project) do |