Commit 6d5c29dc2b08531fd82550e2e9e814382f58bb78

Authored by Riyad Preukschas
1 parent 3bc507e5

Inline diff_notes_reply_button partial

app/views/notes/_create_diff_note.js.haml
... ... @@ -11,8 +11,7 @@
11 11 // find the commented line ...
12 12 var trEl = $(".#{note.line_code}").parent();
13 13 // ... and insert the note and the reply button after it
14   - trEl.after("#{escape_javascript(render "notes/diff_notes_reply_button", note: note)}");
15   - trEl.after("#{escape_javascript(render "notes/diff_note", note: note)}");
  14 + trEl.after("#{escape_javascript(render "notes/diff_notes_with_reply", notes: [note])}");
16 15 } else {
17 16 // instert new note before reply button
18 17 trRpl.before("#{escape_javascript(render "notes/diff_note", note: note)}");
... ...
app/views/notes/_diff_notes_reply_button.html.haml
... ... @@ -1,10 +0,0 @@
1   -%tr.line_notes_row.reply
2   - %td{colspan: 3}
3   - = link_to "javascript:;",
4   - class: "line_note_reply_link js-note-add-to-diff-line",
5   - data: { line_code: note.line_code,
6   - noteable_type: note.noteable_type,
7   - noteable_id: note.noteable_id },
8   - title: "Add a comment to this line" do
9   - %i.icon-comment
10   - Reply
app/views/notes/_diff_notes_with_reply.html.haml
1 1 - notes.each do |note|
2 2 = render "notes/diff_note", note: note
3   -= render "notes/diff_notes_reply_button", note: notes.first
  3 +
  4 +-# reply button
  5 +- note = notes.first # example note
  6 +%tr.line_notes_row.reply
  7 + %td{colspan: 3}
  8 + = link_to "javascript:;",
  9 + class: "line_note_reply_link js-note-add-to-diff-line",
  10 + data: { line_code: note.line_code,
  11 + noteable_type: note.noteable_type,
  12 + noteable_id: note.noteable_id },
  13 + title: "Add a comment to this line" do
  14 + %i.icon-comment
  15 + Reply
... ...