Compare commits
1 Commits
b2c6a2e525
...
feature/#2
Author | SHA1 | Date | |
---|---|---|---|
350e09cf24 |
@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<ul class="pagination">
|
||||
<li
|
||||
class="page-item"
|
||||
:class="{ active: page === current }"
|
||||
v-for="page in pages"
|
||||
:key="page"
|
||||
>
|
||||
<span
|
||||
class="page-link pointer"
|
||||
@click="onPageClicked(page)"
|
||||
>
|
||||
{{ page }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'Paginator',
|
||||
props: {
|
||||
page: Number,
|
||||
current: Number,
|
||||
pages: Number
|
||||
},
|
||||
methods: {
|
||||
onPageClicked(page) {
|
||||
if (page == this.current) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$emit('page', page)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
@ -6,6 +6,20 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
<template>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li
|
||||
v-if="type == 'contacttype'"
|
||||
class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
Kontaktart
|
||||
<i class="bi bi-info-circle" v-tooltip="contactTypeTooltip"></i>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
Wert
|
||||
<i class="bi bi-info-circle" v-tooltip="contactContentTooltip"></i>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li
|
||||
class="list-group-item"
|
||||
v-for="(value, valueKey) in values"
|
||||
@ -102,6 +116,14 @@ export default {
|
||||
levelSelection: levelJson,
|
||||
languagesSelection: languagesJson,
|
||||
editableValues: this.values,
|
||||
contactTypeTooltip: {
|
||||
content: 'Kontaktart z.B. E-Mail, Matrix, Twitter etc...',
|
||||
html: true
|
||||
},
|
||||
contactContentTooltip: {
|
||||
content: 'Wert: zB.: beate@beispiel.de, @beate:beispiel.de, beate_beispiel',
|
||||
html: true
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -12,10 +12,8 @@ export default {
|
||||
profiles: [],
|
||||
error: false,
|
||||
errorMessage: '',
|
||||
pages: 1,
|
||||
query: {
|
||||
search: '',
|
||||
page: 1
|
||||
search: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -43,12 +41,6 @@ export default {
|
||||
},
|
||||
setQuerySearch(state, search) {
|
||||
state.query.search = search
|
||||
},
|
||||
setPages(state, pages) {
|
||||
state.pages = pages
|
||||
},
|
||||
setQueryPage(state, page) {
|
||||
state.query.page = page
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@ -73,8 +65,6 @@ export default {
|
||||
url.searchParams.append('search', state.query.search)
|
||||
}
|
||||
|
||||
url.searchParams.append('page', state.query.page)
|
||||
|
||||
const headers = {
|
||||
Authorization: `Bearer ${rootState.token}`,
|
||||
}
|
||||
@ -103,7 +93,6 @@ export default {
|
||||
|
||||
const responseData = await response.json()
|
||||
commit('setProfiles', responseData.profiles)
|
||||
commit('setPages', responseData.pages)
|
||||
commit('setSearching', false)
|
||||
commit('hideSpinner')
|
||||
}
|
||||
|
@ -53,26 +53,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
<p v-if="searchText !== ''">Probiere eine andere Suche.</p>
|
||||
</div>
|
||||
<div v-else-if="showResults">
|
||||
<div class="d-flex justify-content-around">
|
||||
<Paginator
|
||||
:pages="pages"
|
||||
:current="currentPage"
|
||||
@page="handlePageSelected"
|
||||
/>
|
||||
</div>
|
||||
<SearchResult
|
||||
v-for="profile in profiles"
|
||||
:key="profile.user_id"
|
||||
class="mb-3"
|
||||
:profile="profile"
|
||||
/>
|
||||
<div class="d-flex justify-content-around">
|
||||
<Paginator
|
||||
:pages="pages"
|
||||
:current="currentPage"
|
||||
@page="handlePageSelected"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -81,29 +67,21 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
import Paginator from '@/components/Paginator'
|
||||
import SearchResult from '@/components/SearchResult'
|
||||
import Spinner from '@/components/Spinner'
|
||||
|
||||
export default {
|
||||
name: 'Search',
|
||||
components: {
|
||||
Paginator,
|
||||
SearchResult,
|
||||
Spinner,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
textChanged: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
searching: state => state.search.searching,
|
||||
profiles: state => state.search.profiles,
|
||||
error: state => state.search.error,
|
||||
showSpinner: state => state.search.showSpinner,
|
||||
pages: state => state.search.pages,
|
||||
}),
|
||||
searchText: {
|
||||
get() {
|
||||
@ -111,15 +89,6 @@ export default {
|
||||
},
|
||||
set(text) {
|
||||
this.$store.commit('search/setQuerySearch', text)
|
||||
this.textChanged = true
|
||||
}
|
||||
},
|
||||
currentPage: {
|
||||
get() {
|
||||
return this.$store.state.search.query.page
|
||||
},
|
||||
set(page) {
|
||||
this.$store.commit('search/setQueryPage', page)
|
||||
}
|
||||
},
|
||||
showNoResults() {
|
||||
@ -140,24 +109,13 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleSubmit() {
|
||||
if (this.textChanged === true) {
|
||||
this.$store.commit('search/setQueryPage', 1)
|
||||
}
|
||||
this.pushState()
|
||||
this.$router.push({ query: { query: this.searchText }})
|
||||
this.$store.dispatch('search/search')
|
||||
},
|
||||
focusSearchText() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.searchTextInput.focus()
|
||||
})
|
||||
},
|
||||
handlePageSelected(page) {
|
||||
this.currentPage = page
|
||||
this.pushState()
|
||||
this.$store.dispatch('search/search')
|
||||
},
|
||||
pushState() {
|
||||
this.$router.push({ query: { query: this.searchText, page: this.currentPage }})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -167,7 +167,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
<auto-complete
|
||||
type="contacttype"
|
||||
:values="profile.contacts"
|
||||
placeholder="z.B. E-Mail, Mobiltelefon, Matrix, Web"
|
||||
placeholder="Zuerst Kontaktart: E-Mail, Matrix, Web, etc.."
|
||||
@update-values="profile.contacts = $event"
|
||||
></auto-complete>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user