diff --git a/app/views/commit/show.html.haml b/app/views/commit/show.html.haml
index 432d55b..1157ae7 100644
--- a/app/views/commit/show.html.haml
+++ b/app/views/commit/show.html.haml
@@ -1,7 +1,7 @@
= render "commits/commit_box"
= render "commits/diffs", diffs: @commit.diffs
= render "notes/notes_with_form", tid: @commit.id, tt: "commit"
-= render "notes/per_line_form"
+= render "notes/diff_note_form"
:javascript
diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml
index 5e78869..3d9014c 100644
--- a/app/views/commits/_text_file.html.haml
+++ b/app/views/commits/_text_file.html.haml
@@ -13,11 +13,11 @@
%td.old_line
= link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code
- if @comments_allowed
- = render "notes/per_line_note_link", line_code: line_code
+ = render "notes/diff_note_link", line_code: line_code
%td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} "
- if @reply_allowed
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at)
- unless comments.empty?
- = render "notes/per_line_notes_with_reply", notes: comments
+ = render "notes/diff_notes_with_reply", notes: comments
diff --git a/app/views/merge_requests/_show.html.haml b/app/views/merge_requests/_show.html.haml
index a09a77c..9c5f4af 100644
--- a/app/views/merge_requests/_show.html.haml
+++ b/app/views/merge_requests/_show.html.haml
@@ -21,7 +21,7 @@
= render "merge_requests/show/diffs" if @diffs
.status
-= render "notes/per_line_form"
+= render "notes/diff_note_form"
:javascript
$(function(){
diff --git a/app/views/notes/_create_diff_note.js.haml b/app/views/notes/_create_diff_note.js.haml
new file mode 100644
index 0000000..453053b
--- /dev/null
+++ b/app/views/notes/_create_diff_note.js.haml
@@ -0,0 +1,19 @@
+- if note.valid?
+ :plain
+ // hide and reset the form
+ $(".per_line_form").hide();
+ $('.line-note-form-holder textarea').val("");
+
+ // find the reply button for this line
+ // (might not be there if this is the first note)
+ var trRpl = $("a.line_note_reply_link[data-noteable-type='#{note.noteable_type}'][data-noteable-id='#{note.noteable_id}'][data-line-code='#{note.line_code}']").closest("tr");
+ if (trRpl.size() == 0) {
+ // find the commented line ...
+ var trEl = $(".#{note.line_code}").parent();
+ // ... and insert the note and the reply button after it
+ trEl.after("#{escape_javascript(render "notes/diff_notes_reply_button", note: note)}");
+ trEl.after("#{escape_javascript(render "notes/diff_note", note: note)}");
+ } else {
+ // instert new note before reply button
+ trRpl.before("#{escape_javascript(render "notes/diff_note", note: note)}");
+ }
diff --git a/app/views/notes/_create_per_line_note.js.haml b/app/views/notes/_create_per_line_note.js.haml
deleted file mode 100644
index 6f74699..0000000
--- a/app/views/notes/_create_per_line_note.js.haml
+++ /dev/null
@@ -1,19 +0,0 @@
-- if note.valid?
- :plain
- // hide and reset the form
- $(".per_line_form").hide();
- $('.line-note-form-holder textarea').val("");
-
- // find the reply button for this line
- // (might not be there if this is the first note)
- var trRpl = $("a.line_note_reply_link[data-noteable-type='#{note.noteable_type}'][data-noteable-id='#{note.noteable_id}'][data-line-code='#{note.line_code}']").closest("tr");
- if (trRpl.size() == 0) {
- // find the commented line ...
- var trEl = $(".#{note.line_code}").parent();
- // ... and insert the note and the reply button after it
- trEl.after("#{escape_javascript(render "notes/per_line_reply_button", note: note)}");
- trEl.after("#{escape_javascript(render "notes/per_line_note", note: note)}");
- } else {
- // instert new note before reply button
- trRpl.before("#{escape_javascript(render "notes/per_line_note", note: note)}");
- }
diff --git a/app/views/notes/_diff_note.html.haml b/app/views/notes/_diff_note.html.haml
new file mode 100644
index 0000000..28bcd6e
--- /dev/null
+++ b/app/views/notes/_diff_note.html.haml
@@ -0,0 +1,5 @@
+%tr.line_notes_row
+ %td{colspan: 3}
+ %ul
+ = render "notes/note", note: note
+
diff --git a/app/views/notes/_diff_note_form.html.haml b/app/views/notes/_diff_note_form.html.haml
new file mode 100644
index 0000000..9210be9
--- /dev/null
+++ b/app/views/notes/_diff_note_form.html.haml
@@ -0,0 +1,31 @@
+%table{style: "display:none;"}
+ %tr.per_line_form
+ %td{colspan: 3 }
+ .line-note-form-holder
+ = form_for [@project, @note], remote: "true", multipart: true do |f|
+ %h3.page_title Leave a comment
+ %div.span10
+ -if @note.errors.any?
+ .alert-message.block-message.error
+ - @note.errors.full_messages.each do |msg|
+ %div= msg
+
+ = f.hidden_field :noteable_id
+ = f.hidden_field :noteable_type
+ = f.hidden_field :line_code
+ = f.text_area :note, size: 255, class: 'line-note-text js-gfm-input'
+ .note_actions
+ .buttons
+ = f.submit 'Add Comment', class: "btn save-btn submit_note submit_inline_note", id: "submit_note"
+ = link_to "Cancel", "javascript:;", class: "btn hide-button"
+ .options
+ %h6.left Notify via email:
+ .labels
+ = label_tag :notify do
+ = check_box_tag :notify, 1, @note.noteable_type != "Commit"
+ %span Project team
+
+ - if @note.notify_only_author?(current_user)
+ = label_tag :notify_author do
+ = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
+ %span Commit author
diff --git a/app/views/notes/_diff_note_link.html.haml b/app/views/notes/_diff_note_link.html.haml
new file mode 100644
index 0000000..d25577e
--- /dev/null
+++ b/app/views/notes/_diff_note_link.html.haml
@@ -0,0 +1,6 @@
+= link_to "",
+ "#",
+ id: "add-diff-line-note-#{line_code}",
+ class: "line_note_link js-note-add-to-diff-line",
+ data: @comments_target.merge({ line_code: line_code }),
+ title: "Add a comment to this line"
diff --git a/app/views/notes/_diff_notes_reply_button.html.haml b/app/views/notes/_diff_notes_reply_button.html.haml
new file mode 100644
index 0000000..edd84ea
--- /dev/null
+++ b/app/views/notes/_diff_notes_reply_button.html.haml
@@ -0,0 +1,10 @@
+%tr.line_notes_row.reply
+ %td{colspan: 3}
+ = link_to "javascript:;",
+ class: "line_note_reply_link js-note-add-to-diff-line",
+ data: { line_code: note.line_code,
+ noteable_type: note.noteable_type,
+ noteable_id: note.noteable_id },
+ title: "Add a comment to this line" do
+ %i.icon-comment
+ Reply
diff --git a/app/views/notes/_diff_notes_with_reply.html.haml b/app/views/notes/_diff_notes_with_reply.html.haml
new file mode 100644
index 0000000..43f954d
--- /dev/null
+++ b/app/views/notes/_diff_notes_with_reply.html.haml
@@ -0,0 +1,3 @@
+- notes.each do |note|
+ = render "notes/diff_note", note: note
+= render "notes/diff_notes_reply_button", note: notes.first
diff --git a/app/views/notes/_discussion_diff.html.haml b/app/views/notes/_discussion_diff.html.haml
index 4cd227d..544435a 100644
--- a/app/views/notes/_discussion_diff.html.haml
+++ b/app/views/notes/_discussion_diff.html.haml
@@ -20,5 +20,5 @@
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} "
- if line_code == note.line_code
- = render "notes/per_line_notes_with_reply", notes: discussion_notes
+ = render "notes/diff_notes_with_reply", notes: discussion_notes
- break # cut off diff after notes
diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_per_line_form.html.haml
deleted file mode 100644
index 9210be9..0000000
--- a/app/views/notes/_per_line_form.html.haml
+++ /dev/null
@@ -1,31 +0,0 @@
-%table{style: "display:none;"}
- %tr.per_line_form
- %td{colspan: 3 }
- .line-note-form-holder
- = form_for [@project, @note], remote: "true", multipart: true do |f|
- %h3.page_title Leave a comment
- %div.span10
- -if @note.errors.any?
- .alert-message.block-message.error
- - @note.errors.full_messages.each do |msg|
- %div= msg
-
- = f.hidden_field :noteable_id
- = f.hidden_field :noteable_type
- = f.hidden_field :line_code
- = f.text_area :note, size: 255, class: 'line-note-text js-gfm-input'
- .note_actions
- .buttons
- = f.submit 'Add Comment', class: "btn save-btn submit_note submit_inline_note", id: "submit_note"
- = link_to "Cancel", "javascript:;", class: "btn hide-button"
- .options
- %h6.left Notify via email:
- .labels
- = label_tag :notify do
- = check_box_tag :notify, 1, @note.noteable_type != "Commit"
- %span Project team
-
- - if @note.notify_only_author?(current_user)
- = label_tag :notify_author do
- = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
- %span Commit author
diff --git a/app/views/notes/_per_line_note.html.haml b/app/views/notes/_per_line_note.html.haml
deleted file mode 100644
index 28bcd6e..0000000
--- a/app/views/notes/_per_line_note.html.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-%tr.line_notes_row
- %td{colspan: 3}
- %ul
- = render "notes/note", note: note
-
diff --git a/app/views/notes/_per_line_note_link.html.haml b/app/views/notes/_per_line_note_link.html.haml
deleted file mode 100644
index d25577e..0000000
--- a/app/views/notes/_per_line_note_link.html.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-= link_to "",
- "#",
- id: "add-diff-line-note-#{line_code}",
- class: "line_note_link js-note-add-to-diff-line",
- data: @comments_target.merge({ line_code: line_code }),
- title: "Add a comment to this line"
diff --git a/app/views/notes/_per_line_notes_with_reply.html.haml b/app/views/notes/_per_line_notes_with_reply.html.haml
deleted file mode 100644
index ebe0c5c..0000000
--- a/app/views/notes/_per_line_notes_with_reply.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- notes.each do |note|
- = render "notes/per_line_note", note: note
-= render "notes/per_line_reply_button", note: notes.first
diff --git a/app/views/notes/_per_line_reply_button.html.haml b/app/views/notes/_per_line_reply_button.html.haml
deleted file mode 100644
index edd84ea..0000000
--- a/app/views/notes/_per_line_reply_button.html.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-%tr.line_notes_row.reply
- %td{colspan: 3}
- = link_to "javascript:;",
- class: "line_note_reply_link js-note-add-to-diff-line",
- data: { line_code: note.line_code,
- noteable_type: note.noteable_type,
- noteable_id: note.noteable_id },
- title: "Add a comment to this line" do
- %i.icon-comment
- Reply
diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml
index 0386659..9921312 100644
--- a/app/views/notes/create.js.haml
+++ b/app/views/notes/create.js.haml
@@ -1,5 +1,5 @@
- if @note.line_code
- = render "create_per_line_note", note: @note
+ = render "create_diff_note", note: @note
- else
= render "create_common_note", note: @note
--
libgit2 0.21.2