diff options
author | Fatih Acet <acetfatih@gmail.com> | 2018-06-22 01:40:12 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-06-22 01:40:12 +0300 |
commit | fe3e5e78b77fbb2b5eede3ea4154989c244e38b3 (patch) | |
tree | f4e22a440a62b4f29dfc823cd325b365cf93f51b | |
parent | 94ef69c4d0be1e0b7593f7cf7f81498d7ecfc4e6 (diff) | |
download | gitlab-ce-fe3e5e78b77fbb2b5eede3ea4154989c244e38b3.tar.gz |
Minor refactor for readability.
-rw-r--r-- | app/assets/javascripts/diffs/components/diff_table_row.vue | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_table_row.vue b/app/assets/javascripts/diffs/components/diff_table_row.vue index 07da1e1d360..f2d2a8dcd7a 100644 --- a/app/assets/javascripts/diffs/components/diff_table_row.vue +++ b/app/assets/javascripts/diffs/components/diff_table_row.vue @@ -56,6 +56,11 @@ export default { [PARALLEL_DIFF_VIEW_TYPE]: this.isParallelView, }; }, + inlineRowId() { + const { lineCode, oldLine, newLine } = this.line; + + return lineCode || `${this.diffFile.fileHash}_${oldLine}_${newLine}`; + }, }, methods: { handleMouse(e) { @@ -65,8 +70,8 @@ export default { this.isHover = isHover; } else { const hoveringCell = e.target.closest('td'); - const allCells = Array.from(e.currentTarget.children); - const hoverIndex = allCells.indexOf(hoveringCell); + const allCellsInHoveringRow = Array.from(e.currentTarget.children); + const hoverIndex = allCellsInHoveringRow.indexOf(hoveringCell); if (hoverIndex >= 2) { this.isRightHover = isHover; @@ -88,7 +93,7 @@ export default { <template> <tr v-if="isInlineView" - :id="line.lineCode || `${diffFile.fileHash}_${line.oldLine}_${line.newLine}`" + :id="inlineRowId" :class="classNameMap" class="line_holder" @mouseover="handleMouse" |