Compare commits

..

4 Commits

Author SHA1 Message Date
fd07373d43 implement profile view
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-10-03 17:56:52 +02:00
e6e44d5de8 redirect users with token #38 2021-09-24 17:51:37 +02:00
c3cc51dbf9 implement seach view autofocus #41 2021-09-24 17:45:11 +02:00
9906e32f45 add login page name field autofocus #42 2021-09-24 17:39:24 +02:00
18 changed files with 7084 additions and 8669 deletions

View File

@ -4,95 +4,11 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
kind: pipeline kind: pipeline
type: docker type: docker
name: qa name: default
trigger:
event:
- push
- pull_request
branch:
- main
steps: steps:
- name: reuse - name: reuse
image: fsfe/reuse image: fsfe/reuse:latest
- name: lint
image: node:20
commands:
- npm ci
- npm run lint
---
kind: pipeline
type: docker
name: build
trigger:
event:
- push
branch:
- main
depends_on:
- qa
steps:
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-frontend
target: ki-frontend
auto_tag: true
username:
from_secret: "docker_username"
password:
from_secret: "docker_password"
---
kind: pipeline
type: docker
name: deploy
trigger:
event:
- push
branch:
- main
depends_on:
- build
steps:
- name: deploy-dev
image: appleboy/drone-ssh
settings:
host:
- dev01.wtf-eg.net
username: drone_deployment
key:
from_secret: "dev01_deployment_key"
command_timeout: 2m
script:
- echo "Executing forced command..."
---
kind: pipeline
type: docker
name: tag-release
trigger:
event:
- tag
steps:
- name: reuse
image: fsfe/reuse
- name: lint
image: node:20
commands:
- npm ci
- npm run lint
- name: docker-publish - name: docker-publish
image: plugins/docker image: plugins/docker
settings: settings:

14747
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,10 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "^4.5.0", "@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "^4.5.0", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "^4.5.0", "@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0", "@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"bootstrap": "^5.0.1", "bootstrap": "^5.0.1",
@ -20,7 +20,6 @@
"eslint-plugin-vue": "^7.0.0", "eslint-plugin-vue": "^7.0.0",
"sass": "^1.37.5", "sass": "^1.37.5",
"sass-loader": "^10.2.0", "sass-loader": "^10.2.0",
"v-tooltip": "^4.0.0-alpha.1",
"vue": "^3.0.0", "vue": "^3.0.0",
"vue-router": "^4.0.0-0", "vue-router": "^4.0.0-0",
"vuex": "^4.0.2" "vuex": "^4.0.2"

View File

