Commit b8113334a86639b87d5f89cc78e2279a8ae4e38a

Authored by Riyad Preukschas
1 parent 0546b9c6

Highlight voting notes for issues and merge requests

app/assets/stylesheets/sections/notes.scss
@@ -81,6 +81,19 @@ @@ -81,6 +81,19 @@
81 border-top: 1px solid #eee; 81 border-top: 1px solid #eee;
82 } 82 }
83 83
  84 +/* mark vote notes */
  85 +.voting_notes .note {
  86 + padding: 8px 0 8px 12px;
  87 + &.upvote {
  88 + padding-left: 8px;
  89 + border-left: 4px solid #468847;
  90 + }
  91 + &.downvote {
  92 + padding-left: 8px;
  93 + border-left: 4px solid #B94A48;
  94 + }
  95 +}
  96 +
84 .notes-status { 97 .notes-status {
85 margin: 18px; 98 margin: 18px;
86 } 99 }
app/helpers/notes_helper.rb
@@ -6,4 +6,12 @@ module NotesHelper @@ -6,4 +6,12 @@ module NotesHelper
6 def loading_new_notes? 6 def loading_new_notes?
7 params[:loading_new].present? 7 params[:loading_new].present?
8 end 8 end
  9 +
  10 + def note_vote_class(note)
  11 + if note.upvote?
  12 + "vote upvote"
  13 + elsif note.downvote?
  14 + "vote downvote"
  15 + end
  16 + end
9 end 17 end
app/views/issues/show.html.haml
@@ -61,4 +61,4 @@ @@ -61,4 +61,4 @@
61 = markdown @issue.description 61 = markdown @issue.description
62 62
63 63
64 -.issue_notes#notes= render "notes/notes_with_form", tid: @issue.id, tt: "issue" 64 +.issue_notes.voting_notes#notes= render "notes/notes_with_form", tid: @issue.id, tt: "issue"
app/views/merge_requests/_show.html.haml
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 %i.icon-list-alt 15 %i.icon-list-alt
16 Diff 16 Diff
17 17
18 -.merge_request_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" } 18 +.merge_request_notes.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" }
19 = render("notes/notes_with_form", tid: @merge_request.id, tt: "merge_request") 19 = render("notes/notes_with_form", tid: @merge_request.id, tt: "merge_request")
20 .merge-request-diffs 20 .merge-request-diffs
21 = render "merge_requests/show/diffs" if @diffs 21 = render "merge_requests/show/diffs" if @diffs
app/views/notes/_note.html.haml
1 -%li{id: dom_id(note), class: "note"} 1 +%li{id: dom_id(note), class: "note #{note_vote_class(note)}"}
2 = image_tag gravatar_icon(note.author.email), class: "avatar s32" 2 = image_tag gravatar_icon(note.author.email), class: "avatar s32"
3 %div.note-author 3 %div.note-author
4 %strong= note.author_name 4 %strong= note.author_name