aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/views/SharingLinkList.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/src/views/SharingLinkList.vue')
-rw-r--r--apps/files_sharing/src/views/SharingLinkList.vue65
1 files changed, 29 insertions, 36 deletions
diff --git a/apps/files_sharing/src/views/SharingLinkList.vue b/apps/files_sharing/src/views/SharingLinkList.vue
index 14ea879e004..c3d9a7f83dc 100644
--- a/apps/files_sharing/src/views/SharingLinkList.vue
+++ b/apps/files_sharing/src/views/SharingLinkList.vue
@@ -1,53 +1,44 @@
<!--
- - @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
- -
- - @author John Molakvoæ <skjnldsv@protonmail.com>
- -
- - @license GNU AGPL version 3 or any later version
- -
- - This program is free software: you can redistribute it and/or modify
- - it under the terms of the GNU Affero General Public License as
- - published by the Free Software Foundation, either version 3 of the
- - License, or (at your option) any later version.
- -
- - This program is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU Affero General Public License for more details.
- -
- - You should have received a copy of the GNU Affero General Public License
- - along with this program. If not, see <http://www.gnu.org/licenses/>.
- -
- -->
+ - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
- <ul v-if="canLinkShare" class="sharing-link-list">
- <!-- If no link shares, show the add link default entry -->
- <SharingEntryLink v-if="!hasLinkShares && canReshare"
- :can-reshare="canReshare"
- :file-info="fileInfo"
- @add:share="addShare" />
-
+ <ul v-if="canLinkShare"
+ :aria-label="t('files_sharing', 'Link shares')"
+ class="sharing-link-list">
<!-- Else we display the list -->
<template v-if="hasShares">
<!-- using shares[index] to work with .sync -->
<SharingEntryLink v-for="(share, index) in shares"
:key="share.id"
+ :index="shares.length > 1 ? index + 1 : null"
:can-reshare="canReshare"
:share.sync="shares[index]"
:file-info="fileInfo"
@add:share="addShare(...arguments)"
@update:share="awaitForShare(...arguments)"
- @remove:share="removeShare" />
+ @remove:share="removeShare"
+ @open-sharing-details="openSharingDetails(share)" />
</template>
+
+ <!-- If no link shares, show the add link default entry -->
+ <SharingEntryLink v-if="!hasLinkShares && canReshare"
+ :can-reshare="canReshare"
+ :file-info="fileInfo"
+ @add:share="addShare" />
</ul>
</template>
<script>
-// eslint-disable-next-line no-unused-vars
-import Share from '../models/Share'
-import ShareTypes from '../mixins/ShareTypes'
-import SharingEntryLink from '../components/SharingEntryLink'
+import { getCapabilities } from '@nextcloud/capabilities'
+
+import { t } from '@nextcloud/l10n'
+
+import Share from '../models/Share.js'
+import SharingEntryLink from '../components/SharingEntryLink.vue'
+import ShareDetails from '../mixins/ShareDetails.js'
+import { ShareType } from '@nextcloud/sharing'
export default {
name: 'SharingLinkList',
@@ -56,7 +47,7 @@ export default {
SharingEntryLink,
},
- mixins: [ShareTypes],
+ mixins: [ShareDetails],
props: {
fileInfo: {
@@ -77,7 +68,7 @@ export default {
data() {
return {
- canLinkShare: OC.getCapabilities().files_sharing.public.enabled,
+ canLinkShare: getCapabilities().files_sharing.public.enabled,
}
},
@@ -90,7 +81,7 @@ export default {
* @return {Array}
*/
hasLinkShares() {
- return this.shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK).length > 0
+ return this.shares.filter(share => share.type === ShareType.Link).length > 0
},
/**
@@ -104,6 +95,8 @@ export default {
},
methods: {
+ t,
+
/**
* Add a new share into the link shares list
* and return the newly created share component
@@ -113,7 +106,7 @@ export default {
*/
addShare(share, resolve) {
// eslint-disable-next-line vue/no-mutating-props
- this.shares.unshift(share)
+ this.shares.push(share)
this.awaitForShare(share, resolve)
},