diff options
| author | fuyu <54523771+mfmfuyu@users.noreply.github.com> | 2020-02-08 13:09:38 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-08 13:09:38 +0900 |
| commit | 18458f418f96fa4fe5f45c9ec967ee5fa1089735 (patch) | |
| tree | 253ef722c9428debc5b8aec0372966c815ddc393 /src/client/components | |
| parent | Clean up (diff) | |
| download | misskey-18458f418f96fa4fe5f45c9ec967ee5fa1089735.tar.gz misskey-18458f418f96fa4fe5f45c9ec967ee5fa1089735.tar.bz2 misskey-18458f418f96fa4fe5f45c9ec967ee5fa1089735.zip | |
[wip] フォルダー名の変更と削除機能を実装 (#5874)
* フォルダーの削除機能を実装
* フォルダ名の変更を実装
* ダイアログの削除(v11準拠)とエラーメッセージを表示するように
* ダイアログのテキストのkeypathを変更
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/drive.vue | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue index 2279e2eb6e..8a4349ae35 100644 --- a/src/client/components/drive.vue +++ b/src/client/components/drive.vue @@ -319,6 +319,49 @@ export default Vue.extend({ }); }, + renameFolder(folder) { + this.$root.dialog({ + title: this.$t('contextmenu.rename-folder'), + input: { + placeholder: this.$t('contextmenu.input-new-folder-name'), + default: folder.name + } + }).then(({ canceled, result: name }) => { + if (canceled) return; + this.$root.api('drive/folders/update', { + folderId: folder.id, + name: name + }).then(folder => { + // FIXME: 画面を更新するために自分自身に移動 + this.move(folder); + }); + }); + }, + + deleteFolder(folder) { + this.$root.api('drive/folders/delete', { + folderId: folder.id + }).then(() => { + // 削除時に親フォルダに移動 + this.move(folder.parentId); + }).catch(err => { + switch(err.id) { + case 'b0fc8a17-963c-405d-bfbc-859a487295e1': + this.$root.dialog({ + type: 'error', + title: this.$t('unable-to-delete'), + text: this.$t('has-child-files-or-folders') + }); + break; + default: + this.$root.dialog({ + type: 'error', + text: this.$t('unable-to-delete') + }); + } + }); + }, + onChangeFileInput() { for (const file of Array.from((this.$refs.fileInput as any).files)) { this.upload(file, this.folder); |