2017-05-09 19:10:19 -04:00
|
|
|
<script>
|
2017-10-04 10:10:24 -04:00
|
|
|
import { n__ } from '../../locale';
|
|
|
|
import { MAX_CHILDREN_COUNT } from '../constants';
|
|
|
|
|
2017-05-09 19:10:19 -04:00
|
|
|
export default {
|
|
|
|
props: {
|
2017-10-04 10:10:24 -04:00
|
|
|
parentGroup: {
|
2017-05-24 22:04:31 -04:00
|
|
|
type: Object,
|
|
|
|
required: false,
|
2017-06-07 04:45:48 -04:00
|
|
|
default: () => ({}),
|
2017-05-24 22:04:31 -04:00
|
|
|
},
|
2017-10-04 10:10:24 -04:00
|
|
|
groups: {
|
|
|
|
type: Array,
|
2018-09-07 02:09:13 -04:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
action: {
|
|
|
|
type: String,
|
2017-10-04 10:10:24 -04:00
|
|
|
required: false,
|
2018-09-07 02:09:13 -04:00
|
|
|
default: '',
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasMoreChildren() {
|
|
|
|
return this.parentGroup.childrenCount > MAX_CHILDREN_COUNT;
|
|
|
|
},
|
|
|
|
moreChildrenStats() {
|
2018-01-03 18:14:55 -05:00
|
|
|
return n__(
|
|
|
|
'One more item',
|
|
|
|
'%d more items',
|
2018-01-06 13:59:49 -05:00
|
|
|
this.parentGroup.childrenCount - this.parentGroup.children.length,
|
2018-01-03 18:14:55 -05:00
|
|
|
);
|
2017-10-04 10:10:24 -04:00
|
|
|
},
|
2017-05-09 19:10:19 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2017-05-31 16:33:27 -04:00
|
|
|
<ul class="content-list group-list-tree">
|
2017-06-07 04:45:48 -04:00
|
|
|
<group-item
|
|
|
|
v-for="(group, index) in groups"
|
|
|
|
:key="index"
|
|
|
|
:group="group"
|
2017-10-04 10:10:24 -04:00
|
|
|
:parent-group="parentGroup"
|
2018-09-07 02:09:13 -04:00
|
|
|
:action="action"
|
2017-06-07 04:45:48 -04:00
|
|
|
/>
|
2017-10-04 10:10:24 -04:00
|
|
|
<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"
|
2018-01-06 13:59:49 -05:00
|
|
|
>
|
|
|
|
</i>
|
|
|
|
{{ moreChildrenStats }}
|
2017-10-04 10:10:24 -04:00
|
|
|
</a>
|
|
|
|
</li>
|
2017-05-09 19:10:19 -04:00
|
|
|
</ul>
|
|
|
|
</template>
|