parent_row.vue 701 Bytes
Newer Older
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
<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>
30 31
  <tr class="tree-item">
    <td colspan="3" class="tree-item-file-name" @click.self="clickRow">
32 33 34 35 36 37
      <router-link :to="parentRoute" :aria-label="__('Go to parent')">
        ..
      </router-link>
    </td>
  </tr>
</template>