summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/components/diff_viewer/viewers/download_diff_viewer.vue
blob: 50389b6ae638c8f8a12c8782436baaeed704e3df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<script>
import DownloadViewer from '../../content_viewer/viewers/download_viewer.vue';
import { diffModes } from '../constants';

export default {
  components: {
    DownloadViewer,
  },
  props: {
    diffMode: {
      type: String,
      required: true,
    },
    newPath: {
      type: String,
      required: true,
    },
    oldPath: {
      type: String,
      required: true,
    },
    projectPath: {
      type: String,
      required: false,
      default: '',
    },
  },
  diffModes,
};
</script>

<template>
  <div class="diff-file-container">
    <div class="diff-viewer">
      <div
        v-if="diffMode === $options.diffModes.replaced"
        class="two-up view row">
        <div class="col-sm-6 deleted">
          <download-viewer
            :path="oldPath"
            :project-path="projectPath"
          />
        </div>
        <div class="col-sm-6 added">
          <download-viewer
            :path="newPath"
            :project-path="projectPath"
          />
        </div>
      </div>
      <div
        v-else-if="diffMode === $options.diffModes.new"
        class="added">
        <download-viewer
          :path="newPath"
          :project-path="projectPath"
        />
      </div>
      <div
        v-else
        class="deleted">
        <download-viewer
          :path="oldPath"
          :project-path="projectPath"
        />
      </div>
    </div>
  </div>
</template>