Merge branch 'fix/active-user-search-text-field' into 'develop'

#387 Activate user search text field after click button.

See merge request pleroma/pleroma-fe!608
This commit is contained in:
Shpuld Shpludson 2019-02-25 16:09:18 +00:00
commit dbf46942d0
4 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ const UserFinder = {
methods: { methods: {
findUser (username) { findUser (username) {
this.$router.push({ name: 'user-search', query: { query: username } }) this.$router.push({ name: 'user-search', query: { query: username } })
this.$refs.userSearchInput.focus()
}, },
toggleHidden () { toggleHidden () {
this.hidden = !this.hidden this.hidden = !this.hidden

View File

@ -4,7 +4,7 @@
<i class="icon-spin4 user-finder-icon animate-spin-slow" v-if="loading" /> <i class="icon-spin4 user-finder-icon animate-spin-slow" v-if="loading" />
<a href="#" v-if="hidden" :title="$t('finder.find_user')"><i class="icon-user-plus user-finder-icon" @click.prevent.stop="toggleHidden" /></a> <a href="#" v-if="hidden" :title="$t('finder.find_user')"><i class="icon-user-plus user-finder-icon" @click.prevent.stop="toggleHidden" /></a>
<template v-else> <template v-else>
<input class="user-finder-input" @keyup.enter="findUser(username)" v-model="username" :placeholder="$t('finder.find_user')" id="user-finder-input" type="text"/> <input class="user-finder-input" ref="userSearchInput" @keyup.enter="findUser(username)" v-model="username" :placeholder="$t('finder.find_user')" id="user-finder-input" type="text"/>
<button class="btn search-button" @click="findUser(username)"> <button class="btn search-button" @click="findUser(username)">
<i class="icon-search"/> <i class="icon-search"/>
</button> </button>

View File

@ -25,6 +25,7 @@ const userSearch = {
methods: { methods: {
newQuery (query) { newQuery (query) {
this.$router.push({ name: 'user-search', query: { query } }) this.$router.push({ name: 'user-search', query: { query } })
this.$refs.userSearchInput.focus()
}, },
search (query) { search (query) {
if (!query) { if (!query) {

View File

@ -4,7 +4,7 @@
{{$t('nav.user_search')}} {{$t('nav.user_search')}}
</div> </div>
<div class="user-search-input-container"> <div class="user-search-input-container">
<input class="user-finder-input" @keyup.enter="newQuery(username)" v-model="username" :placeholder="$t('finder.find_user')"/> <input class="user-finder-input" ref="userSearchInput" @keyup.enter="newQuery(username)" v-model="username" :placeholder="$t('finder.find_user')"/>
<button class="btn search-button" @click="newQuery(username)"> <button class="btn search-button" @click="newQuery(username)">
<i class="icon-search"/> <i class="icon-search"/>
</button> </button>