summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/components/group_folder.vue
blob: e60221fa08dfa910e1bb5c1f7cf293bdbad53ccb (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
<script>
import { n__ } from '../../locale';
import { MAX_CHILDREN_COUNT } from '../constants';

export default {
  props: {
    parentGroup: {
      type: Object,
      required: false,
      default: () => ({}),
    },
    groups: {
      type: Array,
      required: false,
      default: () => ([]),
    },
  },
  computed: {
    hasMoreChildren() {
      return this.parentGroup.childrenCount > MAX_CHILDREN_COUNT;
    },
    moreChildrenStats() {
      return n__('One more item', '%d more items', this.parentGroup.childrenCount - this.parentGroup.children.length);
    },
  },
};
</script>

<template>
  <ul class="content-list group-list-tree">
    <group-item
      v-for="(group, index) in groups"
      :key="index"
      :group="group"
      :parent-group="parentGroup"
    />
    <li
      v-if="hasMoreChildren"
      class="group-row">
      <a
        :href="parentGroup.relativePath"
        class="group-row-contents has-more-items">
        <i
          class="fa fa-external-link"
          aria-hidden="true"
        />
        {{moreChildrenStats}}
      </a>
    </li>
  </ul>
</template>