Squashed commit of the following:

commit 44b1c8c7ba8b45cb682973fb89b70445d0f5c478
Merge: 489c15b7fd 4dadb64af0
Author: Sabe Jones <sabe@habitica.com>
Date:   Thu Feb 8 14:49:05 2024 -0600

    Merge branch 'release' into phillip/panel_profile

commit 489c15b7fd
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Dec 14 13:29:32 2022 +0100

    allow profiles to be edited in admin panel

commit 1afaaf4089
Author: Phillip Thelen <phillip@habitica.com>
Date:   Wed Dec 14 12:50:47 2022 +0100

    include month for next hourglass date in admin panel
This commit is contained in:
Sabe Jones
2024-02-08 14:49:37 -06:00
parent 4dadb64af0
commit 2f42422d35
3 changed files with 113 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
<template>
<div class="accordion-group">
<h3
class="expand-toggle"
:class="{'open': expand}"
@click="expand = !expand"
>
Users Profile
</h3>
<div v-if="expand">
<form @submit.prevent="saveHero({hero, msg: 'Users Profile'})">
<div class="form-group">
<label>Display name</label>
<input
v-model="hero.profile.name"
class="form-control textField"
type="text"
>
</div>
<div class="form-group">
<label>Photo URL</label>
<input
v-model="hero.profile.imageUrl"
class="form-control textField"
type="text"
>
</div>
<div class="form-group">
<label>About</label>
<div class="row about-row">
<textarea
v-model="hero.profile.blurb"
class="form-control col"
rows="10"
></textarea>
<div
v-markdown="hero.profile.blurb"
class="markdownPreview col"
></div>
</div>
</div>
<input
type="submit"
value="Save"
class="btn btn-primary"
>
</form>
</div>
</div>
</template>
<style lang="scss" scoped>
.about-row {
margin-left: 0px;
margin-right: 0px;
}
</style>
<script>
import markdownDirective from '@/directives/markdown';
import saveHero from '../mixins/saveHero';
import { mapState } from '@/libs/store';
import { userStateMixin } from '../../../mixins/userState';
function resetData (self) {
self.expand = false;
}
export default {
directives: {
markdown: markdownDirective,
},
mixins: [
userStateMixin,
saveHero,
],
computed: {
...mapState({ user: 'user.data' }),
},
props: {
resetCounter: {
type: Number,
required: true,
},
hero: {
type: Object,
required: true,
},
},
data () {
return {
expand: false,
};
},
watch: {
resetCounter () {
resetData(this);
},
},
mounted () {
resetData(this);
},
};
</script>