diff --git a/webapp/components/generic/SearchPost/SearchPost.vue b/webapp/components/generic/SearchPost/SearchPost.vue
index 97108afe8..b7657a3cf 100644
--- a/webapp/components/generic/SearchPost/SearchPost.vue
+++ b/webapp/components/generic/SearchPost/SearchPost.vue
@@ -11,7 +11,7 @@
{{ option.commentsCount }}
-
+
{{ option.shoutedCount }}
@@ -58,4 +58,9 @@ export default {
vertical-align: sub;
}
}
+.post-shouted {
+ width: 36px;
+ display: inline-block;
+ text-align: right;
+}
diff --git a/webapp/components/generic/SearchableInput/SearchableInput.vue b/webapp/components/generic/SearchableInput/SearchableInput.vue
index 0163ed393..8386c08af 100644
--- a/webapp/components/generic/SearchableInput/SearchableInput.vue
+++ b/webapp/components/generic/SearchableInput/SearchableInput.vue
@@ -10,11 +10,8 @@
>
-
+
-
+
@@ -82,7 +79,7 @@ export default {
value: '',
unprocessedSearchInput: '',
searchProcess: null,
- lastSearchTerm: '',
+ previousSearchTerm: '',
delay: 300,
}
},
@@ -91,16 +88,18 @@ export default {
return this.isActive && !this.pending ? this.$t('search.failed') : this.$t('search.hint')
},
isActive() {
- return !isEmpty(this.lastSearchTerm)
+ return !isEmpty(this.previousSearchTerm)
+ },
+ isFirstOfType() {
+ return function(option) {
+ return (
+ this.options.findIndex(o => o === option) ===
+ this.options.findIndex(o => o.__typename === option.__typename)
+ )
+ }
},
},
methods: {
- isFirstOfType(option) {
- return (
- this.options.findIndex(o => o === option) ===
- this.options.findIndex(o => o.__typename === option.__typename)
- )
- },
onFocus(event) {
clearTimeout(this.searchProcess)
this.isOpen = true
@@ -114,7 +113,7 @@ export default {
return
}
this.searchProcess = setTimeout(() => {
- this.lastSearchTerm = this.value
+ this.previousSearchTerm = this.value
this.$emit('query', this.value)
}, this.delay)
},
@@ -125,7 +124,7 @@ export default {
this.isOpen = false
clearTimeout(this.searchProcess)
if (!this.pending) {
- this.lastSearchTerm = this.unprocessedSearchInput
+ this.previousSearchTerm = this.unprocessedSearchInput
this.$emit('query', this.unprocessedSearchInput)
}
},
@@ -141,16 +140,13 @@ export default {
clear() {
this.isOpen = false
this.unprocessedSearchInput = ''
- this.lastSearchTerm = ''
+ this.previousSearchTerm = ''
this.searchValue = ''
this.$emit('clearSearch')
clearTimeout(this.searchProcess)
},
onBlur(event) {
- this.searchValue = this.lastSearchTerm
- // this.$nextTick(() => {
- // this.searchValue = this.lastSearchTerm
- // })
+ this.searchValue = this.previousSearchTerm
this.isOpen = false
clearTimeout(this.searchProcess)
},
@@ -158,33 +154,24 @@ export default {
this.isOpen = false
this.goToResource(item)
this.$nextTick(() => {
- this.searchValue = this.lastSearchTerm
+ this.searchValue = this.previousSearchTerm
})
},
+ isPost(item) {
+ return item.__typename === 'Post'
+ },
goToResource(item) {
this.$nextTick(() => {
- switch (item.__typename) {
- case 'Post':
- this.$router.push({
- name: 'post-id-slug',
- params: { id: item.id, slug: item.slug },
- })
- break
- case 'User':
- this.$router.push({
- name: 'profile-id-slug',
- params: { id: item.id, slug: item.slug },
- })
- break
- default:
- break
- }
+ this.$router.push({
+ name: this.isPost(item) ? 'post-id-slug' : 'profile-id-slug',
+ params: { id: item.id, slug: item.slug },
+ })
})
},
},
}
-