From 17c96acf04291f13595c3277e3d494fb1c04c11f Mon Sep 17 00:00:00 2001 From: Simon Ziegler Date: Wed, 12 Jun 2024 15:10:39 +0200 Subject: [PATCH] Added directory-creation to filedialogue --- README.md | 3 - .../FileDialogue/FileDialogue.vue | 139 ++++++++++++++---- .../FileDialogue/SongDialogue.vue | 4 + .../FileEditor/Psalm/PsalmEditor.vue | 9 ++ .../FileEditor/Song/SongEditor.vue | 9 ++ .../ControlWindow/Playlist/PlaylistItem.vue | 10 +- src/client/src/ControlWindow/SavePlaylist.vue | 9 ++ src/server/JCGPReceiveMessages.ts | 9 +- src/server/control.ts | 41 +++++- 9 files changed, 187 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 24c49f5..a8035b0 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,5 @@ Generate graphics with song-lyrics or for other church-service-elements and play - support other browser than Chrome and phone / tablet resolution - save_song(): check, wether "chords" is valid - reload psalm and song after file-edit -- FileDialogue: Create directories - Fix style of AddPart-Draggable-Drag-n-drop Placeholder -- SavePlaylist: create-directory-stack -- move config-file to yaml and create default-config-file with comments - repair new-file abort unsaved changes \ No newline at end of file diff --git a/src/client/src/ControlWindow/FileDialogue/FileDialogue.vue b/src/client/src/ControlWindow/FileDialogue/FileDialogue.vue index 81e9272..b0c8606 100644 --- a/src/client/src/ControlWindow/FileDialogue/FileDialogue.vue +++ b/src/client/src/ControlWindow/FileDialogue/FileDialogue.vue @@ -82,6 +82,7 @@ import Draggable from "vuedraggable"; import MenuButton from "@/ControlWindow/MenuBar/MenuButton.vue"; + import PopUp from "../PopUp.vue"; import type * as JCGPSend from "@server/JCGPSendMessages"; import type { ItemProps } from "@server/PlaylistItems/PlaylistItem"; @@ -92,7 +93,9 @@ fas.faChevronRight, fas.faArrowsRotate, fas.faFileCirclePlus, - fas.faXmark + fas.faXmark, + fas.faFolderPlus, + fas.faPlus ); const props = defineProps<{ @@ -103,11 +106,13 @@ hide_header?: boolean; clone_callback?: (arg: JCGPSend.ItemFiles["files"][0]) => ItemProps; new_button?: boolean; + new_directory?: boolean; search_disabled?: boolean; }>(); const emit = defineEmits<{ new_file: []; + new_directory: [path: string]; choose: [file: ItemFileMapped | undefined]; refresh_files: []; }>(); @@ -116,6 +121,9 @@ const search_strings = defineModel[]>("search_strings"); + const show_new_directory = ref(false); + const directory_name = ref(""); + const directory_name_input = ref(); const rotate_button = ref(false); const directory_stack = defineModel[]>("directory_stack", { default: () => reactive([]) @@ -157,6 +165,17 @@ emit("choose", file); } + + function on_new_directory() { + let directory = ""; + + if (directory_stack.value.length > 0) { + directory = directory_stack.value[directory_stack.value.length - 1].path + "/"; + } + + emit("new_directory", directory + directory_name.value); + show_new_directory.value = false; + } @@ -335,6 +386,7 @@ flex: 1; display: flex; flex-direction: column; + gap: inherit; } #search_wrapper { @@ -425,11 +477,30 @@ justify-content: center; } + #navigation_bar { + display: flex; + + gap: 0.25rem; + } + + #new_directory_wrapper { + background-color: var(--color-container); + border-radius: 0.25rem; + + display: flex; + align-items: center; + justify-content: center; + + aspect-ratio: 1; + max-height: 100%; + } + #directory_stack { background-color: var(--color-container); border-radius: 0.25rem; + flex: 1; display: flex; align-items: center; @@ -620,4 +691,10 @@ transform: rotate(180deg); } } + + #create_directory_popup { + display: flex; + + background-color: var(--color-container); + } diff --git a/src/client/src/ControlWindow/FileDialogue/SongDialogue.vue b/src/client/src/ControlWindow/FileDialogue/SongDialogue.vue index 4b2f6ca..ea3301e 100644 --- a/src/client/src/ControlWindow/FileDialogue/SongDialogue.vue +++ b/src/client/src/ControlWindow/FileDialogue/SongDialogue.vue @@ -13,11 +13,13 @@ select_dirs?: boolean; new_button?: boolean; hide_header?: boolean; + new_directory?: boolean; }>(); const emit = defineEmits<{ add: [item_props: SongProps]; new_song: []; + new_directory: [path: string]; }>(); // currently selected song @@ -175,6 +177,7 @@ :new_button="new_button" :select_dirs="select_dirs" :hide_header="hide_header" + :new_directory="new_directory" v-model:directory_stack="directory_stack" name="Song" v-model:selection="selection" @@ -182,6 +185,7 @@ @choose="add_song" @refresh_files="() => Globals.get_song_files(true)" @new_file="emit('new_song')" + @new_directory="(path: string) => emit('new_directory', path)" >