BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
35 deletions
+15
-35
_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
-
old_lines
,
new_lines
=
parallel_diff_lines
(
project
,
@commit
,
diff
,
file
)
-
num_lines
=
old_lines
.
length
%div
.text-file
%table
-
num_lines
.
times
do
|
index
|
-
new_line
=
new_lines
[
index
]
-
old_line
=
old_lines
[
index
]
%tr
.line_holder.parallel
-# For old line
-
if
old_line
.
type
==
:file_created
%td
.old_line
=
old_line
.
num
%td
.line_content.parallel
=
"File was created"
-
elsif
old_line
.
type
==
:deleted
%td
.old_line.old
=
old_line
.
num
%td
.line_content
{
class:
"parallel noteable_line old #{old_line.code}"
,
"line_code"
=>
old_line
.
code
}=
old_line
.
content
-
else
old_line
.
type
==
:no_change
%td
.old_line
=
old_line
.
num
%td
.line_content.parallel
=
old_line
.
content
-# 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
-
each_diff_line
(
diff
,
index
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
e
|
%tr
.line_holder.parallel
{
id:
line_code
,
class:
"#{type}"
}
-
if
type
!=
'match'
%td
.old_line
=
link_to
raw
(
type
==
"new"
?
" "
:
line_old
),
"#
#{
line_code
}
"
,
id:
line_code
-
if
type
==
'old'
%td
.line_content
{
class:
"parallel noteable_line old #{line_code}"
,
"line_code"
=>
line_code
}=
line
-
else
%td
.line_content.parallel
=
line
%td
.new_line
{
data:
{
linenumber:
line_new
}}
=
link_to
raw
(
type
==
"old"
?
" "
:
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
-
if
type
==
'new'
%td
.line_content.parallel
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
line
-
else
%td
.line_content.parallel
=
line
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