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
Tatuya Kamada
gitlab-ce
Commits
8a8d4c9b
Commit
8a8d4c9b
authored
Apr 11, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Diff viewer links to correct part of the file
Added highlight colours to diff rows Closes #13852
parent
c71cdb19
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
8 deletions
+58
-8
app/assets/javascripts/merge_request_tabs.js.coffee
app/assets/javascripts/merge_request_tabs.js.coffee
+24
-4
app/assets/stylesheets/highlight/dark.scss
app/assets/stylesheets/highlight/dark.scss
+6
-0
app/assets/stylesheets/highlight/monokai.scss
app/assets/stylesheets/highlight/monokai.scss
+6
-0
app/assets/stylesheets/highlight/solarized_dark.scss
app/assets/stylesheets/highlight/solarized_dark.scss
+6
-0
app/assets/stylesheets/highlight/solarized_light.scss
app/assets/stylesheets/highlight/solarized_light.scss
+6
-0
app/assets/stylesheets/highlight/white.scss
app/assets/stylesheets/highlight/white.scss
+6
-0
app/views/projects/diffs/_parallel_view.html.haml
app/views/projects/diffs/_parallel_view.html.haml
+4
-4
No files found.
app/assets/javascripts/merge_request_tabs.js.coffee
View file @
8a8d4c9b
...
@@ -85,8 +85,11 @@ class @MergeRequestTabs
...
@@ -85,8 +85,11 @@ class @MergeRequestTabs
scrollToElement
:
(
container
)
->
scrollToElement
:
(
container
)
->
if
window
.
location
.
hash
if
window
.
location
.
hash
$el
=
$
(
"div
#{
container
}
#{
window
.
location
.
hash
}
"
)
navBarHeight
=
$
(
'.navbar-gitlab'
).
outerHeight
()
$
(
'body'
).
scrollTo
(
$el
.
offset
().
top
)
if
$el
.
length
$el
=
$
(
"
#{
container
}
#{
window
.
location
.
hash
}
"
)
$
(
'body'
).
scrollTo
0
$
.
scrollTo
(
"
#{
container
}
#{
window
.
location
.
hash
}
"
,
offset
:
-
navBarHeight
)
if
$el
.
length
# Activate a tab based on the current action
# Activate a tab based on the current action
activateTab
:
(
action
)
->
activateTab
:
(
action
)
->
...
@@ -152,12 +155,29 @@ class @MergeRequestTabs
...
@@ -152,12 +155,29 @@ class @MergeRequestTabs
@
_get
@
_get
url
:
"
#{
source
}
.json"
+
@
_location
.
search
url
:
"
#{
source
}
.json"
+
@
_location
.
search
success
:
(
data
)
=>
success
:
(
data
)
=>
document
.
querySelector
(
"div#diffs"
).
innerHTML
=
data
.
html
$
(
'#diffs'
).
html
data
.
html
gl
.
utils
.
localTimeAgo
(
$
(
'.js-timeago'
,
'div#diffs'
))
gl
.
utils
.
localTimeAgo
(
$
(
'.js-timeago'
,
'div#diffs'
))
$
(
'
div
#diffs .js-syntax-highlight'
).
syntaxHighlight
()
$
(
'#diffs .js-syntax-highlight'
).
syntaxHighlight
()
@
expandViewContainer
()
if
@
diffViewType
()
is
'parallel'
@
expandViewContainer
()
if
@
diffViewType
()
is
'parallel'
@
diffsLoaded
=
true
@
diffsLoaded
=
true
@
scrollToElement
(
"#diffs"
)
@
scrollToElement
(
"#diffs"
)
@
highlighSelectedLine
()
highlighSelectedLine
:
->
locationHash
=
location
.
hash
if
locationHash
isnt
''
hashClassString
=
".
#{
locationHash
.
replace
(
'#'
,
''
)
}
"
$diffLine
=
$
(
locationHash
)
if
$diffLine
.
is
':not(tr)'
$diffLine
=
$
(
"td
#{
locationHash
}
, td
#{
hashClassString
}
"
)
else
$diffLine
=
$
(
'td'
,
$diffLine
)
$diffLine
.
addClass
'hll'
diffLineTop
=
$diffLine
.
offset
().
top
navBarHeight
=
$
(
'.navbar-gitlab'
).
outerHeight
()
loadBuilds
:
(
source
)
->
loadBuilds
:
(
source
)
->
return
if
@
buildsLoaded
return
if
@
buildsLoaded
...
...
app/assets/stylesheets/highlight/dark.scss
View file @
8a8d4c9b
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
// Diff line
// Diff line
.line_holder
{
.line_holder
{
td
.diff-line-num.hll
:not
(
.empty-cell
),
td
.line_content.hll
:not
(
.empty-cell
)
{
background-color
:
#557
;
border-color
:
darken
(
#557
,
15%
);
}
.diff-line-num.new
,
.line_content.new
{
.diff-line-num.new
,
.line_content.new
{
@include
diff_background
(
rgba
(
51
,
255
,
51
,
0
.1
)
,
rgba
(
51
,
255
,
51
,
0
.2
)
,
#808080
);
@include
diff_background
(
rgba
(
51
,
255
,
51
,
0
.1
)
,
rgba
(
51
,
255
,
51
,
0
.2
)
,
#808080
);
}
}
...
...
app/assets/stylesheets/highlight/monokai.scss
View file @
8a8d4c9b
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
// Diff line
// Diff line
.line_holder
{
.line_holder
{
td
.diff-line-num.hll
:not
(
.empty-cell
),
td
.line_content.hll
:not
(
.empty-cell
)
{
background-color
:
#49483e
;
border-color
:
darken
(
#49483e
,
15%
);
}
.diff-line-num.new
,
.line_content.new
{
.diff-line-num.new
,
.line_content.new
{
@include
diff_background
(
rgba
(
166
,
226
,
46
,
0
.1
)
,
rgba
(
166
,
226
,
46
,
0
.15
)
,
#808080
);
@include
diff_background
(
rgba
(
166
,
226
,
46
,
0
.1
)
,
rgba
(
166
,
226
,
46
,
0
.15
)
,
#808080
);
}
}
...
...
app/assets/stylesheets/highlight/solarized_dark.scss
View file @
8a8d4c9b
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
// Diff line
// Diff line
.line_holder
{
.line_holder
{
td
.diff-line-num.hll
:not
(
.empty-cell
),
td
.line_content.hll
:not
(
.empty-cell
)
{
background-color
:
#174652
;
border-color
:
darken
(
#174652
,
15%
);
}
.diff-line-num.new
,
.line_content.new
{
.diff-line-num.new
,
.line_content.new
{
@include
diff_background
(
rgba
(
133
,
153
,
0
,
0
.15
)
,
rgba
(
133
,
153
,
0
,
0
.25
)
,
#113b46
);
@include
diff_background
(
rgba
(
133
,
153
,
0
,
0
.15
)
,
rgba
(
133
,
153
,
0
,
0
.25
)
,
#113b46
);
}
}
...
...
app/assets/stylesheets/highlight/solarized_light.scss
View file @
8a8d4c9b
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
// Diff line
// Diff line
.line_holder
{
.line_holder
{
td
.diff-line-num.hll
:not
(
.empty-cell
),
td
.line_content.hll
:not
(
.empty-cell
)
{
background-color
:
#ddd8c5
;
border-color
:
darken
(
#ddd8c5
,
15%
);
}
.diff-line-num.new
,
.line_content.new
{
.diff-line-num.new
,
.line_content.new
{
@include
diff_background
(
rgba
(
133
,
153
,
0
,
0
.2
)
,
rgba
(
133
,
153
,
0
,
0
.25
)
,
#c5d0d4
);
@include
diff_background
(
rgba
(
133
,
153
,
0
,
0
.2
)
,
rgba
(
133
,
153
,
0
,
0
.25
)
,
#c5d0d4
);
}
}
...
...
app/assets/stylesheets/highlight/white.scss
View file @
8a8d4c9b
...
@@ -21,6 +21,12 @@
...
@@ -21,6 +21,12 @@
// Diff line
// Diff line
.line_holder
{
.line_holder
{
td
.diff-line-num.hll
:not
(
.empty-cell
),
td
.line_content.hll
:not
(
.empty-cell
)
{
background-color
:
#f8eec7
;
border-color
:
darken
(
#f8eec7
,
15%
);
}
.diff-line-num
{
.diff-line-num
{
&
.old
{
&
.old
{
background-color
:
$line-number-old
;
background-color
:
$line-number-old
;
...
...
app/views/projects/diffs/_parallel_view.html.haml
View file @
8a8d4c9b
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
%td
.new_line.diff-line-num
%td
.new_line.diff-line-num
%td
.line_content.parallel.match
=
left
[
:text
]
%td
.line_content.parallel.match
=
left
[
:text
]
-
else
-
else
%td
.old_line.diff-line-num
{
id:
left
[
:line_code
],
class:
"#{left[:type]}"
}
%td
.old_line.diff-line-num
{
id:
left
[
:line_code
],
class:
"#{left[:type]}
#{'empty-cell' if !left[:number]}
"
}
=
link_to
raw
(
left
[
:number
]),
"#
#{
left
[
:line_code
]
}
"
,
id:
left
[
:line_code
]
=
link_to
raw
(
left
[
:number
]),
"#
#{
left
[
:line_code
]
}
"
,
id:
left
[
:line_code
]
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
left
[
:line_code
],
'old'
)
=
link_to_new_diff_note
(
left
[
:line_code
],
'old'
)
%td
.line_content
{
class:
"parallel noteable_line #{left[:type]} #{left[:line_code]}"
,
data:
{
line_code:
left
[
:line_code
]
}}=
diff_line_content
(
left
[
:text
])
%td
.line_content
{
class:
"parallel noteable_line #{left[:type]} #{left[:line_code]}
#{'empty-cell' if left[:text].empty?}
"
,
data:
{
line_code:
left
[
:line_code
]
}}=
diff_line_content
(
left
[
:text
])
-
if
right
[
:type
]
==
'new'
-
if
right
[
:type
]
==
'new'
-
new_line_class
=
'new'
-
new_line_class
=
'new'
...
@@ -27,11 +27,11 @@
...
@@ -27,11 +27,11 @@
-
new_line_class
=
nil
-
new_line_class
=
nil
-
new_line_code
=
left
[
:line_code
]
-
new_line_code
=
left
[
:line_code
]
%td
.new_line.diff-line-num
{
id:
new_line_code
,
class:
"#{new_line_class}"
,
data:
{
linenumber:
right
[
:number
]
}}
%td
.new_line.diff-line-num
{
id:
new_line_code
,
class:
"#{new_line_class}
#{'empty-cell' if !right[:number]}
"
,
data:
{
linenumber:
right
[
:number
]
}}
=
link_to
raw
(
right
[
:number
]),
"#
#{
new_line_code
}
"
,
id:
new_line_code
=
link_to
raw
(
right
[
:number
]),
"#
#{
new_line_code
}
"
,
id:
new_line_code
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
-
if
@comments_allowed
&&
can?
(
current_user
,
:create_note
,
@project
)
=
link_to_new_diff_note
(
right
[
:line_code
],
'new'
)
=
link_to_new_diff_note
(
right
[
:line_code
],
'new'
)
%td
.line_content.parallel
{
class:
"noteable_line #{new_line_class} #{new_line_code}"
,
data:
{
line_code:
new_line_code
}}=
diff_line_content
(
right
[
:text
])
%td
.line_content.parallel
{
class:
"noteable_line #{new_line_class} #{new_line_code}
#{'empty-cell' if right[:text].empty?}
"
,
data:
{
line_code:
new_line_code
}}=
diff_line_content
(
right
[
:text
])
-
if
@reply_allowed
-
if
@reply_allowed
-
comments_left
,
comments_right
=
organize_comments
(
left
[
:type
],
right
[
:type
],
left
[
:line_code
],
right
[
:line_code
])
-
comments_left
,
comments_right
=
organize_comments
(
left
[
:type
],
right
[
:type
],
left
[
:line_code
],
right
[
:line_code
])
...
...
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