Commit b600b11 1 parent 019ce80 commit b600b11 Copy full SHA for b600b11
File tree 5 files changed +64
-8
lines changed
5 files changed +64
-8
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import Replace from './Replace'
19
19
import ReplaceRename from ' ./ReplaceRename'
20
20
import Share from ' ./Share'
21
21
import Upload from ' ./Upload'
22
+ import ShareDelete from ' ./ShareDelete'
22
23
import { mapState } from ' vuex'
23
24
import buttons from ' @/utils/buttons'
24
25
@@ -37,7 +38,8 @@ export default {
37
38
Help,
38
39
Replace,
39
40
ReplaceRename,
40
- Upload
41
+ Upload,
42
+ ShareDelete
41
43
},
42
44
data : function () {
43
45
return {
@@ -91,7 +93,8 @@ export default {
91
93
' replace' ,
92
94
' replace-rename' ,
93
95
' share' ,
94
- ' upload'
96
+ ' upload' ,
97
+ ' share-delete'
95
98
].indexOf (this .show ) >= 0 ;
96
99
97
100
return matched && this .show || null ;
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" card floating" >
3
+ <div class =" card-content" >
4
+ <p >{{ $t('prompts.deleteMessageShare', {path: hash.path}) }}</p >
5
+ </div >
6
+ <div class =" card-action" >
7
+ <button @click =" $store.commit('closeHovers')"
8
+ class =" button button--flat button--grey"
9
+ :aria-label =" $t('buttons.cancel')"
10
+ :title =" $t('buttons.cancel')" >{{ $t('buttons.cancel') }}</button >
11
+ <button @click =" submit"
12
+ class =" button button--flat button--red"
13
+ :aria-label =" $t('buttons.delete')"
14
+ :title =" $t('buttons.delete')" >{{ $t('buttons.delete') }}</button >
15
+ </div >
16
+ </div >
17
+ </template >
18
+
19
+ <script >
20
+ import {mapMutations , mapState } from ' vuex'
21
+ import { share as api } from ' @/api'
22
+ import buttons from ' @/utils/buttons'
23
+
24
+ export default {
25
+ name: ' share-delete' ,
26
+ computed: {
27
+ ... mapState ([' hash' ])
28
+ },
29
+ methods: {
30
+ ... mapMutations ([' closeHovers' ]),
31
+ submit : async function () {
32
+ buttons .loading (' delete' )
33
+
34
+ try {
35
+ await api .remove (this .hash .hash )
36
+ buttons .success (' delete' )
37
+
38
+ this .$root .$emit (' share-deleted' , this .hash .hash )
39
+ this .closeHovers ()
40
+ } catch (e) {
41
+ buttons .done (' delete' )
42
+ this .$showError (e)
43
+ }
44
+ }
45
+ }
46
+ }
47
+ </script >
Original file line number Diff line number Diff line change 115
115
"currentlyNavigating" : " Currently navigating on:" ,
116
116
"deleteMessageMultiple" : " Are you sure you want to delete {count} file(s)?" ,
117
117
"deleteMessageSingle" : " Are you sure you want to delete this file/folder?" ,
118
+ "deleteMessageShare" : " Are you sure you want to delete this share({path})?" ,
118
119
"deleteTitle" : " Delete files" ,
119
120
"displayName" : " Display Name:" ,
120
121
"download" : " Download files" ,
Original file line number Diff line number Diff line change 115
115
"currentlyNavigating" : " 当前目录:" ,
116
116
"deleteMessageMultiple" : " 你确定要删除这 {count} 个文件吗?" ,
117
117
"deleteMessageSingle" : " 你确定要删除这个文件/文件夹吗?" ,
118
+ "deleteMessageShare" : " 你确定要删除这个分享({path})吗?" ,
118
119
"deleteTitle" : " 删除文件" ,
119
120
"displayName" : " 名称:" ,
120
121
"download" : " 下载文件" ,
Original file line number Diff line number Diff line change @@ -73,19 +73,23 @@ export default {
73
73
this .clip .on (' success' , () => {
74
74
this .$showSuccess (this .$t (' success.linkCopied' ))
75
75
})
76
+ this .$root .$on (' share-deleted' , this .deleted )
76
77
},
77
78
beforeDestroy () {
78
79
this .clip .destroy ()
80
+ this .$root .$off (' share-deleted' , this .deleted )
79
81
},
80
82
methods: {
81
83
deleteLink : async function (event , link ) {
82
84
event .preventDefault ()
83
- try {
84
- await api .remove (link .hash )
85
- this .links = this .links .filter (item => item .hash !== link .hash )
86
- } catch (e) {
87
- this .$showError (e)
88
- }
85
+ this .$store .commit (' setHash' , {
86
+ hash: link .hash ,
87
+ path: link .path
88
+ })
89
+ this .$store .commit (' showHover' , ' share-delete' )
90
+ },
91
+ deleted (hash ) {
92
+ this .links = this .links .filter (item => item .hash !== hash)
89
93
},
90
94
humanTime (time ) {
91
95
return moment (time * 1000 ).fromNow ()
You can’t perform that action at this time.
0 commit comments