debian-mirror-gitlab/app/assets/javascripts/groups/components/group_folder.vue

53 lines
1.1 KiB
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2018-03-17 18:26:18 +05:30
import { n__ } from '../../locale';
import { MAX_CHILDREN_COUNT } from '../constants';
2017-09-10 17:25:29 +05:30
export default {
props: {
2018-03-17 18:26:18 +05:30
parentGroup: {
2017-09-10 17:25:29 +05:30
type: Object,
required: false,
default: () => ({}),
},
2018-03-17 18:26:18 +05:30
groups: {
type: Array,
2018-11-20 20:47:30 +05:30
required: true,
},
action: {
type: String,
2018-03-17 18:26:18 +05:30
required: false,
2018-11-20 20:47:30 +05:30
default: '',
2018-03-17 18:26:18 +05:30
},
},
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,
);
},
2017-09-10 17:25:29 +05:30
},
};
</script>
<template>
<ul class="content-list group-list-tree">
<group-item
v-for="(group, index) in groups"
:key="index"
:group="group"
2018-03-17 18:26:18 +05:30
:parent-group="parentGroup"
2018-11-20 20:47:30 +05:30
:action="action"
2017-09-10 17:25:29 +05:30
/>
2019-02-15 15:39:39 +05:30
<li v-if="hasMoreChildren" class="group-row">
2020-03-13 15:44:24 +05:30
<a :href="parentGroup.relativePath" class="group-row-contents has-more-items py-2">
2019-02-15 15:39:39 +05:30
<i class="fa fa-external-link" aria-hidden="true"> </i> {{ moreChildrenStats }}
2018-03-17 18:26:18 +05:30
</a>
</li>
2017-09-10 17:25:29 +05:30
</ul>
</template>