From 3bc507e5c5139c3e43558152675e222dd4b25927 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas <riyad@informatik.uni-bremen.de> Date: Sat, 17 Nov 2012 20:24:12 +0100 Subject: [PATCH] Rename diff note partials --- app/views/commit/show.html.haml | 2 +- app/views/commits/_text_file.html.haml | 4 ++-- app/views/merge_requests/_show.html.haml | 2 +- ...eate_per_line_note.js.haml => _create_diff_note.js.haml} | 6 +++--- .../{_per_line_note.html.haml => _diff_note.html.haml} | 0 .../{_per_line_form.html.haml => _diff_note_form.html.haml} | 0 ...r_line_note_link.html.haml => _diff_note_link.html.haml} | 0 ..._button.html.haml => _diff_notes_reply_button.html.haml} | 0 app/views/notes/_diff_notes_with_reply.html.haml | 3 +++ app/views/notes/_discussion_diff.html.haml | 2 +- app/views/notes/_per_line_notes_with_reply.html.haml | 3 --- app/views/notes/create.js.haml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename app/views/notes/{_create_per_line_note.js.haml => _create_diff_note.js.haml} (71%) rename app/views/notes/{_per_line_note.html.haml => _diff_note.html.haml} (100%) rename app/views/notes/{_per_line_form.html.haml => _diff_note_form.html.haml} (100%) rename app/views/notes/{_per_line_note_link.html.haml => _diff_note_link.html.haml} (100%) rename app/views/notes/{_per_line_reply_button.html.haml => _diff_notes_reply_button.html.haml} (100%) create mode 100644 app/views/notes/_diff_notes_with_reply.html.haml delete mode 100644 app/views/notes/_per_line_notes_with_reply.html.haml diff --git a/app/views/commit/show.html.haml b/app/views/commit/show.html.haml index 432d55b19e3..1157ae7adce 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 5e7886922b4..3d9014c3a3f 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 a09a77c043e..9c5f4af26c3 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_per_line_note.js.haml b/app/views/notes/_create_diff_note.js.haml similarity index 71% rename from app/views/notes/_create_per_line_note.js.haml rename to app/views/notes/_create_diff_note.js.haml index 6f74699996b..453053bd728 100644 --- a/app/views/notes/_create_per_line_note.js.haml +++ b/app/views/notes/_create_diff_note.js.haml @@ -11,9 +11,9 @@ // 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)}"); + 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/per_line_note", note: note)}"); + trRpl.before("#{escape_javascript(render "notes/diff_note", note: note)}"); } diff --git a/app/views/notes/_per_line_note.html.haml b/app/views/notes/_diff_note.html.haml similarity index 100% rename from app/views/notes/_per_line_note.html.haml rename to app/views/notes/_diff_note.html.haml diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_diff_note_form.html.haml similarity index 100% rename from app/views/notes/_per_line_form.html.haml rename to app/views/notes/_diff_note_form.html.haml diff --git a/app/views/notes/_per_line_note_link.html.haml b/app/views/notes/_diff_note_link.html.haml similarity index 100% rename from app/views/notes/_per_line_note_link.html.haml rename to app/views/notes/_diff_note_link.html.haml diff --git a/app/views/notes/_per_line_reply_button.html.haml b/app/views/notes/_diff_notes_reply_button.html.haml similarity index 100% rename from app/views/notes/_per_line_reply_button.html.haml rename to app/views/notes/_diff_notes_reply_button.html.haml 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 00000000000..43f954d532f --- /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 4cd227d68c6..544435af6ba 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_notes_with_reply.html.haml b/app/views/notes/_per_line_notes_with_reply.html.haml deleted file mode 100644 index ebe0c5c6c47..00000000000 --- 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/create.js.haml b/app/views/notes/create.js.haml index 03866591c4f..9921312e6eb 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 -- 2.30.9