diff options
author | Sam Rose <sam@gitlab.com> | 2017-03-02 08:43:52 -0500 |
---|---|---|
committer | Sam Rose <sam@gitlab.com> | 2017-03-02 10:48:14 -0500 |
commit | 5f57234c586e33ba12830582c953bad58bddbf8e (patch) | |
tree | d47fc199138283e7c877bac1e36ab5d24bfb98a8 /app | |
parent | e9d75a4b856513ce848c0a704cced54cff9f48f8 (diff) | |
download | gitlab-ce-5f57234c586e33ba12830582c953bad58bddbf8e.tar.gz |
Hightlight linenumber on page load28893-highlighted-diff-doesn-t-stay-highlighted-on-refresh
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/diff.js.es6 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/diff.js.es6 b/app/assets/javascripts/diff.js.es6 index ccccd0a36ff..6829e8aeaea 100644 --- a/app/assets/javascripts/diff.js.es6 +++ b/app/assets/javascripts/diff.js.es6 @@ -25,6 +25,10 @@ require('./lib/utils/url_utility'); isBound = true; } + if (gl.utils.getLocationHash()) { + this.highlightSelectedLine(); + } + this.openAnchoredDiff(); } @@ -78,7 +82,7 @@ require('./lib/utils/url_utility'); if (nothingHereBlock.length) { const clickTarget = $('.js-file-title, .click-to-expand', diffFile); diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => { - this.highlighSelectedLine(); + this.highlightSelectedLine(); if (cb) cb(); }); } else if (cb) { @@ -94,7 +98,7 @@ require('./lib/utils/url_utility'); } else { window.location.hash = hash; } - this.highlighSelectedLine(); + this.highlightSelectedLine(); } diffViewType() { @@ -108,7 +112,7 @@ require('./lib/utils/url_utility'); return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10)); } - highlighSelectedLine() { + highlightSelectedLine() { const hash = gl.utils.getLocationHash(); const $diffFiles = $('.diff-file'); $diffFiles.find('.hll').removeClass('hll'); |