Allow adding bookmarks to folders
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
9e45228823
commit
89fbaa159f
8 changed files with 99 additions and 5 deletions
|
|
@ -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
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<template>
|
||||
<div class="StatusBookmarkFolderMenu">
|
||||
<Popover
|
||||
trigger="hover"
|
||||
placement="left"
|
||||
remove-padding
|
||||
>
|
||||
<template #content>
|
||||
<div class="dropdown-menu">
|
||||
<button
|
||||
v-for="folder in folders"
|
||||
:key="folder.id"
|
||||
class="menu-item dropdown-item"
|
||||
@click="toggleFolder(folder.id)"
|
||||
>
|
||||
<span
|
||||
class="input menu-checkbox -radio"
|
||||
:class="{ 'menu-checkbox-checked': status.bookmark_folder_id == folder.id }"
|
||||
/>
|
||||
{{ folder.name }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<template #trigger>
|
||||
<button class="menu-item dropdown-item -has-submenu">
|
||||
{{ $t('bookmark_folders.select_folder') }}
|
||||
<FAIcon
|
||||
class="chevron-icon"
|
||||
size="lg"
|
||||
icon="chevron-right"
|
||||
/>
|
||||
</button>
|
||||
</template>
|
||||
</Popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./status_bookmark_folder_menu.js"></script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue