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
Léo-Paul Géneau
gitlab-ce
Commits
9945e8c4
Commit
9945e8c4
authored
Sep 12, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move organizing of comments to helper.
parent
e84861d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+14
-0
app/views/projects/diffs/_parallel_view.html.haml
app/views/projects/diffs/_parallel_view.html.haml
+8
-14
No files found.
app/helpers/diff_helper.rb
View file @
9945e8c4
...
...
@@ -103,4 +103,18 @@ module DiffHelper
def
line_comments
@line_comments
||=
@line_notes
.
group_by
(
&
:line_code
)
end
def
organize_comments
(
type_left
,
type_right
,
line_code_left
,
line_code_right
)
comments_left
=
comments_right
=
nil
unless
type_left
.
nil?
&&
type_right
==
'new'
comments_left
=
line_comments
[
line_code_left
]
end
unless
type_left
.
nil?
&&
type_right
.
nil?
comments_right
=
line_comments
[
line_code_right
]
end
[
comments_left
,
comments_right
]
end
end
app/views/projects/diffs/_parallel_view.html.haml
View file @
9945e8c4
...
...
@@ -5,7 +5,7 @@
-
type_left
=
line
[
0
]
-
line_number_left
=
line
[
1
]
-
line_content_left
=
line
[
2
]
-
line_code
=
line
[
3
]
-
line_code
_left
=
line
[
3
]
-
type_right
=
line
[
4
]
-
line_number_right
=
line
[
5
]
-
line_content_right
=
line
[
6
]
...
...
@@ -16,31 +16,25 @@
=
render
"projects/diffs/match_line_parallel"
,
{
line:
line_content_left
,
line_old:
line_number_left
,
line_new:
line_number_right
}
-
elsif
type_left
==
'old'
||
type_left
.
nil?
%td
.old_line
{
id:
line_code
,
class:
"#{type_left}"
}
=
link_to
raw
(
line_number_left
),
"#
#{
line_code
}
"
,
id:
line_code
%td
.line_content
{
class:
"parallel noteable_line #{type_left} #{line_code
}"
,
"line_code"
=>
line_code
}=
raw
line_content_left
%td
.old_line
{
id:
line_code
_left
,
class:
"#{type_left}"
}
=
link_to
raw
(
line_number_left
),
"#
#{
line_code
_left
}
"
,
id:
line_code_left
%td
.line_content
{
class:
"parallel noteable_line #{type_left} #{line_code
_left}"
,
"line_code"
=>
line_code_left
}=
raw
line_content_left
-
if
type_right
==
'new'
-
new_line_class
=
'new'
-
new_line_code
=
line_code_right
-
else
-
new_line_class
=
nil
-
new_line_code
=
line_code
-
new_line_code
=
line_code
_left
%td
.new_line
{
id:
new_line_code
,
class:
"#{new_line_class}"
,
data:
{
linenumber:
line_number_right
}}
=
link_to
raw
(
line_number_right
),
"#
#{
new_line_code
}
"
,
id:
new_line_code
%td
.line_content.parallel
{
class:
"noteable_line #{new_line_class} #{new_line_code}"
,
"line_code"
=>
new_line_code
}=
raw
line_content_right
-
if
@reply_allowed
-
if
type_left
.
nil?
&&
type_right
==
'new'
-
comments1
=
nil
-
else
-
comments1
=
line_comments
[
line_code
]
-
unless
type_left
.
nil?
&&
type_right
.
nil?
-
comments2
=
line_comments
[
line_code_right
]
-
if
comments1
.
present?
||
comments2
.
present?
=
render
"projects/notes/diff_notes_with_reply_parallel"
,
notes1:
comments1
,
notes2:
comments2
-
comments_left
,
comments_right
=
organize_comments
(
type_left
,
type_right
,
line_code_left
,
line_code_right
)
-
if
comments_left
.
present?
||
comments_right
.
present?
=
render
"projects/notes/diff_notes_with_reply_parallel"
,
notes1:
comments_left
,
notes2:
comments_right
-
if
diff_file
.
diff
.
diff
.
blank?
&&
diff_file
.
mode_changed?
.file-mode-changed
...
...
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