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
5f57234c
Commit
5f57234c
authored
Mar 02, 2017
by
Sam Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hightlight linenumber on page load
parent
e9d75a4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
app/assets/javascripts/diff.js.es6
app/assets/javascripts/diff.js.es6
+7
-3
changelogs/unreleased/28893-highlighted-diff-doesn-t-stay-highlighted-on-refresh.yml
...-highlighted-diff-doesn-t-stay-highlighted-on-refresh.yml
+4
-0
No files found.
app/assets/javascripts/diff.js.es6
View file @
5f57234c
...
@@ -25,6 +25,10 @@ require('./lib/utils/url_utility');
...
@@ -25,6 +25,10 @@ require('./lib/utils/url_utility');
isBound = true;
isBound = true;
}
}
if (gl.utils.getLocationHash()) {
this.highlightSelectedLine();
}
this.openAnchoredDiff();
this.openAnchoredDiff();
}
}
...
@@ -78,7 +82,7 @@ require('./lib/utils/url_utility');
...
@@ -78,7 +82,7 @@ require('./lib/utils/url_utility');
if (nothingHereBlock.length) {
if (nothingHereBlock.length) {
const clickTarget = $('.js-file-title, .click-to-expand', diffFile);
const clickTarget = $('.js-file-title, .click-to-expand', diffFile);
diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => {
diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => {
this.highlighSelectedLine();
this.highligh
t
SelectedLine();
if (cb) cb();
if (cb) cb();
});
});
} else if (cb) {
} else if (cb) {
...
@@ -94,7 +98,7 @@ require('./lib/utils/url_utility');
...
@@ -94,7 +98,7 @@ require('./lib/utils/url_utility');
} else {
} else {
window.location.hash = hash;
window.location.hash = hash;
}
}
this.highlighSelectedLine();
this.highligh
t
SelectedLine();
}
}
diffViewType() {
diffViewType() {
...
@@ -108,7 +112,7 @@ require('./lib/utils/url_utility');
...
@@ -108,7 +112,7 @@ require('./lib/utils/url_utility');
return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10));
return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10));
}
}
highlighSelectedLine() {
highligh
t
SelectedLine() {
const hash = gl.utils.getLocationHash();
const hash = gl.utils.getLocationHash();
const $diffFiles = $('.diff-file');
const $diffFiles = $('.diff-file');
$diffFiles.find('.hll').removeClass('hll');
$diffFiles.find('.hll').removeClass('hll');
...
...
changelogs/unreleased/28893-highlighted-diff-doesn-t-stay-highlighted-on-refresh.yml
0 → 100644
View file @
5f57234c
---
title
:
Highlight line number if specified on diff pages when page loads
merge_request
:
9664
author
:
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