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
80d8f8b8
Commit
80d8f8b8
authored
Apr 14, 2016
by
Annabel Dunstone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax & style updates
parent
2f81baf4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
29 deletions
+31
-29
app/assets/stylesheets/pages/diff.scss
app/assets/stylesheets/pages/diff.scss
+13
-9
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+1
-3
app/views/projects/blob/diff.html.haml
app/views/projects/blob/diff.html.haml
+6
-6
app/views/projects/diffs/_line.html.haml
app/views/projects/diffs/_line.html.haml
+8
-8
app/views/projects/notes/discussions/_diff.html.haml
app/views/projects/notes/discussions/_diff.html.haml
+3
-3
No files found.
app/assets/stylesheets/pages/diff.scss
View file @
80d8f8b8
...
@@ -67,17 +67,21 @@
...
@@ -67,17 +67,21 @@
line-height
:
$code_line_height
;
line-height
:
$code_line_height
;
font-size
:
$code_font_size
;
font-size
:
$code_font_size
;
&
.noteable_line.old
{
&
.noteable_line
{
&
:before
{
position
:
relative
;
content
:
'-'
;
position
:
absolute
;
&
.old
{
&
:before
{
content
:
'-'
;
position
:
absolute
;
}
}
}
}
&
.noteable_line.new
{
&
.new
{
&
:before
{
&
:before
{
content
:
'+'
;
content
:
'+'
;
position
:
absolute
;
position
:
absolute
;
}
}
}
}
}
...
...
app/helpers/diff_helper.rb
View file @
80d8f8b8
...
@@ -44,9 +44,7 @@ module DiffHelper
...
@@ -44,9 +44,7 @@ module DiffHelper
if
line
.
blank?
if
line
.
blank?
" "
.
html_safe
" "
.
html_safe
else
else
if
line_type
==
'new'
||
line_type
==
'old'
line
[
0
]
=
' '
if
%w[new old]
.
include?
(
line_type
)
line
[
0
]
=
" "
end
line
line
end
end
end
end
...
...
app/views/projects/blob/diff.html.haml
View file @
80d8f8b8
-
if
@lines
.
present?
-
if
@lines
.
present?
-
if
@form
.
unfold?
&&
@form
.
since
!=
1
&&
!
@form
.
bottom?
-
if
@form
.
unfold?
&&
@form
.
since
!=
1
&&
!
@form
.
bottom?
%tr
.line_holder
{
id:
@form
.
since
}
%tr
.line_holder
{
id:
@form
.
since
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
since
,
line_new:
@form
.
since
,
bottom:
false
,
new_file:
false
}
line_old:
@form
.
since
,
line_new:
@form
.
since
,
bottom:
false
,
new_file:
false
}
-
@lines
.
each_with_index
do
|
line
,
index
|
-
@lines
.
each_with_index
do
|
line
,
index
|
-
line_new
=
index
+
@form
.
since
-
line_new
=
index
+
@form
.
since
-
line_old
=
line_new
-
@form
.
offset
-
line_old
=
line_new
-
@form
.
offset
%tr
.line_holder
%tr
.line_holder
%td
.old_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
%td
.old_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
=
link_to
raw
(
line_old
),
"#"
=
link_to
raw
(
line_old
),
"#"
%td
.new_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
%td
.new_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
=
link_to
raw
(
line_new
)
,
"#"
=
link_to
raw
(
line_new
)
,
"#"
%td
.line_content.noteable_line
==
#{
' '
*
@form
.
indent
}#{
line
}
%td
.line_content.noteable_line
==
#{
' '
*
@form
.
indent
}#{
line
}
-
if
@form
.
unfold?
&&
@form
.
bottom?
&&
@form
.
to
<
@blob
.
loc
-
if
@form
.
unfold?
&&
@form
.
bottom?
&&
@form
.
to
<
@blob
.
loc
%tr
.line_holder
{
id:
@form
.
to
}
%tr
.line_holder
{
id:
@form
.
to
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
to
,
line_new:
@form
.
to
,
bottom:
true
,
new_file:
false
}
line_old:
@form
.
to
,
line_new:
@form
.
to
,
bottom:
true
,
new_file:
false
}
app/views/projects/diffs/_line.html.haml
View file @
80d8f8b8
-
type
=
line
.
type
-
type
=
line
.
type
%tr
.line_holder
{
id:
line_code
,
class:
type
}
%tr
.line_holder
{
id:
line_code
,
class:
type
}
-
case
type
-
case
type
-
when
'match'
-
when
'match'
=
render
"projects/diffs/match_line"
,
{
line:
line
.
text
,
=
render
"projects/diffs/match_line"
,
{
line:
line
.
text
,
line_old:
line
.
old_pos
,
line_new:
line
.
new_pos
,
bottom:
false
,
new_file:
diff_file
.
new_file
}
line_old:
line
.
old_pos
,
line_new:
line
.
new_pos
,
bottom:
false
,
new_file:
diff_file
.
new_file
}
-
when
'nonewline'
-
when
'nonewline'
%td
.old_line.diff-line-num
%td
.old_line.diff-line-num
%td
.new_line.diff-line-num
%td
.new_line.diff-line-num
%td
.line_content.match
=
line
.
text
%td
.line_content.match
=
line
.
text
-
else
-
else
%td
.old_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
%td
.old_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
-
link_text
=
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)
-
link_text
=
type
==
"new"
?
" "
.
html_safe
:
line
.
old_pos
-
if
defined?
(
plain
)
&&
plain
-
if
defined?
(
plain
)
&&
plain
=
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
}
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
line_code
)
=
link_to_new_diff_note
(
line_code
)
%td
.new_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
%td
.new_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
-
link_text
=
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)
-
link_text
=
type
==
"old"
?
" "
.
html_safe
:
line
.
new_pos
-
if
defined?
(
plain
)
&&
plain
-
if
defined?
(
plain
)
&&
plain
=
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
,
type
)
%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 @
80d8f8b8
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
%td
.new_line.diff-line-num
=
"..."
%td
.new_line.diff-line-num
=
"..."
%td
.line_content.match
=
line
.
text
%td
.line_content.match
=
line
.
text
-
else
-
else
%td
.old_line.diff-line-num
{
data:
{
linenumber:
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)}
}
%td
.old_line.diff-line-num
{
data:
{
linenumber:
type
==
"new"
?
" "
.
html_safe
:
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:
type
==
"old"
?
" "
.
html_safe
:
line
.
new_pos
}
}
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
line_code:
line_code
}=
diff_line_content
(
line
.
text
,
type
)
%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