From 89fbaa159f29a7d175a5323eded29e20c9f3a752 Mon Sep 17 00:00:00 2001 From: marcin mikołajczak Date: Tue, 24 Sep 2024 00:05:33 +0200 Subject: Allow adding bookmarks to folders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../status_bookmark_folder_menu.js | 40 ++++++++++++++++++++++ .../status_bookmark_folder_menu.vue | 38 ++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js create mode 100644 src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue (limited to 'src/components/status_bookmark_folder_menu') diff --git a/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js new file mode 100644 index 00000000..16b414ac --- /dev/null +++ b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js @@ -0,0 +1,40 @@ +import { library } from '@fortawesome/fontawesome-svg-core' +import { faChevronRight } from '@fortawesome/free-solid-svg-icons' +import { mapState } from 'vuex' + +import DialogModal from '../dialog_modal/dialog_modal.vue' +import Popover from '../popover/popover.vue' + +library.add(faChevronRight) + +const StatusBookmarkFolderMenu = { + props: [ + 'status' + ], + data () { + return {} + }, + components: { + DialogModal, + Popover + }, + computed: { + ...mapState({ + folders: state => state.bookmarkFolders.allFolders + }), + folderId () { + return this.status.bookmark_folder_id + } + }, + methods: { + toggleFolder (id) { + const value = id === this.folderId ? null : id + + this.$store.dispatch('bookmark', { id: this.status.id, bookmark_folder_id: value }) + .then(() => this.$emit('onSuccess')) + .catch(err => this.$emit('onError', err.error.error)) + } + } +} + +export default StatusBookmarkFolderMenu diff --git a/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue new file mode 100644 index 00000000..48b7fe70 --- /dev/null +++ b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue @@ -0,0 +1,38 @@ + + + -- cgit v1.2.3-70-g09d2