-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3573 from owncloud/feature/quick-actions
- Loading branch information
Showing
19 changed files
with
220 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<div> | ||
<oc-button | ||
v-for="action in actions" | ||
:id="`files-quick-action-${action.id}`" | ||
:key="action.label" | ||
:aria-label="$gettext(action.label)" | ||
variation="raw" | ||
@click.native.stop="action.handler({ item, client: $client, store: $store })" | ||
> | ||
<oc-icon :name="action.icon" aria-hidden="true" size="small" class="uk-flex" /> | ||
</oc-button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'QuickActions', | ||
props: { | ||
actions: { | ||
type: Object, | ||
required: true | ||
}, | ||
item: { | ||
type: Object, | ||
required: true | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import moment from 'moment' | ||
import copyToClipboard from 'copy-to-clipboard' | ||
|
||
// just a dummy function to trick gettext tools | ||
function $gettext(msg) { | ||
return msg | ||
} | ||
|
||
function createPublicLink(ctx) { | ||
// FIXME: Translate name | ||
const params = { name: 'Quick action link' } | ||
const capabilities = ctx.store.state.user.capabilities | ||
const expirationDate = capabilities.files_sharing.public.expire_date | ||
|
||
if (expirationDate.enabled) { | ||
params.expireDate = moment() | ||
.add(parseInt(expirationDate.days, 10), 'days') | ||
.endOf('day') | ||
.toISOString() | ||
} | ||
|
||
return new Promise((resolve, reject) => { | ||
ctx.client.shares | ||
.shareFileWithLink(ctx.item.path, params) | ||
.then(res => { | ||
copyToClipboard(res.shareInfo.url) | ||
ctx.store.dispatch('showMessage', { | ||
title: $gettext('Public link created'), | ||
desc: $gettext( | ||
'Public link has been successfully created and copied into your clipboard.' | ||
), | ||
status: 'success' | ||
}) | ||
resolve() | ||
}) | ||
.catch(e => { | ||
reject(e) | ||
}) | ||
}) | ||
} | ||
|
||
export default { | ||
publicLink: { | ||
id: 'public-link', | ||
label: $gettext('Create and copy public link'), | ||
icon: 'link', | ||
handler: createPublicLink | ||
} | ||
} |
Oops, something went wrong.