Commit 8290c9a67fe1e200493dfcdbad60b9e092f016eb
1 parent
58634dfb
Exists in
spb-stable
and in
3 other branches
Use proper classes for sdiff content
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
29 additions
and
33 deletions
Show diff stats
app/views/projects/notes/_discussion.html.haml
| @@ -36,21 +36,17 @@ | @@ -36,21 +36,17 @@ | ||
| 36 | .discussion-body | 36 | .discussion-body |
| 37 | - if note.for_diff_line? | 37 | - if note.for_diff_line? |
| 38 | - if note.active? | 38 | - if note.active? |
| 39 | - .content | ||
| 40 | - .file= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note | 39 | + = render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note |
| 41 | - else | 40 | - else |
| 42 | = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion' | 41 | = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion' |
| 43 | %div.hide.outdated-discussion | 42 | %div.hide.outdated-discussion |
| 44 | - .content | ||
| 45 | - .notes{ rel: discussion_notes.first.discussion_id } | ||
| 46 | - = render discussion_notes | ||
| 47 | - | 43 | + .notes{ rel: discussion_notes.first.discussion_id } |
| 44 | + = render discussion_notes | ||
| 48 | 45 | ||
| 49 | - else | 46 | - else |
| 50 | - .content | ||
| 51 | - .notes{ rel: discussion_notes.first.discussion_id } | ||
| 52 | - = render discussion_notes | ||
| 53 | - = render "projects/notes/discussion_reply_button", note: discussion_notes.first | 47 | + .notes{ rel: discussion_notes.first.discussion_id } |
| 48 | + = render discussion_notes | ||
| 49 | + = render "projects/notes/discussion_reply_button", note: discussion_notes.first | ||
| 54 | 50 | ||
| 55 | -# will be shown when the other one is hidden | 51 | -# will be shown when the other one is hidden |
| 56 | .discussion-hidden.content.hide | 52 | .discussion-hidden.content.hide |
| @@ -59,4 +55,3 @@ | @@ -59,4 +55,3 @@ | ||
| 59 | = link_to "javascript:;", class: "js-details-target js-toggler-target" do | 55 | = link_to "javascript:;", class: "js-details-target js-toggler-target" do |
| 60 | %i.icon-eye-open | 56 | %i.icon-eye-open |
| 61 | Show | 57 | Show |
| 62 | - |
app/views/projects/notes/_discussion_diff.html.haml
| 1 | - diff = note.diff | 1 | - diff = note.diff |
| 2 | -.header | ||
| 3 | - - if diff.deleted_file | ||
| 4 | - %span= diff.old_path | ||
| 5 | - - else | ||
| 6 | - %span= diff.new_path | ||
| 7 | - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode | ||
| 8 | - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" | ||
| 9 | - %br/ | ||
| 10 | -.content | ||
| 11 | - %table | ||
| 12 | - - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| | ||
| 13 | - %tr.line_holder{ id: line_code } | ||
| 14 | - - if type == "match" | ||
| 15 | - %td.old_line= "..." | ||
| 16 | - %td.new_line= "..." | ||
| 17 | - %td.line_content.matched= line | ||
| 18 | - - else | ||
| 19 | - %td.old_line= raw(type == "new" ? " " : line_old) | ||
| 20 | - %td.new_line= raw(type == "old" ? " " : line_new) | ||
| 21 | - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | 2 | +.diff-file |
| 3 | + .diff-header | ||
| 4 | + - if diff.deleted_file | ||
| 5 | + %span= diff.old_path | ||
| 6 | + - else | ||
| 7 | + %span= diff.new_path | ||
| 8 | + - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode | ||
| 9 | + %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" | ||
| 10 | + %br/ | ||
| 11 | + .diff-content | ||
| 12 | + %table | ||
| 13 | + - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| | ||
| 14 | + %tr.line_holder{ id: line_code } | ||
| 15 | + - if type == "match" | ||
| 16 | + %td.old_line= "..." | ||
| 17 | + %td.new_line= "..." | ||
| 18 | + %td.line_content.matched= line | ||
| 19 | + - else | ||
| 20 | + %td.old_line= raw(type == "new" ? " " : line_old) | ||
| 21 | + %td.new_line= raw(type == "old" ? " " : line_new) | ||
| 22 | + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | ||
| 22 | 23 | ||
| 23 | - - if line_code == note.line_code | ||
| 24 | - = render "projects/notes/diff_notes_with_reply", notes: discussion_notes | 24 | + - if line_code == note.line_code |
| 25 | + = render "projects/notes/diff_notes_with_reply", notes: discussion_notes |