summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/repo_file_buttons.vue
blob: 4ea8cf7504bba338354a1ddcfa2c08c3bcbab87e (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
<script>
export default {
  props: {
    file: {
      type: Object,
      required: true,
    },
  },
  computed: {
    showButtons() {
      return this.file.rawPath ||
        this.file.blamePath ||
        this.file.commitsPath ||
        this.file.permalink;
    },
    rawDownloadButtonLabel() {
      return this.file.binary ? 'Download' : 'Raw';
    },
  },
};
</script>

<template>
  <div
    v-if="showButtons"
    class="multi-file-editor-btn-group"
  >
    <a
      :href="file.rawPath"
      target="_blank"
      class="btn btn-default btn-sm raw"
      rel="noopener noreferrer">
      {{ rawDownloadButtonLabel }}
    </a>

    <div
      class="btn-group"
      role="group"
      aria-label="File actions"
    >
      <a
        :href="file.blamePath"
        class="btn btn-default btn-sm blame"
      >
        Blame
      </a>
      <a
        :href="file.commitsPath"
        class="btn btn-default btn-sm history"
      >
        History
      </a>
      <a
        :href="file.permalink"
        class="btn btn-default btn-sm permalink"
      >
        Permalink
      </a>
    </div>
  </div>
</template>