summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/components/table/parent_row.vue
blob: b4433f00d8a2b095171d41a78a7e759a8c7577ce (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
<script>
export default {
  props: {
    commitRef: {
      type: String,
      required: true,
    },
    path: {
      type: String,
      required: true,
    },
  },
  computed: {
    parentRoute() {
      const splitArray = this.path.split('/');
      splitArray.pop();

      return { path: `/tree/${this.commitRef}/${splitArray.join('/')}` };
    },
  },
  methods: {
    clickRow() {
      this.$router.push(this.parentRoute);
    },
  },
};
</script>

<template>
  <tr v-once @click="clickRow">
    <td colspan="3" class="tree-item-file-name">
      <router-link :to="parentRoute" :aria-label="__('Go to parent')">
        ..
      </router-link>
    </td>
  </tr>
</template>