diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index e1ad1d2f9e8c04d941863efa5854ae59c1be6cba..558643d504db3710cd5a13706bfcfe2ba5101120 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -230,7 +230,7 @@ var NoteList = { updateVotes: function() { var votes = $("#votes .votes"); - var notes = $("#notes-list, #new-notes-list").find(".note.vote"); + var notes = $("#notes-list, #new-notes-list").find(".note .vote"); // only update if there is a vote display if (votes.size()) { diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 3e875023c53e747eda87c0b2c6da31a83ca88175..ba02ca6bd499ea026c2e89263c6dcda5bc134cbf 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -12,11 +12,5 @@ module NotesHelper !@mixed_targets || @main_target_type == note.noteable_type end - def note_vote_class(note) - if note.upvote? - "vote upvote" - elsif note.downvote? - "vote downvote" - end end end diff --git a/app/views/notes/_note.html.haml b/app/views/notes/_note.html.haml index 5234e55dcd098754717f22ded7e2a8f5e38bf5cd..57946163b567f26374ba430bdfdabf5b01b572e8 100644 --- a/app/views/notes/_note.html.haml +++ b/app/views/notes/_note.html.haml @@ -1,4 +1,4 @@ -%li{id: dom_id(note), class: "note #{note_vote_class(note)}"} +%li{id: dom_id(note), class: "note"} = image_tag gravatar_icon(note.author.email), class: "avatar s32" %div.note-author %strong= note.author_name @@ -6,14 +6,19 @@ %cite.cgray = time_ago_in_words(note.updated_at) ago - - if note.upvote? - %span.label.label-success - %i.icon-thumbs-up - \+1 - - if note.downvote? - %span.label.label-error - %i.icon-thumbs-down - \-1 + + -# only show vote if it's a note for the main target + - if note_for_main_target?(note) + - if note.upvote? + %span.vote.upvote.label.label-success + %i.icon-thumbs-up + \+1 + - if note.downvote? + %span.vote.downvote.label.label-error + %i.icon-thumbs-down + \-1 + + -# remove button - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) = link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do %i.icon-trash