gitlab-org--gitlab-foss/app/assets/javascripts/groups/components/group_folder.vue

57 lines
1.2 KiB
Vue
Raw Normal View History

2017-05-09 19:10:19 -04:00
<script>
import { GlIcon } from '@gitlab/ui';
import { n__ } from '../../locale';
import { MAX_CHILDREN_COUNT } from '../constants';
2017-05-09 19:10:19 -04:00
export default {
components: {
GlIcon,
},
2017-05-09 19:10:19 -04:00
props: {
parentGroup: {
type: Object,
required: false,
2017-06-07 04:45:48 -04:00
default: () => ({}),
},
groups: {
type: Array,
required: true,
},
action: {
type: String,
required: false,
default: '',
},
},
computed: {
hasMoreChildren() {
return this.parentGroup.childrenCount > MAX_CHILDREN_COUNT;
},
moreChildrenStats() {
return n__(
'One more item',
'%d more items',
2018-01-06 13:59:49 -05:00
this.parentGroup.childrenCount - this.parentGroup.children.length,
);
},
2017-05-09 19:10:19 -04:00
},
};
</script>
<template>
<ul class="groups-list group-list-tree">
2017-06-07 04:45:48 -04:00
<group-item
v-for="(group, index) in groups"
:key="index"
:group="group"
:parent-group="parentGroup"
:action="action"
2017-06-07 04:45:48 -04:00
/>
2018-11-16 15:07:38 -05:00
<li v-if="hasMoreChildren" class="group-row">
<a :href="parentGroup.relativePath" class="group-row-contents has-more-items py-2">
<gl-icon name="external-link" /> {{ moreChildrenStats }}
</a>
</li>
2017-05-09 19:10:19 -04:00
</ul>
</template>