Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
b54f2393
Commit
b54f2393
authored
Sep 03, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parallel diff in two columns.
parent
de6f4c31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
35 deletions
+15
-35
app/views/projects/commits/_parallel_view.html.haml
app/views/projects/commits/_parallel_view.html.haml
+15
-35
No files found.
app/views/projects/commits/_parallel_view.html.haml
View file @
b54f2393
/ Side-by-side diff view
/ Side-by-side diff view
-
old_lines
,
new_lines
=
parallel_diff_lines
(
project
,
@commit
,
diff
,
file
)
-
num_lines
=
old_lines
.
length
%div
.text-file
%div
.text-file
%table
%table
-
num_lines
.
times
do
|
index
|
-
each_diff_line
(
diff
,
index
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
e
|
-
new_line
=
new_lines
[
index
]
%tr
.line_holder.parallel
{
id:
line_code
,
class:
"#{type}"
}
-
old_line
=
old_lines
[
index
]
-
if
type
!=
'match'
%tr
.line_holder.parallel
%td
.old_line
-# For old line
=
link_to
raw
(
type
==
"new"
?
" "
:
line_old
),
"#
#{
line_code
}
"
,
id:
line_code
-
if
old_line
.
type
==
:file_created
-
if
type
==
'old'
%td
.old_line
=
old_line
.
num
%td
.line_content
{
class:
"parallel noteable_line old #{line_code}"
,
"line_code"
=>
line_code
}=
line
%td
.line_content.parallel
=
"File was created"
-
else
-
elsif
old_line
.
type
==
:deleted
%td
.line_content.parallel
=
line
%td
.old_line.old
=
old_line
.
num
%td
.new_line
{
data:
{
linenumber:
line_new
}}
%td
.line_content
{
class:
"parallel noteable_line old #{old_line.code}"
,
"line_code"
=>
old_line
.
code
}=
old_line
.
content
=
link_to
raw
(
type
==
"old"
?
" "
:
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
-
else
old_line
.
type
==
:no_change
-
if
type
==
'new'
%td
.old_line
=
old_line
.
num
%td
.line_content.parallel
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
line
%td
.line_content.parallel
=
old_line
.
content
-
else
%td
.line_content.parallel
=
line
-# For new line
-
if
new_line
.
type
==
:file_deleted
%td
.new_line
=
new_line
.
num
%td
.line_content.parallel
=
"File was deleted"
-
elsif
new_line
.
type
==
:added
%td
.new_line.new
=
new_line
.
num
%td
.line_content
{
class:
"parallel noteable_line new #{new_line.code}"
,
"line_code"
=>
new_line
.
code
}=
new_line
.
content
-
else
new_line
.
type
==
:no_change
%td
.new_line
=
new_line
.
num
%td
.line_content.parallel
=
new_line
.
content
-
if
@reply_allowed
-
comments1
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
old_line
.
code
}.
sort_by
(
&
:created_at
)
-
comments2
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
new_line
.
code
}.
sort_by
(
&
:created_at
)
-
unless
comments1
.
empty?
and
comments2
.
empty?
=
render
"projects/notes/diff_notes_with_reply_parallel"
,
notes1:
comments1
,
notes2:
comments2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment