mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 02:50:39 +00:00
frontend function consolidation part 2
This commit is contained in:
@@ -184,7 +184,7 @@ export default {
|
||||
this.$store.dispatch('deleteItem')
|
||||
},
|
||||
createFolder() {
|
||||
this.$store.dispatch('createFolder', this.$t('popup_create_folder.folder_default_name'))
|
||||
this.$store.dispatch('createFolder', {name: this.$t('popup_create_folder.folder_default_name')})
|
||||
},
|
||||
moveItem() {
|
||||
if (this.fileInfoDetail.length > 0)
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
}
|
||||
},
|
||||
isLocked() {
|
||||
return this.fileInfoDetail[0].shared.protected
|
||||
return this.fileInfoDetail[0].shared.is_protected
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
<!--Folder tree-->
|
||||
<div v-if="! isLoadingTree && navigation">
|
||||
<ThumbnailItem v-if="fileInfoDetail.length < 2 || noSelectedItem" class="item-thumbnail" :item="pickedItem" info="location" />
|
||||
<ThumbnailItem v-if="fileInfoDetail.length < 2 || isSelectedItem" class="item-thumbnail" :item="pickedItem" info="location" />
|
||||
|
||||
<MultiSelected class="multiple-selected"
|
||||
:title="$t('file_detail.selected_multiple')"
|
||||
:subtitle="this.fileInfoDetail.length + ' ' + $tc('file_detail.items', this.fileInfoDetail.length)"
|
||||
v-if="fileInfoDetail.length > 1 && !noSelectedItem" />
|
||||
v-if="fileInfoDetail.length > 1 && !isSelectedItem" />
|
||||
|
||||
<TreeMenu :disabled-by-id="pickedItem" :depth="1" :nodes="items" v-for="items in navigation" :key="items.id" />
|
||||
</div>
|
||||
@@ -74,7 +74,7 @@
|
||||
selectedFolder: undefined,
|
||||
pickedItem: undefined,
|
||||
isLoadingTree: true,
|
||||
noSelectedItem: false
|
||||
isSelectedItem: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -82,18 +82,21 @@
|
||||
// Prevent empty submit
|
||||
if (!this.selectedFolder) return
|
||||
|
||||
//Prevent to move items to the same parent
|
||||
// Prevent to move items to the same parent
|
||||
if (this.fileInfoDetail.find(item => item.parent_id === this.selectedFolder.id)) return
|
||||
|
||||
// Move item
|
||||
if (!this.noSelectedItem) {
|
||||
this.$store.dispatch('moveItem', {to_item: this.selectedFolder, noSelectedItem: null})
|
||||
// Move item
|
||||
if (!this.isSelectedItem) {
|
||||
this.$store.dispatch('moveItem', {to_item: this.selectedFolder, isSelectedItem: null})
|
||||
}
|
||||
|
||||
if (this.noSelectedItem) {
|
||||
this.$store.dispatch('moveItem', {to_item: this.selectedFolder, noSelectedItem: this.pickedItem})
|
||||
if (this.isSelectedItem) {
|
||||
this.$store.dispatch('moveItem', {to_item: this.selectedFolder, isSelectedItem: this.pickedItem})
|
||||
}
|
||||
|
||||
console.log('to item:', this.selectedFolder);
|
||||
console.log('isSelectedItem:', this.pickedItem);
|
||||
|
||||
// Close popup
|
||||
events.$emit('popup:close')
|
||||
|
||||
@@ -130,12 +133,12 @@
|
||||
// Store picked item
|
||||
if (!this.fileInfoDetail.includes(args.item[0])) {
|
||||
this.pickedItem = args.item[0]
|
||||
this.noSelectedItem = true
|
||||
this.isSelectedItem = true
|
||||
}
|
||||
|
||||
if (this.fileInfoDetail.includes(args.item[0])) {
|
||||
this.pickedItem = this.fileInfoDetail[0]
|
||||
this.noSelectedItem = false
|
||||
this.isSelectedItem = false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -100,10 +100,10 @@ export default {
|
||||
name: this.pickedItem.name,
|
||||
}
|
||||
|
||||
if (this.folderIcon.emoji)
|
||||
if (this.folderIcon && this.folderIcon.emoji)
|
||||
item['emoji'] = this.folderIcon.emoji
|
||||
|
||||
if (this.folderIcon.color)
|
||||
if (this.folderIcon && this.folderIcon.color)
|
||||
item['color'] = this.folderIcon.color
|
||||
|
||||
// Rename item request
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<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>
|
||||
|
||||
<!--Item Thumbnail-->
|
||||
<ThumbnailItem class="item-thumbnail" :item="pickedItem" info="metadata"/>
|
||||
<ThumbnailItem class="item-thumbnail" :item="pickedItem" info="metadata" />
|
||||
|
||||
<!-- Infobox for successfull sended email -->
|
||||
<InfoBox v-if="isGeneratedShared && sharedViaEmail" class="info-box-wrapper">
|
||||
@@ -20,12 +20,12 @@
|
||||
<TabWrapper>
|
||||
|
||||
<!-- Share via link -->
|
||||
<TabOption :selected="true" :title="$t('shared_form.share_by_link')" icon="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>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<!--Permision Select-->
|
||||
<ValidationProvider v-if="isFolder" tag="div" mode="passive" class="input-wrapper" name="Permission" rules="required" v-slot="{ errors }">
|
||||
<label class="input-label">{{ $t('shared_form.label_permission') }}:</label>
|
||||
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :placeholder="$t('shared_form.placeholder_permission')" :isError="errors[0]"/>
|
||||
<SelectInput v-model="shareOptions.permission" :options="permissionOptions" :placeholder="$t('shared_form.placeholder_permission')" :isError="errors[0]" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<div class="input-wrapper">
|
||||
<div class="inline-wrapper">
|
||||
<label class="input-label">{{ $t('shared_form.label_password_protection') }}:</label>
|
||||
<SwitchInput v-model="shareOptions.isPassword" class="switch" :state="0"/>
|
||||
<SwitchInput v-model="shareOptions.isPassword" class="switch" :state="0" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<!--Set expiration-->
|
||||
<div class="input-wrapper">
|
||||
<label class="input-label">{{ $t('shared_form.label_expiration') }}:</label>
|
||||
<SelectBoxInput v-model="shareOptions.expiration" :data="expirationList" class="box"/>
|
||||
<SelectBoxInput v-model="shareOptions.expiration" :data="expirationList" class="box" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<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>
|
||||
@@ -85,7 +85,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
|
||||
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'
|
||||
@@ -101,10 +101,10 @@ 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 {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 {
|
||||
@@ -192,7 +192,9 @@ export default {
|
||||
|
||||
// Send request to get share link
|
||||
axios
|
||||
.post('/api/share', this.shareOptions)
|
||||
.post(`/api/share/${this.shareOptions.id}`,
|
||||
this.shareOptions
|
||||
)
|
||||
.then(response => {
|
||||
|
||||
// Show infobox and reset emails container
|
||||
|
||||
@@ -43,7 +43,9 @@
|
||||
<label class="input-label">{{ $t('shared_form.label_password_protection') }}:</label>
|
||||
<SwitchInput v-model="shareOptions.isProtected" :state="shareOptions.isProtected" class="switch"/>
|
||||
</div>
|
||||
<ActionButton v-if="(pickedItem.shared.protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" class="change-password">{{ $t('popup_share_edit.change_pass') }}</ActionButton>
|
||||
<ActionButton v-if="(pickedItem.shared.is_protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" class="change-password">
|
||||
{{ $t('popup_share_edit.change_pass') }}
|
||||
</ActionButton>
|
||||
</div>
|
||||
|
||||
<!--Set password-->
|
||||
@@ -62,7 +64,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ActionButton @click.native="moreOptions" :icon="isMoreOptions || shareOptions.expiration ? 'x' : 'pencil-alt'">{{ moreOptionsTitle }}</ActionButton>
|
||||
<ActionButton @click.native="moreOptions" :icon="isMoreOptions || shareOptions.expiration ? 'x' : 'pencil-alt'">
|
||||
{{ moreOptionsTitle }}
|
||||
</ActionButton>
|
||||
|
||||
</ValidationObserver>
|
||||
|
||||
@@ -235,7 +239,6 @@
|
||||
this.isDeleting = true
|
||||
|
||||
// Send delete request
|
||||
|
||||
await this.$store.dispatch('shareCancel' , this.pickedItem)
|
||||
.then((response) => {
|
||||
|
||||
@@ -323,7 +326,7 @@
|
||||
this.shareOptions = {
|
||||
token: args.item.shared.token,
|
||||
expiration: args.item.shared.expire_in,
|
||||
isProtected: args.item.shared.protected,
|
||||
isProtected: args.item.shared.is_protected,
|
||||
permission: args.item.shared.permission,
|
||||
password: undefined,
|
||||
}
|
||||
@@ -335,7 +338,7 @@
|
||||
this.sendToRecipientsMenu = true
|
||||
this.isEmailSended = false
|
||||
|
||||
this.canChangePassword = args.item.shared.protected
|
||||
this.canChangePassword = args.item.shared.is_protected
|
||||
})
|
||||
|
||||
// Close popup
|
||||
|
||||
Reference in New Issue
Block a user