summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/merge_requests/item.vue
blob: b50fc8a3dbb30e7fd0ef2465708d4937466f88d6 (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
<script>
import Icon from '../../../vue_shared/components/icon.vue';

export default {
  components: {
    Icon,
  },
  props: {
    item: {
      type: Object,
      required: true,
    },
    currentId: {
      type: String,
      required: true,
    },
    currentProjectId: {
      type: String,
      required: true,
    },
  },
  computed: {
    isActive() {
      return (
        this.item.iid === parseInt(this.currentId, 10) &&
        this.currentProjectId === this.item.projectPathWithNamespace
      );
    },
    pathWithID() {
      return `${this.item.projectPathWithNamespace}!${this.item.iid}`;
    },
  },
  methods: {
    clickItem() {
      this.$emit('click', this.item);
    },
  },
};
</script>

<template>
  <button
    type="button"
    class="btn-link d-flex align-items-center"
    @click="clickItem"
  >
    <span class="d-flex append-right-default ide-merge-request-current-icon">
      <icon
        v-if="isActive"
        name="mobile-issue-close"
        :size="18"
      />
    </span>
    <span>
      <strong>
        {{ item.title }}
      </strong>
      <span class="ide-merge-request-project-path d-block mt-1">
        {{ pathWithID }}
      </span>
    </span>
  </button>
</template>