mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-24 18:00:40 +00:00
bulk-operations v0.1 adding Drag & Drop for moving items to navigations folders, add folders to favourites
This commit is contained in:
+5
-1
@@ -8,7 +8,6 @@ import { Store } from 'vuex'
|
||||
const actions = {
|
||||
moveItem: ({commit, getters, dispatch}, {to_item ,noSelectedItem}) => {
|
||||
|
||||
|
||||
let itemsToMove = []
|
||||
let items = [noSelectedItem]
|
||||
|
||||
@@ -25,6 +24,11 @@ const actions = {
|
||||
})
|
||||
})
|
||||
|
||||
// Remove file preview
|
||||
if(!noSelectedItem){
|
||||
commit('CLEAR_FILEINFO_DETAIL')
|
||||
}
|
||||
|
||||
// Get route
|
||||
let route = getters.sharedDetail && ! getters.sharedDetail.protected
|
||||
? '/api/move/public' + router.currentRoute.params.token
|
||||
|
||||
+26
-5
@@ -48,13 +48,32 @@ const actions = {
|
||||
})
|
||||
},
|
||||
addToFavourites: (context, folder) => {
|
||||
let addFavourites = []
|
||||
let items = [folder]
|
||||
|
||||
console.log(context.getters.fileInfoDetail)
|
||||
if(!folder){
|
||||
items = context.getters.fileInfoDetail
|
||||
}
|
||||
|
||||
items.forEach((data) => {
|
||||
if(data.type === 'folder') {
|
||||
addFavourites.push({
|
||||
'unique_id': data.unique_id
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if(!folder) {
|
||||
context.commit('CLEAR_FILEINFO_DETAIL')
|
||||
}
|
||||
|
||||
// Add to storage
|
||||
context.commit('ADD_TO_FAVOURITES', folder)
|
||||
context.commit('ADD_TO_FAVOURITES', items)
|
||||
|
||||
axios
|
||||
.post(context.getters.api + '/folders/favourites', {
|
||||
unique_id: folder.unique_id
|
||||
folders: addFavourites
|
||||
})
|
||||
.catch(() => {
|
||||
// Show error message
|
||||
@@ -95,11 +114,13 @@ const mutations = {
|
||||
state.app = undefined
|
||||
},
|
||||
ADD_TO_FAVOURITES(state, folder) {
|
||||
folder.forEach(item => {
|
||||
state.user.relationships.favourites.data.attributes.folders.push({
|
||||
unique_id: folder.unique_id,
|
||||
name: folder.name,
|
||||
type: folder.type,
|
||||
unique_id: item.unique_id,
|
||||
name: item.name,
|
||||
type: item.type,
|
||||
})
|
||||
})
|
||||
},
|
||||
UPDATE_NAME(state, name) {
|
||||
state.user.data.attributes.name = name
|
||||
|
||||
Reference in New Issue
Block a user