Commit 1f711fd9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove upvotes js logic since it does not work as expected anyway

parent d735321e
...@@ -425,7 +425,7 @@ class @Notes ...@@ -425,7 +425,7 @@ class @Notes
@removeDiscussionNoteForm(form) @removeDiscussionNoteForm(form)
updateVotes: -> updateVotes: ->
(new NotesVotes).updateVotes() true
### ###
Called after an attachment file has been selected. Called after an attachment file has been selected.
......
class @NotesVotes
updateVotes: ->
votes = $("#votes .votes")
notes = $("#notes-list .note .vote")
# only update if there is a vote display
if votes.size()
upvotes = notes.filter(".upvote").size()
downvotes = notes.filter(".downvote").size()
votesCount = upvotes + downvotes
upvotesPercent = (if votesCount then (100.0 / votesCount * upvotes) else 0)
downvotesPercent = (if votesCount then (100.0 - upvotesPercent) else 0)
# change vote bar lengths
votes.find(".bar-success").css "width", upvotesPercent + "%"
votes.find(".bar-danger").css "width", downvotesPercent + "%"
# replace vote numbers
votes.find(".upvotes").text votes.find(".upvotes").text().replace(/\d+/, upvotes)
votes.find(".downvotes").text votes.find(".downvotes").text().replace(/\d+/, downvotes)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment