remove old search (not compatible to NC20)
This commit is contained in:
parent
937c08754b
commit
4ff70c7614
24
src/App.vue
24
src/App.vue
|
@ -13,7 +13,6 @@
|
|||
<NavigationList v-show="!loading.notes"
|
||||
:filtered-notes="filteredNotes"
|
||||
:category="filter.category"
|
||||
:search="filter.search"
|
||||
@category-selected="onSelectCategory"
|
||||
@note-deleted="onNoteDeleted"
|
||||
/>
|
||||
|
@ -45,7 +44,6 @@ import {
|
|||
Content,
|
||||
} from '@nextcloud/vue'
|
||||
import { showSuccess } from '@nextcloud/dialogs'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
import '@nextcloud/dialogs/styles/toast.scss'
|
||||
|
||||
import { config } from './config'
|
||||
|
@ -70,7 +68,6 @@ export default {
|
|||
return {
|
||||
filter: {
|
||||
category: null,
|
||||
search: '',
|
||||
},
|
||||
loading: {
|
||||
notes: true,
|
||||
|
@ -89,20 +86,12 @@ export default {
|
|||
},
|
||||
|
||||
filteredNotes() {
|
||||
const search = this.filter.search.toLowerCase()
|
||||
|
||||
const notes = this.notes.filter(note => {
|
||||
if (this.filter.category !== null
|
||||
&& this.filter.category !== note.category
|
||||
&& !note.category.startsWith(this.filter.category + '/')) {
|
||||
return false
|
||||
}
|
||||
const searchFields = ['title', 'category']
|
||||
if (search !== '') {
|
||||
return searchFields.some(
|
||||
searchField => note[searchField].toLowerCase().indexOf(search) !== -1
|
||||
)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
|
@ -128,9 +117,6 @@ export default {
|
|||
|
||||
created() {
|
||||
store.commit('setDocumentTitle', document.title)
|
||||
if (typeof OCA.Search === 'function') {
|
||||
this.search = new OCA.Search(this.onSearch, this.onResetSearch)
|
||||
}
|
||||
window.addEventListener('beforeunload', this.onClose)
|
||||
this.loadNotes()
|
||||
},
|
||||
|
@ -205,16 +191,6 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
onSearch(query) {
|
||||
this.filter.search = query
|
||||
|
||||
emit('toggle-navigation', { open: true })
|
||||
},
|
||||
|
||||
onResetSearch() {
|
||||
this.filter.search = ''
|
||||
},
|
||||
|
||||
onNewNote() {
|
||||
if (this.loading.create) {
|
||||
return
|
||||
|
|
|
@ -7,24 +7,6 @@
|
|||
@category-selected="$emit('category-selected', $event)"
|
||||
/>
|
||||
|
||||
<!-- search result header -->
|
||||
<AppNavigationCaption v-if="search && filteredNotes.length" :title="searchResultTitle" class="search-result-header" />
|
||||
|
||||
<!-- nothing found -->
|
||||
<li v-if="search && !filteredNotes.length" class="no-search-result">
|
||||
<span class="nav-entry">
|
||||
<div id="emptycontent" class="emptycontent-search">
|
||||
<div class="icon-search" />
|
||||
<h2 v-if="category!==null">
|
||||
{{ t('notes', 'No search result for “{search}” in {category}', { search: search, category: categoryTitle(category) }) }}
|
||||
</h2>
|
||||
<h2 v-else>
|
||||
{{ t('notes', 'No search result for “{search}”', { search: search }) }}
|
||||
</h2>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
<!-- list of notes -->
|
||||
<template v-for="item in noteItems">
|
||||
<AppNavigationCaption v-if="category!==null && category!==item.category"
|
||||
|
@ -92,10 +74,6 @@ export default {
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
search: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
@ -145,14 +123,6 @@ export default {
|
|||
noteItems() {
|
||||
return this.groupedNotes
|
||||
},
|
||||
|
||||
searchResultTitle() {
|
||||
if (this.category !== null) {
|
||||
return t('notes', 'Search result for “{search}” in {category}', { search: this.search, category: this.categoryTitle(this.category) })
|
||||
} else {
|
||||
return t('notes', 'Search result for “{search}”', { search: this.search })
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -209,23 +179,3 @@ export default {
|
|||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.search-result-header {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
li.no-search-result {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
li .nav-entry .emptycontent-search {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
@media (max-height: 600px) {
|
||||
li .nav-entry .emptycontent-search {
|
||||
margin-top: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue