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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
82d0221b
Commit
82d0221b
authored
Apr 13, 2016
by
Annabel Dunstone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add line type conditional to diff line helper
parent
d176f873
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
app/assets/stylesheets/pages/diff.scss
app/assets/stylesheets/pages/diff.scss
+11
-7
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+4
-2
app/views/projects/diffs/_line.html.haml
app/views/projects/diffs/_line.html.haml
+1
-1
app/views/projects/notes/discussions/_diff.html.haml
app/views/projects/notes/discussions/_diff.html.haml
+1
-1
No files found.
app/assets/stylesheets/pages/diff.scss
View file @
82d0221b
...
@@ -67,15 +67,19 @@
...
@@ -67,15 +67,19 @@
line-height
:
$code_line_height
;
line-height
:
$code_line_height
;
font-size
:
$code_font_size
;
font-size
:
$code_font_size
;
&
.noteable_line.old
:before
{
&
.noteable_line.old
{
&
:before
{
content
:
'-'
;
content
:
'-'
;
position
:
absolute
;
position
:
absolute
;
}
}
}
&
.noteable_line.new
:before
{
&
.noteable_line.new
{
&
:before
{
content
:
'+'
;
content
:
'+'
;
position
:
absolute
;
position
:
absolute
;
}
}
}
span
{
span
{
white-space
:
pre
;
white-space
:
pre
;
...
...
app/helpers/diff_helper.rb
View file @
82d0221b
...
@@ -40,11 +40,13 @@ module DiffHelper
...
@@ -40,11 +40,13 @@ module DiffHelper
(
unfold
)
?
'unfold js-unfold'
:
''
(
unfold
)
?
'unfold js-unfold'
:
''
end
end
def
diff_line_content
(
line
)
def
diff_line_content
(
line
,
line_type
=
nil
)
if
line
.
blank?
if
line
.
blank?
" "
.
html_safe
" "
.
html_safe
else
else
line
[
0
]
=
''
if
line_type
==
'new'
||
line_type
==
'old'
line
[
0
]
=
" "
end
line
line
end
end
end
end
...
...
app/views/projects/diffs/_line.html.haml
View file @
82d0221b
...
@@ -23,4 +23,4 @@
...
@@ -23,4 +23,4 @@
=
link_text
=
link_text
-
else
-
else
=
link_to
""
,
"#
#{
line_code
}
"
,
id:
line_code
,
data:
{
linenumber:
link_text
}
=
link_to
""
,
"#
#{
line_code
}
"
,
id:
line_code
,
data:
{
linenumber:
link_text
}
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
data:
{
line_code:
line_code
}}=
diff_line_content
(
line
.
text
)
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
data:
{
line_code:
line_code
}}=
diff_line_content
(
line
.
text
,
type
)
app/views/projects/notes/discussions/_diff.html.haml
View file @
82d0221b
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
-
else
-
else
%td
.old_line.diff-line-num
{
data:
{
linenumber:
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)}}
%td
.old_line.diff-line-num
{
data:
{
linenumber:
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)}}
%td
.new_line.diff-line-num
{
data:
{
linenumber:
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)}}
%td
.new_line.diff-line-num
{
data:
{
linenumber:
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)}}
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
line_code:
line_code
}=
diff_line_content
(
line
.
text
)
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
line_code:
line_code
}=
diff_line_content
(
line
.
text
,
type
)
-
if
line_code
==
note
.
line_code
-
if
line_code
==
note
.
line_code
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
discussion_notes
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
discussion_notes
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