@ -1,6 +1,6 @@
{ {
"1": "Keine Angabe", "1": "Keine Angabe",
"2": "Grundkenntnisse", "2": "Grundkentnisse",
"3": "Gut", "3": "Gut",
"4": "Fließend", "4": "Fließend",
"5": "Muttersprache" "5": "Muttersprache"

View File

@ -5,46 +5,21 @@ SPDX-License-Identifier: AGPL-3.0-or-later
--> -->
<template> <template>
<profile-list <div>
:values="values" <label for="searchText" class="form-label fw-bold">{{ label }}</label>
:type="type" <div class="row mb-2">
:editable="true" <div class="col">
:show-secondary="showSecondary"
@remove-value="removeValue($event)"
@update-values="this.$emit('update-values', this.values)"
>
</profile-list>
<div v-bind="$attrs" class="card-body">
<div class="row">
<div class="col-12 col-md-4 col-lg-3 col-xl-2">
<div class="form-control-plaintext form-control-sm">Eintrag hinzufügen:</div>
</div>
<div class="col-12 col-md-6">
<input <input
autocomplete="off" autocomplete="off"
type="text" type="text"
class="form-control form-control-sm" class="form-control"
id="searchText" id="searchText"
:maxlength="maxlength"
:placeholder="placeholder"
v-model="searchText" v-model="searchText"
@input="search()" @keyup="search()"
@keyup.enter="addResult()" @keyup.enter="addResult()"
/> />
<div v-if="searchResults">
<ul class="list-group">
<li
class="list-group-item"
v-for="result in searchResults"
:key="result.id"
@click="addResult(result)"
>
{{ result.name }}
</li>
</ul>
</div> </div>
</div> <div class="col">
<div class="col-md-2">
<button <button
v-if="searchText != ''" v-if="searchText != ''"
type="button" type="button"
@ -57,16 +32,36 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</button> </button>
</div> </div>
</div> </div>
<div class="" v-if="searchResults">
<ul class="list-group">
<li
class="list-group-item"
v-for="result in searchResults"
:key="result.id"
@click="addResult(result)"
>
{{ result.name }}
</li>
</ul>
</div>
<profile-list
:values="values"
:type="type"
:editable="true"
@remove-value="removeValue($event)"
@update-values="this.$emit('update-values', this.values)"
>
</profile-list>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import RequestMixin from '@/mixins/request.mixin' import RequestMixin from "@/mixins/request.mixin"
import ProfileList from '@/components/ProfileList'; import ProfileList from "@/components/ProfileList";
export default { export default {
name: 'AutoComplete', name: "AutoComplete",
mixins: [RequestMixin], mixins: [RequestMixin],
components: { components: {
ProfileList, ProfileList,
@ -81,33 +76,21 @@ export default {
values: { values: {
type: Array, type: Array,
}, },
showSecondary: {
type: Boolean,
default: true,
},
placeholder: {
type: String,
default: "",
},
}, },
data() { data() {
return { return {
iconUrl: this.apiUrl, iconUrl: this.apiUrl,
searchText: '', searchText: "",
searchResults: [], searchResults: [],
showErrorMessage: false, showErrorMessage: false,
}; };
}, },
computed: { computed: {
...mapState(['currentUserId']), ...mapState(['currentUserId'])
maxlength() {
return this.type === 'skill' ? 50 : 25
}
}, },
methods: { methods: {
addResult(result = false) { addResult(result = false) {
if (!result) result = this.searchResults[0]; if (!result) result = this.searchResults[0];
if ( if (
this.values.map((item) => item[this.type].name).includes(result.name) this.values.map((item) => item[this.type].name).includes(result.name)
) { ) {
@ -118,19 +101,16 @@ export default {
let newValue = { let newValue = {
profile_id: this.currentUserId, profile_id: this.currentUserId,
}; };
if (this.type != "contacttype") {
if (this.type != 'contacttype') {
newValue.level = 1; newValue.level = 1;
} else { } else {
newValue.content = ''; newValue.content = "";
} }
newValue[this.type] = result; newValue[this.type] = result;
changeValues.unshift(newValue); changeValues.unshift(newValue);
this.searchText = "";
this.searchText = '';
this.searchResults = []; this.searchResults = [];
this.$emit('update-values', changeValues); this.$emit("update-values", changeValues);
}, },
removeValue(valueName) { removeValue(valueName) {
const newValues = this.values.filter((value) => { const newValues = this.values.filter((value) => {
@ -140,7 +120,7 @@ export default {
return true; return true;
} }
}); });
this.$emit('update-values', newValues); this.$emit("update-values", newValues);
}, },
}, },
}; };

View File

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<div class="fw-bold text-white mb-2">Kompetenzinventar</div> <div class="fw-bold text-white mb-2">Kompetenzinventar</div>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li><a href="https://git.wtf-eg.de/kompetenzinventar">Quellcode</a></li> <li><a href="https://git.wtf-eg.de/kompetenzinventar">Quellcode</a></li>
<li><a href="https://git.wtf-eg.de/kompetenzinventar/ki-doku/issues/new/choose">Problem melden</a></li> <li><a href="https://git.wtf-eg.de/kompetenzinventar/ki-frontend/issues/new">Problem melden</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -1,49 +0,0 @@
<!--
SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<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>

View File

@ -5,27 +5,24 @@ SPDX-License-Identifier: AGPL-3.0-or-later
--> -->
<template> <template>
<ul class="list-group list-group-flush"> <ul>
<li <li v-for="(value, valueKey) in values" :key="value.id">
class="list-group-item" <div class="row m-1">
v-for="(value, valueKey) in values" <div class="col">
:key="value.id" <img
> style="max-width: 64px"
<div class="row">
<div class="col-12 col-md-5 d-flex align-items-center">
<div
class="list-icon me-1"
:style="{ backgroundImage: `url('${iconBaseUrl + value[type].icon_url}'` }"
v-if="value[type].icon_url" v-if="value[type].icon_url"
:src="iconUrl + value[type].icon_url"
:alt="`${value[type].name} Logo`"
/> />
<div>
{{ value[type].name }} {{ value[type].name }}
</div> </div>
</div> <div class="col">
<div class="col-10 col-md-5"> <div v-if="type == 'skill'">
<div v-if="type == 'skill' && showSecondary"> <div v-if="editable">
<select <select
class="form-select form-select-sm" v-if="editableValues[valueKey]"
class="form-select"
aria-label="Selektiere dein Level" aria-label="Selektiere dein Level"
v-model="editableValues[valueKey].level" v-model="editableValues[valueKey].level"
@input="$emit('update-values', editableValues)" @input="$emit('update-values', editableValues)"
@ -39,9 +36,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</option> </option>
</select> </select>
</div> </div>
<div v-else><span v-if="value.level">({{ levelSelection[value.level] }})</span></div>
</div>
<div v-else-if="type == 'language'"> <div v-else-if="type == 'language'">
<div v-if="editable">
<div v-if="editable">
<select <select
class="form-select form-select-sm" v-if="editableValues[valueKey]"
class="form-select"
aria-label="Selektiere dein Level" aria-label="Selektiere dein Level"
v-model="editableValues[valueKey].level" v-model="editableValues[valueKey].level"
@input="$emit('update-values', editableValues)" @input="$emit('update-values', editableValues)"
@ -55,22 +57,32 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</option> </option>
</select> </select>
</div> </div>
</div>
<div v-else><span v-if="value.level">({{languagesSelection[value.level]}})</span></div>
</div>
<div v-else-if="type == 'contacttype'"> <div v-else-if="type == 'contacttype'">
<input <div v-if="editable">
class="form-control form-control-sm" <input class="form-control" v-model="editableValues[valueKey].content"/>
maxlength="200" </div>
v-model="editableValues[valueKey].content" <div v-else>
/> <span v-if="value[type].name === 'E-Mail'">
<a :href="`mailto:${value.content}`">{{ value.content }}</a>
</span>
<span v-else>
{{ value.content }}
</span>
</div> </div>
</div> </div>
<div class="col-2 text-end"> </div>
<div class="col">
<button <button
v-if="editable"
type="button" type="button"
class="btn btn-sm btn-light" class="btn btn-outline-danger"
aria-label="Löschen" aria-label="Löschen"
@click="$emit('removeValue', value[type].name)" @click="$emit('removeValue', value[type].name)"
> >
<i class="text-danger bi bi-x-circle"></i> <i class="bi-trash"></i>
</button> </button>
</div> </div>
</div> </div>
@ -91,14 +103,14 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
showSecondary: { editable: {
type: Boolean, type: Boolean,
default: true default: false,
} },
}, },
data() { data() {
return { return {
iconBaseUrl: this.apiUrl, iconUrl: this.apiUrl,
levelSelection: levelJson, levelSelection: levelJson,
languagesSelection: languagesJson, languagesSelection: languagesJson,
editableValues: this.values, editableValues: this.values,
@ -111,13 +123,3 @@ export default {
}, },
}; };
</script> </script>
<style scope>
.list-icon {
background-position: center center;
background-repeat: no-repeat;
background-size: contain;
height: 32px;
width: 32px;
}
</style>

View File

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<template> <template>
<div class="skill rounded me-2"> <div class="skill rounded me-2">
<div class="skill__left p-2"> <div class="skill__left px-2">
<div class="skill__icon" :style="{ backgroundImage: iconUrl }"></div> <div class="skill__icon" :style="{ backgroundImage: iconUrl }"></div>
</div> </div>
<div class="skill__right d-flex align-items-center rounded-end px-2"> <div class="skill__right d-flex align-items-center rounded-end px-2">

View File

@ -16,14 +16,6 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</span> </span>
</div> </div>
</div> </div>
<div v-if="profile?.address?.name">
<div class="d-flex align-items-center">
<i class="fs-4 bi bi-person-fill text-dark mx-2"></i>
<div class="text-white">
a.k.a. {{ profile.address.name }}
</div>
</div>
</div>
<div v-if="location"> <div v-if="location">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<i class="fs-4 bi bi-geo-alt-fill text-dark mx-2"></i> <i class="fs-4 bi bi-geo-alt-fill text-dark mx-2"></i>

View File

@ -10,11 +10,9 @@ SPDX-License-Identifier: AGPL-3.0-or-later
{{ title }} {{ title }}
</h3> </h3>
<div class="card w-100"> <div class="card w-100">
<slot name="card-body"> <div class="card-body lh-1">
<div class="card-body">
<slot></slot> <slot></slot>
</div> </div>
</slot>
</div> </div>
</div> </div>
</template> </template>

View File

@ -6,15 +6,12 @@ import { createApp } from 'vue/dist/vue.esm-bundler'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import store from '@/store' import store from '@/store'
import VTooltipPlugin from 'v-tooltip'
import 'v-tooltip/dist/v-tooltip.css'
import 'bootstrap-icons/font/bootstrap-icons.css' import 'bootstrap-icons/font/bootstrap-icons.css'
import './assets/global.scss' import './assets/global.scss'
const app = createApp(App) const app = createApp(App)
app.use(VTooltipPlugin)
app.use(router) app.use(router)
app.use(store) app.use(store)

View File

@ -37,11 +37,6 @@ export default {
} }
}, },
async search() { async search() {
if (!this.searchText) {
this.searchResults = []
return
}
try { try {
const response = await fetch(`${this.apiUrl}/${this.type}s?search=${this.searchText}`, { const response = await fetch(`${this.apiUrl}/${this.type}s?search=${this.searchText}`, {
headers: { headers: {
@ -57,16 +52,15 @@ export default {
} }
const responseData = await response.json() const responseData = await response.json()
const searchResults = responseData[`${this.type}s`]; this.searchResults = responseData[`${this.type}s`];
if ( if (
!searchResults.map((item) => item.name.toLowerCase()) !this.values
.map((item) => item[this.type].name.toLowerCase())
.includes(this.searchText.toLowerCase()) .includes(this.searchText.toLowerCase())
) { ) {
searchResults.unshift({ name: this.searchText }); this.searchResults.unshift({ name: this.searchText });
} }
this.searchResults = searchResults
} catch (error) { } catch (error) {
console.error(); console.error();
this.showErrorMessage = true; this.showErrorMessage = true;

View File

@ -54,20 +54,17 @@ export default {
} }
}, },
actions: { actions: {
onError({commit, dispatch}) { onError({commit}) {
commit('setError') commit('setError')
dispatch('clear') commit('clearProfileId')
commit('clearProfile')
commit('setNotLoading')
commit('hideSpinner')
}, },
onNotFound({commit, dispatch}) { onNotFound({commit, dispatch}) {
dispatch('onError') dispatch('onError')
commit('setNotFound', true) commit('setNotFound', true)
}, },
clear({commit}) {
commit('clearProfileId')
commit('clearProfile')
commit('hideSpinner')
commit('setNotLoading')
},
async load({state, commit, dispatch, rootState}, profileId) { async load({state, commit, dispatch, rootState}, profileId) {
if (state.loading) { if (state.loading) {
return return
@ -114,7 +111,7 @@ export default {
const responseData = await response.json() const responseData = await response.json()
commit('setProfile', responseData.profile) commit('setProfile', responseData.profile)
commit('hideSpinner') commit('hideSpinner')
commit('setNotLoading') commit('setNotSearching')
} }
} }
} }

View File

@ -12,10 +12,8 @@ export default {
profiles: [], profiles: [],
error: false, error: false,
errorMessage: '', errorMessage: '',
pages: 1,
query: { query: {
search: '', search: ''
page: 1
} }
} }
}, },
@ -42,17 +40,11 @@ export default {
state.errorMessage = errorMessage state.errorMessage = errorMessage
}, },
setQuerySearch(state, search) { setQuerySearch(state, search) {
state.query = {...state.query, search} state.query.search = search
},
setPages(state, pages) {
state.pages = pages
},
setQueryPage(state, page) {
state.query = {...state.query, page}
} }
}, },
actions: { actions: {
async search({state, commit, rootState, dispatch}) { async search({state, commit, rootState}) {
if (state.searching) { if (state.searching) {
return return
} }
@ -73,8 +65,6 @@ export default {
url.searchParams.append('search', state.query.search) url.searchParams.append('search', state.query.search)
} }
url.searchParams.append('page', state.query.page)
const headers = { const headers = {
Authorization: `Bearer ${rootState.token}`, Authorization: `Bearer ${rootState.token}`,
} }
@ -91,19 +81,8 @@ export default {
return return
} }
console.log(response.ok)
console.log(response.status)
console.log(state.query.page)
clearTimeout(timeoutId) clearTimeout(timeoutId)
if (!response.ok && response.status === 404 && state.query.page != 1) {
commit('setQueryPage', 1)
commit('setSearching', false)
await dispatch('search')
return
}
if (!response.ok) { if (!response.ok) {
commit('setError', true) commit('setError', true)
commit('clearProfiles') commit('clearProfiles')
@ -114,7 +93,6 @@ export default {
const responseData = await response.json() const responseData = await response.json()
commit('setProfiles', responseData.profiles) commit('setProfiles', responseData.profiles)
commit('setPages', responseData.pages)
commit('setSearching', false) commit('setSearching', false)
commit('hideSpinner') commit('hideSpinner')
} }

View File

@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
class="form-control" class="form-control"
id="searchText" id="searchText"
v-model="searchText" v-model="searchText"
placeholder="Nick, Name, Fähigkeit, Sprache" placeholder="Nick, Fähigkeit, Sprache"
ref="searchTextInput" ref="searchTextInput"
/> />
</div> </div>
@ -53,26 +53,12 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<p v-if="searchText !== ''">Probiere eine andere Suche.</p> <p v-if="searchText !== ''">Probiere eine andere Suche.</p>
</div> </div>
<div v-else-if="showResults"> <div v-else-if="showResults">
<div class="d-flex justify-content-around">
<Paginator
:pages="pages"
:current="currentPage"
@page="handlePageSelected"
/>
</div>
<SearchResult <SearchResult
v-for="profile in profiles" v-for="profile in profiles"
:key="profile.user_id" :key="profile.user_id"
class="mb-3" class="mb-3"
:profile="profile" :profile="profile"
/> />
<div class="d-flex justify-content-around">
<Paginator
:pages="pages"
:current="currentPage"
@page="handlePageSelected"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -81,29 +67,21 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Paginator from '@/components/Paginator'
import SearchResult from '@/components/SearchResult' import SearchResult from '@/components/SearchResult'
import Spinner from '@/components/Spinner' import Spinner from '@/components/Spinner'
export default { export default {
name: 'Search', name: 'Search',
components: { components: {
Paginator,
SearchResult, SearchResult,
Spinner, Spinner,
}, },
data() {
return {
textChanged: false
}
},
computed: { computed: {
...mapState({ ...mapState({
searching: state => state.search.searching, searching: state => state.search.searching,
profiles: state => state.search.profiles, profiles: state => state.search.profiles,
error: state => state.search.error, error: state => state.search.error,
showSpinner: state => state.search.showSpinner, showSpinner: state => state.search.showSpinner,
pages: state => state.search.pages,
}), }),
searchText: { searchText: {
get() { get() {
@ -111,15 +89,6 @@ export default {
}, },
set(text) { set(text) {
this.$store.commit('search/setQuerySearch', 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() { showNoResults() {
@ -140,37 +109,20 @@ export default {
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
if (this.textChanged === true) {
this.$store.commit('search/setQueryPage', 1)
}
this.pushState()
this.$store.dispatch('search/search') this.$store.dispatch('search/search')
}, },
focusSearchText() { focusSearchText() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.searchTextInput.focus() 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() { created() {
if (this.$route.query.query) { if (this.$route.query.query !== undefined) {
this.searchText = this.$route.query.query this.searchText = this.$route.query.query
this.$store.commit('search/clearProfiles') this.$store.commit('search/clearProfiles')
} }
if (this.$route.query.page) {
this.currentPage = parseInt(this.$route.query.page, 10)
this.$store.commit('search/clearProfiles')
}
this.$store.dispatch('search/search') this.$store.dispatch('search/search')
} }
}; };

View File

@ -5,260 +5,190 @@ SPDX-License-Identifier: AGPL-3.0-or-later
--> -->
<template> <template>
<div>
<div class="bg-wtf py-3 mb-4">
<div class="container">
<h3 class="text-white text-center mb-0">Profil bearbeiten</h3>
</div>
</div>
<div class="container"> <div class="container">
<h1>Profil bearbeiten</h1>
<form @submit.prevent="submitFormEdit()"> <form @submit.prevent="submitFormEdit()">
<Section title="Grunddaten"> <div class="row">
<div class="mb-4"> <div class="col">
<div class="form-check form-switch">
<input <input
class="form-check-input" type="radio"
type="checkbox" id="false"
role="switch" :value="false"
v-model="profile.visible" v-model="profile.visible"
id="visibility" class="mr-2"
> />
<label <label for="false" class="m-2 fw-bold"> Nicht öffentlich</label>
class="form-check-label" </div>
for="visibility"> <div class="col">
Profil für angemeldete Benutzer sichtbar <input
</label> type="radio"
id="true"
:value="true"
v-model="profile.visible"
/>
<label for="true" class="m-2 fw-bold"> Öffentlich</label>
</div> </div>
</div> </div>
<div id="visibilityHelp" class="form-text">
<div class="row mb-4"> Erst wenn du dein Profil Öffentlich stellst, können andere Genoss:innen
<div class="col-12 col-md-4 mb-3 mb-md-0"> darauf zugreifen oder es in der Suche finden.
<label class="form-label">Nickname</label> </div>
<div class="row">
<div class="col-6 col-xs-12">
<label for="nickname" class="form-label fw-bold">Nickname:</label>
<input <input
type="text" type="text"
class="form-control" class="form-control"
id="nickname" id="nickname"
maxlength="25"
v-model="profile.nickname" v-model="profile.nickname"
required required
/> />
</div> </div>
<div class="col-12 col-md-4 mb-3 mb-md-0"> <div class="col-6 col-xs-12">
<label class="form-label">Klarname (optional)</label> <label for="pronouns" class="form-label fw-bold">Pronomen:</label>
<input
type="text"
class="form-control"
id="realname"
maxlength="25"
v-model="profile.address.name"
/>
</div>
<div class="col-12 col-md-4">
<label class="form-label">
Pronomen
<i class="bi bi-info-circle" v-tooltip="pronounsTooltip"></i>
</label>
<input <input
type="text" type="text"
class="form-control" class="form-control"
id="pronouns" id="pronouns"
maxlength="25"
v-model="profile.pronouns" v-model="profile.pronouns"
/> />
<div for="pronouns" class="form-text">
Z.B.: Er/Ihn, Sie/Ihr, Es etc..
</div>
</div> </div>
</div> </div>
<label class="form-label">Anschrift</label>
<div class="row"> <div class="row">
<div class="col-12 col-md-4 mb-3 mb-md-0"> <div class="col-12 col-xs-12">
<input <label for="freetext" class="form-label fw-bold">Vorstellung:</label>
type="text" <textarea
class="form-control" class="form-control"
id="postcode" id="freetext"
maxlength="10" rows="3"
placeholder="Postleitzahl" v-model="profile.freetext"
v-model="profile.address.postcode" ></textarea>
/>
</div> </div>
<div class="col-12 col-md-4 mb-3 mb-md-0"> <div class="col-12 col-xs-12">
<input <label for="volunteerwork" class="form-label fw-bold"
type="text" >Ehrenamtliche Arbeit:</label
>
<textarea
class="form-control" class="form-control"
id="city" id="volunteerwork"
maxlength="25" rows="3"
placeholder="Ort" v-model="profile.volunteerwork"
v-model="profile.address.city" ></textarea>
/>
</div>
<div class="col-12 col-md-4">
<input
type="text"
class="form-control"
id="country"
maxlength="25"
placeholder="Land"
v-model="profile.address.country"
/>
</div> </div>
</div> </div>
</Section>
<Section title="Meine Fähigkeiten">
<template v-slot:card-body>
<auto-complete <auto-complete
type="skill" type="skill"
label="Deine Fähigkeiten"
:values="profile.skills" :values="profile.skills"
placeholder="z.B. Python, JavaScript, Linux"
@update-values="profile.skills = $event" @update-values="profile.skills = $event"
></auto-complete> ></auto-complete>
</template>
</Section>
<Section title="Meine Sprachkenntnisse">
<template v-slot:card-body>
<auto-complete <auto-complete
type="language" type="language"
label="Deine Sprachen"
:values="profile.languages" :values="profile.languages"
placeholder="z.B. Deutsch, Englisch, Französisch"
@update-values="profile.languages = $event" @update-values="profile.languages = $event"
></auto-complete> ></auto-complete>
</template>
</Section>
<Section title="Ich suche für mich Projekte/Aufträge in folgenden Bereichen">
<template v-slot:card-body>
<auto-complete <auto-complete
type="skill" type="skill"
label="Ich suche für mich Projekte/Aufträge in folgenden Bereichen" label="Ich suche"
:values="profile.searchtopics" :values="profile.searchtopics"
:showSecondary="false"
placeholder="z.B. Python, JavaScript, Linux"
@update-values="profile.searchtopics = $event" @update-values="profile.searchtopics = $event"
></auto-complete> ></auto-complete>
</template>
</Section>
<Section title="Verfügbarkeit"> <div class="col-12 col-xs-12">
<div class="form-check mb-3"> <label for="availability" class="form-label fw-bold"
<input >Ich bin für Anfragen verfügbar:</label
v-model="profile.availability_status" >
class="form-check-input me-2"
type="checkbox"
id="availability_status">
<label class="form-check-label" for="availability_status">
Ich bin aktuell verfügbar
</label>
</div>
<div class="mb-3" v-if="profile.availability_status">
<label class="form-label">
Stunden pro Woche
</label>
<input
v-model="profile.availability_hours_per_week"
type="number"
min="0"
max="168"
class="form-control">
</div>
<label for="availability" class="form-label">
Anmerkungen
</label>
<textarea <textarea
class="form-control" class="form-control"
id="availability" id="availability"
rows="3" rows="3"
maxlength="4000" v-model="profile.availability"
v-model="profile.availability_text"
></textarea> ></textarea>
</Section> </div>
<Section title="Meine Kontaktmöglichkeiten">
<template v-slot:card-body>
<auto-complete <auto-complete
type="contacttype" type="contacttype"
label="Kontaktmöglichkeiten"
:values="profile.contacts" :values="profile.contacts"
placeholder="z.B. E-Mail, Mobiltelefon, Matrix, Web"
@update-values="profile.contacts = $event" @update-values="profile.contacts = $event"
></auto-complete> ></auto-complete>
</template>
</Section>
<Section title="Sonstiges"> <div class="row">
<div class="mb-3"> <div class="col">
<label class="form-label">Über mich</label> <label for="pzl" class="form-label fw-bold">PLZ</label>
<textarea <input
type="text"
class="form-control" class="form-control"
rows="3" id="pzl"
maxlength="4000" v-model="profile.address.postcode"
v-model="profile.freetext"
/> />
</div> </div>
<div> <div class="col">
<label class="form-label">Ehrenamtliche Arbeit</label> <label for="city" class="form-label fw-bold">Stadt</label>
<textarea <input
type="text"
class="form-control" class="form-control"
rows="3" id="city"
maxlength="4000" v-model="profile.address.city"
v-model="profile.volunteerwork"
/> />
</div> </div>
</Section> <div class="col">
<input type="submit" class="d-none"> <label for="country" class="form-label fw-bold">Land</label>
</form> <input
type="text"
class="form-control"
id="country"
v-model="profile.address.country"
/>
</div> </div>
<div class="savebar bg-white border-top py-3">
<div class="container d-flex align-items-center justify-content-end">
<div
class="text-danger"
v-if="showErrorMessage"
>
<i class="bi bi-bug"></i>
Beim Speichern ist ein Fehler aufgetreten.
</div> </div>
<div
class="text-success" <button type="submit" class="btn btn-outline-success mb-4 mt-4 col-12">
v-if="showSuccessMessage"
>
<i class="bi bi-check-lg"></i>
Gespeichert
</div>
<button
class="btn btn-primary ms-3"
@click="submitFormEdit()"
>
Speichern Speichern
</button> </button>
<div
class="alert alert-danger mb-4 mt-4"
role="alert"
v-if="showErrorMessage"
>
Es ist Fehler aufgetreten
</div> </div>
<div
class="alert alert-success mb-4 mt-4"
role="alert"
v-if="showSuccessMessage"
>
Deine Änderungen wurden erfolgreich gespeichert
</div> </div>
</form>
</div> </div>
</template> </template>
<script> <script>
import RequestMixin from "@/mixins/request.mixin" import RequestMixin from "@/mixins/request.mixin"
import AutoComplete from "@/components/AutoComplete"; import AutoComplete from "@/components/AutoComplete";
import Section from '@/components/profile/Section'
export default { export default {
name: "profileEdit", name: "profileEdit",
mixins: [RequestMixin], mixins: [RequestMixin],
components: { components: {
AutoComplete, AutoComplete,
Section,
}, },
data() { data() {
return { return {
showErrorMessage: false, showErrorMessage: false,
showSuccessMessage: false, showSuccessMessage: false,
clearMessagesHandle: null,
profile: { profile: {
visible: false, visible: false,
nickname: "", nickname: "",
pronouns: "", pronouns: "",
volunteerwork: "", volunteerwork: "",
freetext: "", freetext: "",
availability_status: false, availability: "",
availability_hours_per_week: null,
availability_text: "",
address: { address: {
postcode: "", postcode: "",
city: "", city: "",
@ -269,49 +199,10 @@ export default {
searchtopics: [], searchtopics: [],
contacts: [], contacts: [],
}, },
pronounsTooltip: {
content: 'Wie möchtest du angesprochen werden?<br>Zum Beispiel "er/ihn" oder "sie/ihre".',
html: true
}
}; };
}, },
async created() { async created() {
await this.initEditPage(); await this.initEditPage();
}, },
unmounted() {
this.cancelClearMessages()
},
methods: {
cancelClearMessages() {
if (this.clearMessagesHandle) {
window.clearTimeout(this.clearMessagesHandle)
}
},
scheduleClearMessages() {
this.cancelClearMessages()
this.clearMessagesHandle = window.setTimeout(() => {
this.showErrorMessage = false
this.showSuccessMessage = false
}, 2500)
}
},
watch: {
showErrorMessage(curr) {
if (curr) {
this.scheduleClearMessages()
}
},
showSuccessMessage(curr) {
if (curr) {
this.scheduleClearMessages()
}
}
}
}; };
</script> </script>
<style scoped>
.savebar {
bottom: 0;
position: sticky;
}
</style>

View File

@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<Section <Section
v-if="profile.searchtopics && profile.searchtopics.length > 0" v-if="profile.searchtopics && profile.searchtopics.length > 0"
title="Ich suche für mich Projekte/Aufträge in folgenden Bereichen"> title="Das suche ich">
<div style="margin-bottom: -.5rem;"> <div style="margin-bottom: -.5rem;">
<Skill <Skill
class="me-2 mb-2" class="me-2 mb-2"
@ -55,28 +55,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</div> </div>
</Section> </Section>
<Section title="Verfügbarkeit"> <Section
<div class="d-flex align-items-center"> v-if="profile.availability"
<div v-if="profile.availability_status"> title="Verfügbarkeit">
<i class="bi bi-check-square me-1"></i> <div class="lh-base">{{ profile.availability }}</div>
ja
</div>
<div v-else>
<i class="bi bi-x-square me-1"></i>
nein
</div>
<span
class="ms-3"
v-if="profile.availability_status && profile.availability_hours_per_week">
({{ profile.availability_hours_per_week }} Stunden pro Woche)
</span>
</div>
<div v-if="profile.availability_text" class="mt-3">
<label class="form-label fw-bold">
Anmerkungen
</label>
<div class="line-break-text">{{ profile.availability_text }}</div>
</div>
</Section> </Section>
<Section <Section
@ -98,11 +80,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later
title="Sonstiges"> title="Sonstiges">
<div v-if="profile.freetext" :class="{ 'lh-base': true, 'mb-4': profile.volunteerwork }"> <div v-if="profile.freetext" :class="{ 'lh-base': true, 'mb-4': profile.volunteerwork }">
<h5>Über mich</h5> <h5>Über mich</h5>
<div class="line-break-text">{{ profile.freetext }}</div> {{ profile.freetext }}
</div> </div>
<div v-if="profile.volunteerwork" class="lh-base"> <div v-if="profile.volunteerwork" class="lh-base">
<h5>Ehrenamtliche Arbeit</h5> <h5>Ehrentamtliche Arbeit</h5>
<div class="line-break-text">{{ profile.volunteerwork }}</div> {{ profile.volunteerwork }}
</div> </div>
</Section> </Section>
</template> </template>
@ -130,8 +112,7 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
loadProfile: 'profile/load', load: 'profile/load'
clearStore: 'profile/clear',
}) })
}, },
computed: { computed: {
@ -145,16 +126,10 @@ export default {
}, },
async created() { async created() {
const id = parseInt(this.$route.params.memberId, 10) const id = parseInt(this.$route.params.memberId, 10)
this.loadProfile(id) this.load(id)
}, }
unmounted() {
this.clearStore()
},
}; };
</script> </script>
<style> <style>
.line-break-text{
white-space: pre-line;
}
</style> </style>