Commit fb0279f3113f58b1cbdbe04acabe874ac4d231f9
1 parent
3f72af99
Exists in
master
and in
4 other branches
Fix vote counting to only count main target notes (not mixed in ones)
Showing
3 changed files
with
15 additions
and
16 deletions
Show diff stats
app/assets/javascripts/notes.js
... | ... | @@ -230,7 +230,7 @@ var NoteList = { |
230 | 230 | updateVotes: |
231 | 231 | function() { |
232 | 232 | var votes = $("#votes .votes"); |
233 | - var notes = $("#notes-list, #new-notes-list").find(".note.vote"); | |
233 | + var notes = $("#notes-list, #new-notes-list").find(".note .vote"); | |
234 | 234 | |
235 | 235 | // only update if there is a vote display |
236 | 236 | if (votes.size()) { | ... | ... |
app/helpers/notes_helper.rb
app/views/notes/_note.html.haml
1 | -%li{id: dom_id(note), class: "note #{note_vote_class(note)}"} | |
1 | +%li{id: dom_id(note), class: "note"} | |
2 | 2 | = image_tag gravatar_icon(note.author.email), class: "avatar s32" |
3 | 3 | %div.note-author |
4 | 4 | %strong= note.author_name |
... | ... | @@ -6,14 +6,19 @@ |
6 | 6 | %cite.cgray |
7 | 7 | = time_ago_in_words(note.updated_at) |
8 | 8 | ago |
9 | - - if note.upvote? | |
10 | - %span.label.label-success | |
11 | - %i.icon-thumbs-up | |
12 | - \+1 | |
13 | - - if note.downvote? | |
14 | - %span.label.label-error | |
15 | - %i.icon-thumbs-down | |
16 | - \-1 | |
9 | + | |
10 | + -# only show vote if it's a note for the main target | |
11 | + - if note_for_main_target?(note) | |
12 | + - if note.upvote? | |
13 | + %span.vote.upvote.label.label-success | |
14 | + %i.icon-thumbs-up | |
15 | + \+1 | |
16 | + - if note.downvote? | |
17 | + %span.vote.downvote.label.label-error | |
18 | + %i.icon-thumbs-down | |
19 | + \-1 | |
20 | + | |
21 | + -# remove button | |
17 | 22 | - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) |
18 | 23 | = link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do |
19 | 24 | %i.icon-trash | ... | ... |