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

62 lines
1.2 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
/>
2018-03-17 18:26:18 +05:30
<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"
>
</i>
{{ moreChildrenStats }}
</a>
</li>
2017-09-10 17:25:29 +05:30
</ul>
</template>