summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diff.js
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-09-28 16:55:25 +0200
committerDouwe Maan <douwe@selenight.nl>2017-10-02 18:39:25 +0200
commitb74c643c66fd15c95ad148231ebcf4f85283ca16 (patch)
tree889376c02f90b53b2bfe581dbef3896a3b6e4261 /app/assets/javascripts/diff.js
parente0e49f2f7120fee6ee34236ed6463e4c130f2ad1 (diff)
downloadgitlab-ce-b74c643c66fd15c95ad148231ebcf4f85283ca16.tar.gz
Only copy old/new code when selecting left/right side of parallel diffdm-copy-parallel-diff
Diffstat (limited to 'app/assets/javascripts/diff.js')
-rw-r--r--app/assets/javascripts/diff.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/diff.js b/app/assets/javascripts/diff.js
index 6a008112203..ae8338f5fd2 100644
--- a/app/assets/javascripts/diff.js
+++ b/app/assets/javascripts/diff.js
@@ -24,7 +24,8 @@ class Diff {
if (!isBound) {
$(document)
.on('click', '.js-unfold', this.handleClickUnfold.bind(this))
- .on('click', '.diff-line-num a', this.handleClickLineNum.bind(this));
+ .on('click', '.diff-line-num a', this.handleClickLineNum.bind(this))
+ .on('mousedown', 'td.line_content.parallel', this.handleParallelLineDown.bind(this));
isBound = true;
}
@@ -100,6 +101,18 @@ class Diff {
this.highlightSelectedLine();
}
+ handleParallelLineDown(e) {
+ const line = $(e.currentTarget);
+ const table = line.closest('table');
+
+ table.removeClass('left-side-selected right-side-selected');
+
+ const lineClass = ['left-side', 'right-side'].filter(name => line.hasClass(name))[0];
+ if (lineClass) {
+ table.addClass(`${lineClass}-selected`);
+ }
+ }
+
diffViewType() {
return $('.inline-parallel-buttons a.active').data('view-type');
}