first commit Multi restore in trash, focus on the new folder name

This commit is contained in:
Milos Holba
2020-12-29 11:39:37 +01:00
parent fed95cbd64
commit 64fd6a2265
18 changed files with 400 additions and 108 deletions
+1
View File
@@ -12,6 +12,7 @@
<!--Mobile Navigation-->
<MobileNavigation/>
<!-- Processing popup for zip -->
<ProcessingPopup/>
<!--Confirm Popup-->
@@ -30,10 +30,12 @@
<OptionGroup v-if="item && multiSelectContextMenu">
<Option @click.native="ItemDetail" :title="$t('context_menu.detail')" icon="detail"/>
<Option @click.native="downloadItem" v-if="!isFolder" :title="$t('context_menu.download')" icon="download"/>
<Option @click.native="downloadFolder" :title="$t('context_menu.zip_folder')" icon="zip-folder"/>
</OptionGroup>
<!-- Multi options -->
<OptionGroup v-if="!multiSelectContextMenu">
<Option @click.native="restoreItem" v-if="item" :title="$t('context_menu.restore')" icon="restore"/>
<Option @click.native="deleteItem" :title="$t('context_menu.delete')" icon="trash"/>
<Option @click.native="emptyTrash" :title="$t('context_menu.empty_trash')" icon="empty-trash"/>
</OptionGroup>
@@ -62,6 +64,7 @@
<OptionGroup v-if="item && multiSelectContextMenu">
<Option @click.native="ItemDetail" :title="$t('context_menu.detail')" icon="detail"/>
<Option @click.native="downloadItem" v-if="!isFolder" :title="$t('context_menu.download')" icon="download"/>
<Option @click.native="downloadFolder" v-if="isFolder" :title="$t('context_menu.zip_folder')" icon="zip-folder"/>
</OptionGroup>
<!-- Multi options -->
@@ -106,6 +109,7 @@
<OptionGroup v-if="item && multiSelectContextMenu ">
<Option @click.native="ItemDetail" :title="$t('context_menu.detail')" icon="detail"/>
<Option @click.native="downloadItem" v-if="!isFolder" :title="$t('context_menu.download')" icon="download"/>
<Option @click.native="downloadFolder" v-if="isFolder" :title="$t('context_menu.zip_folder')" icon="zip-folder"/>
</OptionGroup>
<!-- Multi options -->
@@ -143,6 +147,7 @@
<OptionGroup v-if="item && multiSelectContextMenu">
<Option @click.native="ItemDetail" :title="$t('context_menu.detail')" icon="detail"/>
<Option @click.native="downloadItem" v-if="!isFolder" :title="$t('context_menu.download')" icon="download"/>
<Option @click.native="downloadFolder" v-if="isFolder" :title="$t('context_menu.zip_folder')" icon="zip-folder"/>
</OptionGroup>
<!-- Multi options -->
@@ -167,6 +172,7 @@
<OptionGroup v-if="item && multiSelectContextMenu">
<Option @click.native="ItemDetail" :title="$t('context_menu.detail')" icon="detail"/>
<Option @click.native="downloadItem" v-if="!isFolder" :title="$t('context_menu.download')" icon="download"/>
<Option @click.native="downloadFolder" v-if="isFolder" :title="$t('context_menu.zip_folder')" icon="zip-folder"/>
</OptionGroup>
<!-- Multi options -->
@@ -250,11 +256,21 @@ export default {
},
methods: {
downloadFolder(){
this.$store.dispatch('downloadFolder' , this.item)
},
emptyTrash() {
this.$store.dispatch('emptyTrash')
},
restoreItem() {
this.$store.dispatch('restoreItem', this.item)
// If is item not in selected items restore just this single item
if(!this.fileInfoDetail.includes(this.item))
this.$store.dispatch('restoreItem', this.item)
// If is item in selected items restore all items from fileInfoDetail
if(this.fileInfoDetail.includes(this.item))
this.$store.dispatch('restoreItem', null)
},
shareCancel() {
this.$store.dispatch('shareCancel')
@@ -32,7 +32,7 @@
<!--Name-->
<div class="item-name">
<!--Name-->
<b ref="name" @input="renameItem" @keydown.delete.stop :contenteditable="canEditName" class="name">
<b :ref="this.data.unique_id" @input="renameItem" @keydown.delete.stop :contenteditable="canEditName" class="name">
{{ itemName }}
</b>
@@ -263,6 +263,14 @@ export default {
created() {
this.itemName = this.data.name
events.$on('newFolder:focus', (unique_id) => {
if(this.data.unique_id == unique_id) {
this.$refs[unique_id].focus()
document.execCommand('selectAll')
}
})
events.$on('mobileSelecting:start', () => {
this.multiSelectMode = true
this.$store.commit('CLEAR_FILEINFO_DETAIL')
@@ -28,11 +28,13 @@
<!--Else show only folder icon-->
<FontAwesomeIcon v-if="isFolder" :class="{ 'is-deleted': isDeleted }" class="folder-icon" icon="folder"/>
<!-- <div v-if="isFolder" :class="{ 'is-deleted': isDeleted }" class="folder-icon">&#128034;</div> -->
</div>
<!--Name-->
<div class="item-name">
<b ref="name" @input="renameItem" @keydown.delete.stop :contenteditable="canEditName" class="name">
<b :ref="this.data.unique_id" @input="renameItem" @keydown.delete.stop :contenteditable="canEditName" class="name">
{{ itemName }}
</b>
@@ -263,6 +265,14 @@ export default {
created() {
this.itemName = this.data.name
events.$on('newFolder:focus', (unique_id) => {
if(this.data.unique_id == unique_id) {
this.$refs[unique_id].focus()
document.execCommand('selectAll')
}
})
events.$on('mobileSelecting:start', () => {
this.mobileMultiSelect = true
this.$store.commit('CLEAR_FILEINFO_DETAIL')
@@ -12,6 +12,7 @@
<star-icon v-if="icon === 'favourites'" size="17"></star-icon>
<folder-plus-icon v-if="icon === 'create-folder'" size="17"></folder-plus-icon>
<smile-icon v-if="icon === 'no-options'" size="17"></smile-icon>
<paperclip-icon v-if="icon === 'zip-folder'" size="17"></paperclip-icon>
</div>
<div class="text-label">
{{ title }}
@@ -24,6 +25,7 @@ import {
CornerDownRightIcon,
DownloadCloudIcon,
FolderPlusIcon,
PaperclipIcon,
LifeBuoyIcon,
Trash2Icon,
Edit2Icon,
@@ -41,6 +43,7 @@ import {
CornerDownRightIcon,
DownloadCloudIcon,
FolderPlusIcon,
PaperclipIcon,
LifeBuoyIcon,
Trash2Icon,
SmileIcon,
@@ -84,8 +84,6 @@ export default {
this.filter.field = field
console.log(this.filter);
// Set sorting direction
if (this.filter.sort === 'DESC')
this.filter.sort = 'ASC'
+2 -1
View File
@@ -283,7 +283,8 @@
"share_edit": "编辑分享设定",
"upload": "上传",
"select": "Select",
"no_options": "No Options Available"
"no_options": "No Options Available",
"zip_folder": "Zip Folder"
},
"mobile_selecting": {
"select_all": "Select All",
+2 -1
View File
@@ -285,7 +285,8 @@
"share_edit": "Edit Sharing",
"upload": "Upload",
"select": "Select",
"no_options": "No Options Available"
"no_options": "No Options Available",
"zip_folder": "Zip Folder"
},
"mobile_selecting": {
"select_all": "Select All",
+2 -1
View File
@@ -285,7 +285,8 @@
"share_edit": "Upraviť zdieľanie",
"upload": "Nahrať",
"select": "Výber",
"no_options": "Nie sú k dispozícii žiadne možnosti"
"no_options": "Nie sú k dispozícii žiadne možnosti",
"zip_folder": "Zazipovať priečinok"
},
"mobile_selecting": {
"select_all": "Vybrať všetko",
+43 -5
View File
@@ -10,6 +10,27 @@ const defaultState = {
}
const actions = {
downloadFolder: ({commit, getters}, folder) => {
commit('ZIPPING_FILE_STATUS', true)
// Get route
let route = getters.sharedDetail && !getters.sharedDetail.protected
? '/api/zip-folder/' + folder.unique_id + '/public/' + router.currentRoute.params.token
: '/api/zip-folder/' + folder.unique_id
axios.get(route)
.then(response => {
Vue.prototype.$downloadFile(response.data.url, response.data.name)
})
.catch(() => {
Vue.prototype.$isSomethingWrong()
})
.finally(() => {
commit('ZIPPING_FILE_STATUS', false)
})
},
downloadFiles: ({ commit, getters }) => {
let files = []
@@ -96,6 +117,11 @@ const actions = {
events.$emit('scrollTop')
//Set focus on new folder name
setTimeout(() => {
events.$emit('newFolder:focus', response.data.unique_id)
}, 10);
if (getters.currentFolder.location !== 'public')
dispatch('getAppData')
if (getters.currentFolder.location === 'public')
@@ -220,24 +246,36 @@ const actions = {
},
restoreItem: ({ commit, getters }, item) => {
let itemToRestore = []
let items = [item]
let restoreToHome = false
// If coming no selected item dont get items to restore from fileInfoDetail
if (!item)
items = getters.fileInfoDetail
// Check if file can be restored to home directory
if (getters.currentFolder.location === 'trash')
restoreToHome = true
// Remove file
commit('REMOVE_ITEM', item.unique_id)
items.forEach(data => itemToRestore.push({
'type': data.type,
'unique_id': data.unique_id,
}))
// Remove file preview
commit('CLEAR_FILEINFO_DETAIL')
axios
.post(getters.api + '/restore-item/' + item.unique_id, {
type: item.type,
.post(getters.api + '/restore-items' ,{
to_home: restoreToHome,
_method: 'patch'
data: itemToRestore,
})
.then(
// Remove file
items.forEach( data => commit('REMOVE_ITEM', data.unique_id) )
)
.catch(() => Vue.prototype.$isSomethingWrong())
},
deleteItem: ({ commit, getters, dispatch }, noSelectedItem) => {
+5
View File
@@ -9,6 +9,9 @@
<!--Move item setup-->
<MoveItem />
<!-- Processing popup for zip -->
<ProcessingPopup/>
<!-- Mobile Menu for Multi selected items -->
<MobileMultiSelectMenu/>
@@ -116,6 +119,7 @@
import MobileSortingAndPreview from '@/components/FilesView/MobileSortingAndPreview'
import MobileMultiSelectMenu from '@/components/FilesView/MobileMultiSelectMenu'
import DesktopSortingAndPreview from '@/components/FilesView/DesktopSortingAndPreview'
import ProcessingPopup from '@/components/FilesView/ProcessingPopup'
import TreeMenuNavigator from '@/components/Others/TreeMenuNavigator'
import FileFullPreview from '@/components/FilesView/FileFullPreview'
import DesktopToolbar from '@/components/FilesView/DesktopToolbar'
@@ -152,6 +156,7 @@
ValidationObserver,
TreeMenuNavigator,
FileFullPreview,
ProcessingPopup,
DesktopToolbar,
ContentSidebar,
DragUI,