-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Raimund Schlüßler <[email protected]>
- Loading branch information
1 parent
b0290df
commit 2419041
Showing
9 changed files
with
201 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<!-- | ||
Nextcloud - Tasks | ||
|
||
@author Raimund Schlüßler | ||
@copyright 2024 Raimund Schlüßler <raimund.schluessler@mailbox.org> | ||
|
||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or any later version. | ||
|
||
This library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public | ||
License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
--> | ||
|
||
<template> | ||
<NcActions class="filter reactive" | ||
force-menu | ||
:type="isFilterActive ? 'primary' : 'tertiary'" | ||
:title="t('tasks', 'Active filter')"> | ||
<template #icon> | ||
<span class="material-design-icon"> | ||
<FilterIcon v-if="isFilterActive" :size="20" /> | ||
<FilterOffIcon v-else :size="20" /> | ||
</span> | ||
</template> | ||
<NcActionInput type="multiselect" | ||
:label="t('tasks', 'Filter by tags')" | ||
track-by="id" | ||
:multiple="true" | ||
append-to-body | ||
:options="tags" | ||
:value="filter.tags" | ||
@input="setTags"> | ||
<template #icon> | ||
<TagMultiple :size="20" /> | ||
</template> | ||
{{ t('tasks', 'Select tags to filter by') }} | ||
</NcActionInput> | ||
<NcActionButton class="reactive" | ||
:close-after-click="true" | ||
@click="resetFilter"> | ||
<template #icon> | ||
<Close :size="20" /> | ||
</template> | ||
{{ t('tasks', 'Reset filter') }} | ||
</NcActionButton> | ||
</NcActions> | ||
</template> | ||
|
||
<script> | ||
import { translate as t } from '@nextcloud/l10n' | ||
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js' | ||
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js' | ||
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js' | ||
|
||
import Close from 'vue-material-design-icons/Close.vue' | ||
import FilterIcon from 'vue-material-design-icons/Filter.vue' | ||
import FilterOffIcon from 'vue-material-design-icons/FilterOff.vue' | ||
import TagMultiple from 'vue-material-design-icons/TagMultiple.vue' | ||
|
||
import { mapGetters, mapMutations } from 'vuex' | ||
|
||
export default { | ||
name: 'FilterDropdown', | ||
components: { | ||
NcActions, | ||
NcActionButton, | ||
NcActionInput, | ||
Close, | ||
FilterIcon, | ||
FilterOffIcon, | ||
TagMultiple, | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
tags: 'tags', | ||
filter: 'filter', | ||
}), | ||
isFilterActive() { | ||
return this.filter.tags.length | ||
}, | ||
}, | ||
methods: { | ||
t, | ||
...mapMutations(['setFilter']), | ||
|
||
setTags(tags) { | ||
const filter = this.filter | ||
filter.tags = tags | ||
this.setFilter(filter) | ||
}, | ||
|
||
resetFilter() { | ||
this.setFilter({ tags: [] }) | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
// overlay the sort direction icon with the sort order icon | ||
.material-design-icon { | ||
width: 44px; | ||
height: 44px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.