aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/components
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-08-05 12:56:11 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-09-03 09:03:09 +0200
commitf359529555fbf6fa344869d01f0b3c17ecce46c8 (patch)
treedbd2458d47cd6c585297930049fe7a8968390e12 /core/src/components
parent34aca4632574d153c716589a08497c0957b3679f (diff)
downloadnextcloud-server-f359529555fbf6fa344869d01f0b3c17ecce46c8.tar.gz
nextcloud-server-f359529555fbf6fa344869d01f0b3c17ecce46c8.zip
Allow unified search filtering
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/src/components')
-rw-r--r--core/src/components/UnifiedSearch/SearchFilter.vue77
-rw-r--r--core/src/components/UnifiedSearch/SearchResult.vue21
2 files changed, 98 insertions, 0 deletions
diff --git a/core/src/components/UnifiedSearch/SearchFilter.vue b/core/src/components/UnifiedSearch/SearchFilter.vue
new file mode 100644
index 00000000000..f3c06a24528
--- /dev/null
+++ b/core/src/components/UnifiedSearch/SearchFilter.vue
@@ -0,0 +1,77 @@
+ <!--
+ - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
+ -
+ - @author John Molakvoæ <skjnldsv@protonmail.com>
+ -
+ - @license GNU AGPL version 3 or any later version
+ -
+ - This program is free software: you can redistribute it and/or modify
+ - it under the terms of the GNU Affero General Public License as
+ - published by the Free Software Foundation, either version 3 of the
+ - License, or (at your option) any later version.
+ -
+ - This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+ -
+ -->
+<template>
+ <li>
+ <a :title="t('core', 'Search for {name} only', { name })"
+ class="unified-search__filter"
+ href="#"
+ @click.prevent="onClick">
+ {{ filter }}
+ </a>
+ </li>
+</template>
+
+<script>
+export default {
+ name: 'SearchFilter',
+
+ props: {
+ type: {
+ type: String,
+ required: true,
+ },
+ name: {
+ type: String,
+ required: true,
+ },
+ },
+ computed: {
+ filter() {
+ return `in:${this.type}`
+ },
+ },
+
+ methods: {
+ onClick() {
+ this.$emit('click', this.filter)
+ },
+ },
+
+}
+</script>
+
+<style lang="scss" scoped>
+.unified-search__filter {
+ height: 1em;
+ margin-right: 5px;
+ padding: 3px 8px;
+ border-radius: 1em;
+ background-color: var(--color-background-darker);
+
+ &:active,
+ &:focus,
+ &:hover {
+ background-color: var(--color-background-hover);
+ }
+}
+
+</style>
diff --git a/core/src/components/UnifiedSearch/SearchResult.vue b/core/src/components/UnifiedSearch/SearchResult.vue
index d5374832da9..025ddef86c0 100644
--- a/core/src/components/UnifiedSearch/SearchResult.vue
+++ b/core/src/components/UnifiedSearch/SearchResult.vue
@@ -1,3 +1,24 @@
+ <!--
+ - @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com>
+ -
+ - @author John Molakvoæ <skjnldsv@protonmail.com>
+ -
+ - @license GNU AGPL version 3 or any later version
+ -
+ - This program is free software: you can redistribute it and/or modify
+ - it under the terms of the GNU Affero General Public License as
+ - published by the Free Software Foundation, either version 3 of the
+ - License, or (at your option) any later version.
+ -
+ - This program 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 program. If not, see <http://www.gnu.org/licenses/>.
+ -
+ -->
<template>
<a :href="resourceUrl || '#'"
class="unified-search__result"