mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
- on-demand notification
- error message on failed after shared link was created - Shared link email text edit
This commit is contained in:
@@ -122,6 +122,10 @@ export default {
|
||||
.email-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.email-input {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.email-tag {
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 20;
|
||||
z-index: 19;
|
||||
overflow-y: auto;
|
||||
display: grid;
|
||||
padding: 40px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<PopupWrapper name="share-create">
|
||||
<!--Title-->
|
||||
<PopupHeader :title="$t('popup_share_create.title', {item: itemTypeTitle})" icon="share" />
|
||||
<PopupHeader :title="$t('popup_share_create.title', {item: itemTypeTitle})" icon="share"/>
|
||||
|
||||
<!--Content-->
|
||||
<PopupContent>
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
<!--Form to set sharing-->
|
||||
<ValidationObserver @submit.prevent v-if="! isGeneratedShared" ref="shareForm" v-slot="{ invalid }" tag="form" class="form-wrapper">
|
||||
|
||||
|
||||
<TabWrapper>
|
||||
|
||||
<!-- Share via link -->
|
||||
<TabOption :selected="true" :title="$t('shared_form.share_by_link')" icon="link"/>
|
||||
|
||||
|
||||
<!-- Share via Email -->
|
||||
<TabOption :title="$t('shared_form.share_by_email')" icon="email">
|
||||
<ValidationProvider tag="div" mode="passive" name="Email" rules="required" v-slot="{ errors }">
|
||||
<MultiEmailInput rules="required" v-model="shareOptions.emails" :label="$t('shared_form.recipients_label')" :isError="errors[0]" />
|
||||
<MultiEmailInput rules="required" v-model="shareOptions.emails" :label="$t('shared_form.recipients_label')" :isError="errors[0]"/>
|
||||
</ValidationProvider>
|
||||
</TabOption>
|
||||
|
||||
@@ -69,218 +69,211 @@
|
||||
<div v-if="isGeneratedShared" class="form-wrapper">
|
||||
<div class="input-wrapper">
|
||||
<label class="input-label">{{ this.sharedViaEmail ? $t('shared_form.label_share_vie_email') : $t('shared_form.label_shared_url') }}:</label>
|
||||
<CopyInput size="small" :item="pickedItem" />
|
||||
<CopyInput size="small" :item="pickedItem"/>
|
||||
</div>
|
||||
</div>
|
||||
</PopupContent>
|
||||
|
||||
<!--Actions-->
|
||||
<PopupActions>
|
||||
<ButtonBase
|
||||
v-if="! isGeneratedShared"
|
||||
class="popup-button"
|
||||
@click.native="$closePopup()"
|
||||
button-style="secondary"
|
||||
>{{ $t('popup_move_item.cancel') }}
|
||||
<ButtonBase v-if="! isGeneratedShared" class="popup-button" @click.native="$closePopup()" button-style="secondary">{{ $t('popup_move_item.cancel') }}
|
||||
</ButtonBase>
|
||||
<ButtonBase
|
||||
class="popup-button"
|
||||
@click.native="submitShareOptions"
|
||||
button-style="theme"
|
||||
:loading="isLoading"
|
||||
:disabled="isLoading"
|
||||
>{{ submitButtonText }}
|
||||
<ButtonBase class="popup-button" @click.native="submitShareOptions" button-style="theme" :loading="isLoading" :disabled="isLoading">{{ submitButtonText }}
|
||||
</ButtonBase>
|
||||
</PopupActions>
|
||||
</PopupWrapper>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||
import SelectBoxInput from '@/components/Others/Forms/SelectBoxInput'
|
||||
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
|
||||
import PopupActions from '@/components/Others/Popup/PopupActions'
|
||||
import PopupContent from '@/components/Others/Popup/PopupContent'
|
||||
import PopupHeader from '@/components/Others/Popup/PopupHeader'
|
||||
import MultiEmailInput from '@/components/Others/Forms/MultiEmailInput'
|
||||
import SwitchInput from '@/components/Others/Forms/SwitchInput'
|
||||
import SelectInput from '@/components/Others/Forms/SelectInput'
|
||||
import ThumbnailItem from '@/components/Others/ThumbnailItem'
|
||||
import ActionButton from '@/components/Others/ActionButton'
|
||||
import CopyInput from '@/components/Others/Forms/CopyInput'
|
||||
import TabWrapper from '@/components/Others/TabWrapper'
|
||||
import TabOption from '@/components/Others/TabOption'
|
||||
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||
import InfoBox from '@/components/Others/Forms/InfoBox'
|
||||
import {LinkIcon, MailIcon } from 'vue-feather-icons'
|
||||
import {required} from 'vee-validate/dist/rules'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {events} from '@/bus'
|
||||
import axios from 'axios'
|
||||
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
|
||||
import SelectBoxInput from '@/components/Others/Forms/SelectBoxInput'
|
||||
import PopupWrapper from '@/components/Others/Popup/PopupWrapper'
|
||||
import PopupActions from '@/components/Others/Popup/PopupActions'
|
||||
import PopupContent from '@/components/Others/Popup/PopupContent'
|
||||
import PopupHeader from '@/components/Others/Popup/PopupHeader'
|
||||
import MultiEmailInput from '@/components/Others/Forms/MultiEmailInput'
|
||||
import SwitchInput from '@/components/Others/Forms/SwitchInput'
|
||||
import SelectInput from '@/components/Others/Forms/SelectInput'
|
||||
import ThumbnailItem from '@/components/Others/ThumbnailItem'
|
||||
import ActionButton from '@/components/Others/ActionButton'
|
||||
import CopyInput from '@/components/Others/Forms/CopyInput'
|
||||
import TabWrapper from '@/components/Others/TabWrapper'
|
||||
import TabOption from '@/components/Others/TabOption'
|
||||
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||
import InfoBox from '@/components/Others/Forms/InfoBox'
|
||||
import { LinkIcon, MailIcon } from 'vue-feather-icons'
|
||||
import { required } from 'vee-validate/dist/rules'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { events } from '@/bus'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
name: 'ShareCreate',
|
||||
components: {
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
SelectBoxInput,
|
||||
ThumbnailItem,
|
||||
ActionButton,
|
||||
PopupWrapper,
|
||||
PopupActions,
|
||||
TabWrapper,
|
||||
TabOption,
|
||||
PopupContent,
|
||||
PopupHeader,
|
||||
MultiEmailInput,
|
||||
SelectInput,
|
||||
SwitchInput,
|
||||
ButtonBase,
|
||||
CopyInput,
|
||||
MailIcon,
|
||||
required,
|
||||
LinkIcon,
|
||||
InfoBox
|
||||
export default {
|
||||
name: 'ShareCreate',
|
||||
components: {
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
SelectBoxInput,
|
||||
ThumbnailItem,
|
||||
ActionButton,
|
||||
PopupWrapper,
|
||||
PopupActions,
|
||||
TabWrapper,
|
||||
TabOption,
|
||||
PopupContent,
|
||||
PopupHeader,
|
||||
MultiEmailInput,
|
||||
SelectInput,
|
||||
SwitchInput,
|
||||
ButtonBase,
|
||||
CopyInput,
|
||||
MailIcon,
|
||||
required,
|
||||
LinkIcon,
|
||||
InfoBox
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permissionOptions',
|
||||
'expirationList'
|
||||
]),
|
||||
itemTypeTitle() {
|
||||
return this.pickedItem && this.pickedItem.type === 'folder' ? this.$t('types.folder') : this.$t('types.file')
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permissionOptions',
|
||||
'expirationList',
|
||||
]),
|
||||
itemTypeTitle() {
|
||||
return this.pickedItem && this.pickedItem.type === 'folder' ? this.$t('types.folder') : this.$t('types.file')
|
||||
isFolder() {
|
||||
return this.pickedItem && this.pickedItem.type === 'folder'
|
||||
},
|
||||
submitButtonText() {
|
||||
return this.isGeneratedShared ? this.$t('shared_form.button_done') : this.$t('shared_form.button_generate')
|
||||
},
|
||||
moreOptionsTitle() {
|
||||
return this.isMoreOptions ? this.$t('shared_form.button_close_options') : this.$t('shared_form.button_more_options')
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
shareOptions: {
|
||||
isPassword: false,
|
||||
expiration: undefined,
|
||||
password: undefined,
|
||||
permission: undefined,
|
||||
type: undefined,
|
||||
unique_id: undefined,
|
||||
emails: undefined
|
||||
},
|
||||
isFolder() {
|
||||
return this.pickedItem && this.pickedItem.type === 'folder'
|
||||
},
|
||||
submitButtonText() {
|
||||
return this.isGeneratedShared ? this.$t('shared_form.button_done') : this.$t('shared_form.button_generate')
|
||||
},
|
||||
moreOptionsTitle() {
|
||||
return this.isMoreOptions ? this.$t('shared_form.button_close_options') : this.$t('shared_form.button_more_options')
|
||||
pickedItem: undefined,
|
||||
isGeneratedShared: false,
|
||||
isLoading: false,
|
||||
isMoreOptions: false,
|
||||
sharedViaEmail: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
moreOptions() {
|
||||
this.isMoreOptions = !this.isMoreOptions
|
||||
|
||||
if (!this.isMoreOptions)
|
||||
this.shareOptions.expiration = undefined
|
||||
},
|
||||
async submitShareOptions() {
|
||||
|
||||
// If shared was generated, then close popup
|
||||
if (this.isGeneratedShared) {
|
||||
events.$emit('popup:close')
|
||||
|
||||
return
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
shareOptions: {
|
||||
|
||||
// Validate fields
|
||||
const isValid = await this.$refs.shareForm.validate()
|
||||
|
||||
if (!isValid) return
|
||||
|
||||
this.isLoading = true
|
||||
|
||||
// Send request to get share link
|
||||
axios
|
||||
.post('/api/share', this.shareOptions)
|
||||
.then(response => {
|
||||
|
||||
// Show infobox and reset emails container
|
||||
if (this.shareOptions.emails)
|
||||
this.sharedViaEmail = true
|
||||
|
||||
// End loading
|
||||
this.isGeneratedShared = true
|
||||
|
||||
this.$store.commit('UPDATE_SHARED_ITEM', response.data.data.attributes)
|
||||
})
|
||||
.catch(() => {
|
||||
events.$emit('alert:open', {
|
||||
title: this.$t('popup_error.title'),
|
||||
message: this.$t('popup_error.message'),
|
||||
})
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
events.$on('emailsInputValues', (emails) => this.shareOptions.emails = emails)
|
||||
|
||||
// Show popup
|
||||
events.$on('popup:open', args => {
|
||||
|
||||
if (args.name !== 'share-create') return
|
||||
|
||||
// Store picked item
|
||||
this.pickedItem = args.item
|
||||
|
||||
this.shareOptions.type = args.item.type
|
||||
this.shareOptions.unique_id = args.item.unique_id
|
||||
})
|
||||
|
||||
// Close popup
|
||||
events.$on('popup:close', () => {
|
||||
|
||||
// Restore data
|
||||
setTimeout(() => {
|
||||
this.shareOptions = {
|
||||
permission: undefined,
|
||||
password: undefined,
|
||||
isPassword: false,
|
||||
expiration: undefined,
|
||||
password: undefined,
|
||||
permission: undefined,
|
||||
type: undefined,
|
||||
unique_id: undefined,
|
||||
emails: undefined
|
||||
},
|
||||
pickedItem: undefined,
|
||||
isGeneratedShared: false,
|
||||
isLoading: false,
|
||||
isMoreOptions: false,
|
||||
sharedViaEmail: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
moreOptions() {
|
||||
this.isMoreOptions = ! this.isMoreOptions
|
||||
|
||||
if (! this.isMoreOptions)
|
||||
this.shareOptions.expiration = undefined
|
||||
},
|
||||
async submitShareOptions() {
|
||||
|
||||
// If shared was generated, then close popup
|
||||
if (this.isGeneratedShared) {
|
||||
events.$emit('popup:close')
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate fields
|
||||
const isValid = await this.$refs.shareForm.validate();
|
||||
|
||||
if (!isValid) return;
|
||||
|
||||
this.isLoading = true
|
||||
|
||||
// Send request to get share link
|
||||
axios
|
||||
.post('/api/share', this.shareOptions)
|
||||
.then(response => {
|
||||
|
||||
// Show infobox and reset emails container
|
||||
if (this.shareOptions.emails)
|
||||
this.sharedViaEmail = true
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
this.isGeneratedShared = true
|
||||
|
||||
this.$store.commit('UPDATE_SHARED_ITEM', response.data.data.attributes)
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
// todo: catch errors
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
events.$on('emailsInputValues', (emails) => this.shareOptions.emails = emails)
|
||||
|
||||
// Show popup
|
||||
events.$on('popup:open', args => {
|
||||
|
||||
if (args.name !== 'share-create') return
|
||||
|
||||
// Store picked item
|
||||
this.pickedItem = args.item
|
||||
|
||||
this.shareOptions.type = args.item.type
|
||||
this.shareOptions.unique_id = args.item.unique_id
|
||||
})
|
||||
|
||||
// Close popup
|
||||
events.$on('popup:close', () => {
|
||||
|
||||
// Restore data
|
||||
setTimeout(() => {
|
||||
this.shareOptions = {
|
||||
permission: undefined,
|
||||
password: undefined,
|
||||
isPassword: false,
|
||||
expiration: undefined,
|
||||
type: undefined,
|
||||
unique_id: undefined,
|
||||
emails: undefined,
|
||||
}
|
||||
this.isGeneratedShared = false
|
||||
this.isMoreOptions = false
|
||||
this.sharedViaEmail = false
|
||||
}, 150)
|
||||
})
|
||||
}
|
||||
this.isGeneratedShared = false
|
||||
this.isMoreOptions = false
|
||||
this.sharedViaEmail = false
|
||||
}, 150)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@assets/vue-file-manager/_inapp-forms.scss";
|
||||
@import '@assets/vue-file-manager/_forms';
|
||||
@import "@assets/vue-file-manager/_inapp-forms.scss";
|
||||
@import '@assets/vue-file-manager/_forms';
|
||||
|
||||
.more-options {
|
||||
margin-bottom: 10px;
|
||||
.more-options {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
|
||||
&.password {
|
||||
margin-top: -10px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
|
||||
&.password {
|
||||
margin-top: -10px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-thumbnail {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.item-thumbnail {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -207,7 +207,6 @@
|
||||
emails: this.emails
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
this.$isSomethingWrong()
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -297,12 +296,9 @@
|
||||
events.$emit('popup:close')
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
this.$isSomethingWrong()
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 19;
|
||||
z-index: 18;
|
||||
background: $light_mode_vignette;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ return [
|
||||
'home' => '首页',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_subject' => ':user sned you shared files.',
|
||||
'shared_link_email_subject' => '🙋 :user share some files with you. Look at it!',
|
||||
'shared_link_email_greeting' => 'Hello!',
|
||||
'shared_link_email_user' => ':user (:email) send you a link to shared files.',
|
||||
'shared_link_email_link' => 'Your files',
|
||||
'shared_link_email_link' => 'Open your files',
|
||||
|
||||
// Reset password email
|
||||
'reset_password_greeting' => 'Hello!',
|
||||
|
||||
@@ -8,10 +8,10 @@ return [
|
||||
'home' => 'Home',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_subject' => ':user sned you shared files.',
|
||||
'shared_link_email_subject' => '🙋 :user share some files with you. Look at it!',
|
||||
'shared_link_email_greeting' => 'Hello!',
|
||||
'shared_link_email_user' => ':user (:email) send you a link to shared files.',
|
||||
'shared_link_email_link' => 'Your files',
|
||||
'shared_link_email_link' => 'Open your files',
|
||||
|
||||
// Reset password email
|
||||
'reset_password_greeting' => 'Hello!',
|
||||
|
||||
@@ -8,9 +8,9 @@ return [
|
||||
'home' => 'Domov',
|
||||
|
||||
//Shared link email message
|
||||
'shared_link_email_subject' => ':user vám posiela zdielany odkaz.',
|
||||
'shared_link_email_subject' => '🙋 :user vám posiela zdieľané súbory.',
|
||||
'shared_link_email_greeting' => 'Ahoj!',
|
||||
'shared_link_email_user' => ':user (:email) vám posiela odkaz pre zdielane súbory.',
|
||||
'shared_link_email_user' => ':user (:email) vám posiela odkaz pre zdieľané súbory.',
|
||||
'shared_link_email_link' => 'Vaše súbory',
|
||||
|
||||
// Reset password email
|
||||
|
||||
Reference in New Issue
Block a user