summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diff.js.es6
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2016-09-09 16:47:43 +0100
committerMike Greiling <mike@pixelcog.com>2016-12-02 17:38:58 -0600
commitc434568f3759dfcdb8f9c55a11aa037a760ec7d2 (patch)
treef2e4e05a26ccfd29e5bf8b102523985354f5eb06 /app/assets/javascripts/diff.js.es6
parentf6624b5ce433b7148287e898f164476608868433 (diff)
downloadgitlab-ce-c434568f3759dfcdb8f9c55a11aa037a760ec7d2.tar.gz
re-apply MR !6285 "Added forceLoad ability to singleFileDiffs, added callback to getContentHTML, added conditional force load if a collapsed diff line anchor is found"
Use url utility to retrieve hash
Diffstat (limited to 'app/assets/javascripts/diff.js.es6')
-rw-r--r--app/assets/javascripts/diff.js.es611
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/diff.js.es6 b/app/assets/javascripts/diff.js.es6
index eacf53d1e1b..239dd84d8a3 100644
--- a/app/assets/javascripts/diff.js.es6
+++ b/app/assets/javascripts/diff.js.es6
@@ -58,6 +58,17 @@
$.get(link, params, response => $target.parent().replaceWith(response));
}
+ openAnchoredDiff(anchoredDiff, cb) {
+ const diffTitle = $(`#file-path-${anchoredDiff}`);
+ const diffFile = diffTitle.closest('.diff-file');
+ const nothingHereBlock = $('.nothing-here-block:visible', diffFile);
+ if (nothingHereBlock.length) {
+ diffFile.singleFileDiff(true, cb);
+ } else {
+ cb();
+ }
+ }
+
handleClickLineNum(event) {
const hash = $(event.currentTarget).attr('href');
event.preventDefault();