diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-01 07:09:56 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-06 08:29:57 +0200 |
commit | 914bb05d282bca9c4509d56c1be409a5889e57b8 (patch) | |
tree | d1f1b5ee1b5ca807f849470c2366c706990acd08 /app/views/projects/diffs | |
parent | e065f4848b257256141752e6498398cd68fa7786 (diff) | |
download | gitlab-ce-914bb05d282bca9c4509d56c1be409a5889e57b8.tar.gz |
Moving up common html data attributes
Diffstat (limited to 'app/views/projects/diffs')
-rw-r--r-- | app/views/projects/diffs/_line.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/diffs/_parallel_view.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/diffs/_text_file.html.haml | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/app/views/projects/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml index 31e8378c9dc..da1c81bfc15 100644 --- a/app/views/projects/diffs/_line.html.haml +++ b/app/views/projects/diffs/_line.html.haml @@ -1,6 +1,6 @@ - type = line.type -- holder_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], discussion_id: discussion_id(line_code), note_type: LegacyDiffNote.name } } : {} -%tr.line_holder{ holder_data, id: line_code, class: type } +- line_data = @comments_target.any? ? { data: { discussion_id: discussion_id(line_code) } } : {} +%tr.line_holder{ line_data, id: line_code, class: type } - case type - when 'match' = render "projects/diffs/match_line", { line: line.text, diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index 089ddf23240..e205686ceea 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -1,11 +1,11 @@ / Side-by-side diff view -%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight +- text_file_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], note_type: LegacyDiffNote.name } } : {} +%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight{ text_file_data } %table - diff_file.parallel_diff_lines.each do |line| - left = line[:left] - right = line[:right] - - holder_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], note_type: LegacyDiffNote.name } } : {} - %tr.line_holder.parallel{ holder_data } + %tr.line_holder.parallel - if left[:type] == 'match' = render "projects/diffs/match_line_parallel", { line: left[:text] } - elsif left[:type] == 'nonewline' diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index 068593a7dd1..a1c3bf74b0a 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -3,7 +3,8 @@ .suppressed-container %a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show. -%table.text-file.code.js-syntax-highlight{ class: too_big ? 'hide' : '' } +- text_file_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], note_type: LegacyDiffNote.name } } : {} +%table.text-file.code.js-syntax-highlight{ text_file_data, class: too_big ? 'hide' : '' } - last_line = 0 - diff_file.highlighted_diff_lines.each_with_index do |line, index| |