mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
bulk-operations v0.3 add multi shared cancel to contextMenu
This commit is contained in:
@@ -93,16 +93,18 @@ class ShareController extends Controller
|
||||
* @return ResponseFactory|\Illuminate\Http\Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy($token)
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
// Get sharing record
|
||||
$shared = Share::where('token', $token)
|
||||
->where('user_id', Auth::id())
|
||||
->firstOrFail();
|
||||
foreach($request->input('folders') as $tokens) {
|
||||
|
||||
// Delete shared record
|
||||
$shared->delete();
|
||||
// Get sharing record
|
||||
$shared = Share::where('token', $tokens['token'])
|
||||
->where('user_id', Auth::id())
|
||||
->firstOrFail();
|
||||
|
||||
// Delete shared record
|
||||
$shared->delete();
|
||||
}
|
||||
// Done
|
||||
return response('Done!', 204);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"/chunks/environment-setup.js": "/chunks/environment-setup.js?id=826fbaa6cc4acab69f5d",
|
||||
"/chunks/files.js": "/chunks/files.js?id=12e6fd841d32ca1af12f",
|
||||
"/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js": "/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js?id=8ccd35de575e8a91d02f",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.js": "/chunks/files~chunks/shared-files~chunks/shared-page.js?id=e81501f9a20a5be89147",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.js": "/chunks/files~chunks/shared-files~chunks/shared-page.js?id=51133111dba51005238c",
|
||||
"/chunks/files~chunks/shared-page.js": "/chunks/files~chunks/shared-page.js?id=ed167949ea9398f0fbeb",
|
||||
"/chunks/forgotten-password.js": "/chunks/forgotten-password.js?id=aba8c662fbc234892216",
|
||||
"/chunks/installation-disclaimer.js": "/chunks/installation-disclaimer.js?id=7dfffa0f25308ba70b7a",
|
||||
@@ -147,5 +147,51 @@
|
||||
"/chunks/users.a1c4195e626ab12ad821.hot-update.js": "/chunks/users.a1c4195e626ab12ad821.hot-update.js",
|
||||
"/chunks/files~chunks/shared-page.422d77a654132ff1162b.hot-update.js": "/chunks/files~chunks/shared-page.422d77a654132ff1162b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.404b12f50da9f0f9411f.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.404b12f50da9f0f9411f.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.2bda357a419b66157113.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.2bda357a419b66157113.hot-update.js"
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.2bda357a419b66157113.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.2bda357a419b66157113.hot-update.js",
|
||||
"/js/main.920333698d85eecf7bc3.hot-update.js": "/js/main.920333698d85eecf7bc3.hot-update.js",
|
||||
"/js/main.4dd07fb2f10de1a40d07.hot-update.js": "/js/main.4dd07fb2f10de1a40d07.hot-update.js",
|
||||
"/js/main.fc612d60a444ab3617ec.hot-update.js": "/js/main.fc612d60a444ab3617ec.hot-update.js",
|
||||
"/js/main.77c3bda4f6c9acea87be.hot-update.js": "/js/main.77c3bda4f6c9acea87be.hot-update.js",
|
||||
"/js/main.2e3d6a050bb9da6b5214.hot-update.js": "/js/main.2e3d6a050bb9da6b5214.hot-update.js",
|
||||
"/js/main.0ff62e87a7b00084896e.hot-update.js": "/js/main.0ff62e87a7b00084896e.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.ca0dae6bf07adea87c06.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.ca0dae6bf07adea87c06.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.dbe05c7715aeb548380b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.dbe05c7715aeb548380b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.92b399d62418089a6ae7.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.92b399d62418089a6ae7.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.def2f268ccfb64d283d3.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.def2f268ccfb64d283d3.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.79a89f59a5e16f227377.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.79a89f59a5e16f227377.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.0972c3ed79bd045c5998.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.0972c3ed79bd045c5998.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.3b3579b8c2a237e4c270.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.3b3579b8c2a237e4c270.hot-update.js",
|
||||
"/js/main.669de1239f2b7dca05b0.hot-update.js": "/js/main.669de1239f2b7dca05b0.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.37a2a64b33a4b4455393.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.37a2a64b33a4b4455393.hot-update.js",
|
||||
"/js/main.81e0bda4a383bed7a7cb.hot-update.js": "/js/main.81e0bda4a383bed7a7cb.hot-update.js",
|
||||
"/js/main.e43e4e78edbbab166af3.hot-update.js": "/js/main.e43e4e78edbbab166af3.hot-update.js",
|
||||
"/js/main.6e5ccc4b12fbcde5f9a2.hot-update.js": "/js/main.6e5ccc4b12fbcde5f9a2.hot-update.js",
|
||||
"/js/main.852e77039e11331d2b75.hot-update.js": "/js/main.852e77039e11331d2b75.hot-update.js",
|
||||
"/js/main.7943dce133a3db64ce62.hot-update.js": "/js/main.7943dce133a3db64ce62.hot-update.js",
|
||||
"/js/main.57b5462076dd0836c98b.hot-update.js": "/js/main.57b5462076dd0836c98b.hot-update.js",
|
||||
"/js/main.5b5892a118e219e9cd0c.hot-update.js": "/js/main.5b5892a118e219e9cd0c.hot-update.js",
|
||||
"/js/main.6af3a3366db7e1113e88.hot-update.js": "/js/main.6af3a3366db7e1113e88.hot-update.js",
|
||||
"/js/main.6073e55a45f5e438e326.hot-update.js": "/js/main.6073e55a45f5e438e326.hot-update.js",
|
||||
"/js/main.20e9b71635ae419e9e2f.hot-update.js": "/js/main.20e9b71635ae419e9e2f.hot-update.js",
|
||||
"/js/main.2f599e69b98e849da14d.hot-update.js": "/js/main.2f599e69b98e849da14d.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.3516b34b8482490fb26b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.3516b34b8482490fb26b.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.9cdd3cc511801a35dbd1.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.9cdd3cc511801a35dbd1.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.e7ce1b323a6f505db42b.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.e7ce1b323a6f505db42b.hot-update.js",
|
||||
"/js/main.f2891ebfe5c12f67543b.hot-update.js": "/js/main.f2891ebfe5c12f67543b.hot-update.js",
|
||||
"/js/main.203f4b690856e2fea8fc.hot-update.js": "/js/main.203f4b690856e2fea8fc.hot-update.js",
|
||||
"/js/main.6ce298ef53f5947eb015.hot-update.js": "/js/main.6ce298ef53f5947eb015.hot-update.js",
|
||||
"/js/main.18bb244f129227d55df4.hot-update.js": "/js/main.18bb244f129227d55df4.hot-update.js",
|
||||
"/js/main.b9f41bec6466525008af.hot-update.js": "/js/main.b9f41bec6466525008af.hot-update.js",
|
||||
"/js/main.ad0419d91f0cb9ac4783.hot-update.js": "/js/main.ad0419d91f0cb9ac4783.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.47e373d236402278f9fe.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.47e373d236402278f9fe.hot-update.js",
|
||||
"/chunks/files~chunks/shared-files~chunks/shared-page.c8ea3ce9dc15d0d4870c.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.c8ea3ce9dc15d0d4870c.hot-update.js",
|
||||
"/js/main.50b137da3db67ef4e306.hot-update.js": "/js/main.50b137da3db67ef4e306.hot-update.js",
|
||||
"/js/main.c15998d32c0455bdba5f.hot-update.js": "/js/main.c15998d32c0455bdba5f.hot-update.js",
|
||||
"/js/main.dd3e98ec99ee3c91a3e2.hot-update.js": "/js/main.dd3e98ec99ee3c91a3e2.hot-update.js",
|
||||
"/js/main.b009b4752dbdf3c5614b.hot-update.js": "/js/main.b009b4752dbdf3c5614b.hot-update.js",
|
||||
"/js/main.a29bcf35ff442bbb48dc.hot-update.js": "/js/main.a29bcf35ff442bbb48dc.hot-update.js",
|
||||
"/js/main.02620d9ea73372cf1e92.hot-update.js": "/js/main.02620d9ea73372cf1e92.hot-update.js",
|
||||
"/js/main.cb392eeb311a3450efa6.hot-update.js": "/js/main.cb392eeb311a3450efa6.hot-update.js",
|
||||
"/js/main.7dc6c8021c7790a265ee.hot-update.js": "/js/main.7dc6c8021c7790a265ee.hot-update.js",
|
||||
"/js/main.95461813df3da7c29418.hot-update.js": "/js/main.95461813df3da7c29418.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -130,6 +130,14 @@
|
||||
: $t('context_menu.share')
|
||||
}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="menu-option" @click="shareCancel" v-if="this.fileInfoDetail.length > 1 && !multiSelectContextMenu">
|
||||
<div class="icon">
|
||||
<link-icon size="17"></link-icon>
|
||||
</div>
|
||||
<div class="text-label">
|
||||
{{$t('context_menu.share_cancel')}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="menu-option" @click="deleteItem">
|
||||
<div class="icon">
|
||||
@@ -404,6 +412,9 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
shareCancel() {
|
||||
this.$store.dispatch('shareCancel')
|
||||
},
|
||||
renameItem() {
|
||||
events.$emit('popup:open', { name: 'rename-item', item: this.item })
|
||||
},
|
||||
|
||||
@@ -226,17 +226,17 @@ export default {
|
||||
events.$emit("popup:open", { name: "move", item: this.fileInfoDetail });
|
||||
},
|
||||
shareItem() {
|
||||
if (this.fileInfoDetail) {
|
||||
if (this.fileInfoDetail[0]) {
|
||||
//ADD BY M
|
||||
if (this.fileInfoDetail.shared) {
|
||||
if (this.fileInfoDetail[0].shared) {
|
||||
events.$emit("popup:open", {
|
||||
name: "share-edit",
|
||||
item: this.fileInfoDetail,
|
||||
item: this.fileInfoDetail[0],
|
||||
});
|
||||
} else {
|
||||
events.$emit("popup:open", {
|
||||
name: "share-create",
|
||||
item: this.fileInfoDetail,
|
||||
item: this.fileInfoDetail[0],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
changePassword() {
|
||||
this.canChangePassword = false
|
||||
},
|
||||
destroySharing() {
|
||||
async destroySharing() {
|
||||
|
||||
// Set confirm button
|
||||
if (! this.isConfirmedDestroy) {
|
||||
@@ -170,18 +170,9 @@
|
||||
this.isDeleting = true
|
||||
|
||||
// Send delete request
|
||||
axios
|
||||
.post('/api/share/' + this.pickedItem.shared.token, {
|
||||
_method: 'delete'
|
||||
})
|
||||
.then(() => {
|
||||
// Remove item from file browser
|
||||
if ( this.isSharedLocation ) {
|
||||
this.$store.commit('REMOVE_ITEM', this.pickedItem.unique_id)
|
||||
}
|
||||
|
||||
// Flush shared data
|
||||
this.$store.commit('FLUSH_SHARED', this.pickedItem.unique_id)
|
||||
await this.$store.dispatch('shareCancel' , this.pickedItem)
|
||||
.then((response) => {
|
||||
|
||||
// End deleting spinner button
|
||||
setTimeout(() => this.isDeleting = false, 150)
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"rename": "重命名",
|
||||
"restore": "恢复文件",
|
||||
"share": "分享",
|
||||
"share_cancel": "Share Cancel",
|
||||
"share_edit": "编辑分享设定",
|
||||
"upload": "上传",
|
||||
"select": "Select"
|
||||
|
||||
@@ -275,6 +275,7 @@
|
||||
"rename": "Rename",
|
||||
"restore": "Restore",
|
||||
"share": "Share",
|
||||
"share_cancel": "Share Cancel",
|
||||
"share_edit": "Edit Sharing",
|
||||
"upload": "Upload",
|
||||
"select": "Select"
|
||||
|
||||
@@ -275,6 +275,7 @@
|
||||
"rename": "Premenovať",
|
||||
"restore": "Obnoviť",
|
||||
"share": "Zdieľať",
|
||||
"share_cancel": "Zrušenie zdieľania",
|
||||
"share_edit": "Upraviť zdieľanie",
|
||||
"upload": "Nahrať",
|
||||
"select": "Výber"
|
||||
|
||||
45
resources/js/store/modules/sharing.js
vendored
45
resources/js/store/modules/sharing.js
vendored
@@ -65,6 +65,51 @@ const actions = {
|
||||
})
|
||||
})
|
||||
},
|
||||
shareCancel: ({commit, getters} , singleItem) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
let cancelSharedFolders = []
|
||||
let items = [singleItem]
|
||||
|
||||
if(!singleItem) {
|
||||
items = getters.fileInfoDetail
|
||||
}
|
||||
|
||||
items.forEach((data) => {
|
||||
cancelSharedFolders.push({
|
||||
'token': data.shared.token
|
||||
})
|
||||
})
|
||||
|
||||
axios
|
||||
.post('/api/share/cancel', {
|
||||
_method: 'post',
|
||||
folders: cancelSharedFolders
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
items.forEach((item) => {
|
||||
|
||||
// Remove item from file browser
|
||||
if ( getters.currentFolder , getters.currentFolder.location === 'shared' ) {
|
||||
commit('REMOVE_ITEM', item.unique_id)
|
||||
}
|
||||
|
||||
// Flush shared data
|
||||
commit('FLUSH_SHARED', item.unique_id)
|
||||
|
||||
commit('CLEAR_FILEINFO_DETAIL')
|
||||
})
|
||||
resolve(true)
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
isSomethingWrong()
|
||||
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
getSingleFile: ({commit, state}) => {
|
||||
|
||||
let route = state.sharedDetail.protected
|
||||
|
||||
@@ -115,7 +115,7 @@ Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], func
|
||||
Route::post('/folders/favourites', 'FileFunctions\FavouriteController@store');
|
||||
|
||||
// Share
|
||||
Route::delete('/share/{token}', 'FileFunctions\ShareController@destroy');
|
||||
Route::post('/share/cancel', 'FileFunctions\ShareController@destroy');
|
||||
Route::patch('/share/{token}', 'FileFunctions\ShareController@update');
|
||||
Route::post('/share', 'FileFunctions\ShareController@store');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user