Commit 3bc507e5c5139c3e43558152675e222dd4b25927
1 parent
534bd5a2
Exists in
master
and in
4 other branches
Rename diff note partials
Showing
17 changed files
with
80 additions
and
80 deletions
Show diff stats
app/views/commit/show.html.haml
app/views/commits/_text_file.html.haml
... | ... | @@ -13,11 +13,11 @@ |
13 | 13 | %td.old_line |
14 | 14 | = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code |
15 | 15 | - if @comments_allowed |
16 | - = render "notes/per_line_note_link", line_code: line_code | |
16 | + = render "notes/diff_note_link", line_code: line_code | |
17 | 17 | %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code |
18 | 18 | %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " |
19 | 19 | |
20 | 20 | - if @reply_allowed |
21 | 21 | - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) |
22 | 22 | - unless comments.empty? |
23 | - = render "notes/per_line_notes_with_reply", notes: comments | |
23 | + = render "notes/diff_notes_with_reply", notes: comments | ... | ... |
app/views/merge_requests/_show.html.haml
... | ... | @@ -0,0 +1,19 @@ |
1 | +- if note.valid? | |
2 | + :plain | |
3 | + // hide and reset the form | |
4 | + $(".per_line_form").hide(); | |
5 | + $('.line-note-form-holder textarea').val(""); | |
6 | + | |
7 | + // find the reply button for this line | |
8 | + // (might not be there if this is the first note) | |
9 | + 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"); | |
10 | + if (trRpl.size() == 0) { | |
11 | + // find the commented line ... | |
12 | + var trEl = $(".#{note.line_code}").parent(); | |
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)}"); | |
16 | + } else { | |
17 | + // instert new note before reply button | |
18 | + trRpl.before("#{escape_javascript(render "notes/diff_note", note: note)}"); | |
19 | + } | ... | ... |
app/views/notes/_create_per_line_note.js.haml
... | ... | @@ -1,19 +0,0 @@ |
1 | -- if note.valid? | |
2 | - :plain | |
3 | - // hide and reset the form | |
4 | - $(".per_line_form").hide(); | |
5 | - $('.line-note-form-holder textarea').val(""); | |
6 | - | |
7 | - // find the reply button for this line | |
8 | - // (might not be there if this is the first note) | |
9 | - 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"); | |
10 | - if (trRpl.size() == 0) { | |
11 | - // find the commented line ... | |
12 | - var trEl = $(".#{note.line_code}").parent(); | |
13 | - // ... and insert the note and the reply button after it | |
14 | - trEl.after("#{escape_javascript(render "notes/per_line_reply_button", note: note)}"); | |
15 | - trEl.after("#{escape_javascript(render "notes/per_line_note", note: note)}"); | |
16 | - } else { | |
17 | - // instert new note before reply button | |
18 | - trRpl.before("#{escape_javascript(render "notes/per_line_note", note: note)}"); | |
19 | - } |
... | ... | @@ -0,0 +1,31 @@ |
1 | +%table{style: "display:none;"} | |
2 | + %tr.per_line_form | |
3 | + %td{colspan: 3 } | |
4 | + .line-note-form-holder | |
5 | + = form_for [@project, @note], remote: "true", multipart: true do |f| | |
6 | + %h3.page_title Leave a comment | |
7 | + %div.span10 | |
8 | + -if @note.errors.any? | |
9 | + .alert-message.block-message.error | |
10 | + - @note.errors.full_messages.each do |msg| | |
11 | + %div= msg | |
12 | + | |
13 | + = f.hidden_field :noteable_id | |
14 | + = f.hidden_field :noteable_type | |
15 | + = f.hidden_field :line_code | |
16 | + = f.text_area :note, size: 255, class: 'line-note-text js-gfm-input' | |
17 | + .note_actions | |
18 | + .buttons | |
19 | + = f.submit 'Add Comment', class: "btn save-btn submit_note submit_inline_note", id: "submit_note" | |
20 | + = link_to "Cancel", "javascript:;", class: "btn hide-button" | |
21 | + .options | |
22 | + %h6.left Notify via email: | |
23 | + .labels | |
24 | + = label_tag :notify do | |
25 | + = check_box_tag :notify, 1, @note.noteable_type != "Commit" | |
26 | + %span Project team | |
27 | + | |
28 | + - if @note.notify_only_author?(current_user) | |
29 | + = label_tag :notify_author do | |
30 | + = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" | |
31 | + %span Commit author | ... | ... |
... | ... | @@ -0,0 +1,10 @@ |
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/_discussion_diff.html.haml
... | ... | @@ -20,5 +20,5 @@ |
20 | 20 | %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " |
21 | 21 | |
22 | 22 | - if line_code == note.line_code |
23 | - = render "notes/per_line_notes_with_reply", notes: discussion_notes | |
23 | + = render "notes/diff_notes_with_reply", notes: discussion_notes | |
24 | 24 | - break # cut off diff after notes | ... | ... |
app/views/notes/_per_line_form.html.haml
... | ... | @@ -1,31 +0,0 @@ |
1 | -%table{style: "display:none;"} | |
2 | - %tr.per_line_form | |
3 | - %td{colspan: 3 } | |
4 | - .line-note-form-holder | |
5 | - = form_for [@project, @note], remote: "true", multipart: true do |f| | |
6 | - %h3.page_title Leave a comment | |
7 | - %div.span10 | |
8 | - -if @note.errors.any? | |
9 | - .alert-message.block-message.error | |
10 | - - @note.errors.full_messages.each do |msg| | |
11 | - %div= msg | |
12 | - | |
13 | - = f.hidden_field :noteable_id | |
14 | - = f.hidden_field :noteable_type | |
15 | - = f.hidden_field :line_code | |
16 | - = f.text_area :note, size: 255, class: 'line-note-text js-gfm-input' | |
17 | - .note_actions | |
18 | - .buttons | |
19 | - = f.submit 'Add Comment', class: "btn save-btn submit_note submit_inline_note", id: "submit_note" | |
20 | - = link_to "Cancel", "javascript:;", class: "btn hide-button" | |
21 | - .options | |
22 | - %h6.left Notify via email: | |
23 | - .labels | |
24 | - = label_tag :notify do | |
25 | - = check_box_tag :notify, 1, @note.noteable_type != "Commit" | |
26 | - %span Project team | |
27 | - | |
28 | - - if @note.notify_only_author?(current_user) | |
29 | - = label_tag :notify_author do | |
30 | - = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" | |
31 | - %span Commit author |
app/views/notes/_per_line_note.html.haml
app/views/notes/_per_line_note_link.html.haml
app/views/notes/_per_line_notes_with_reply.html.haml
app/views/notes/_per_line_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 |