mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Make Challenge Owner's Name Clickable (#9283)
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
.col-12.col-md-6
|
.col-12.col-md-6
|
||||||
h1(v-markdown='challenge.name')
|
h1(v-markdown='challenge.name')
|
||||||
div
|
div
|
||||||
strong(v-once) {{$t('createdBy')}}:
|
strong.float-left(v-once) {{ $t('createdBy') }}:
|
||||||
span(v-if='challenge.leader && challenge.leader.profile') {{challenge.leader.profile.name}}
|
user-link.mx-1.float-left(:user="challenge.leader")
|
||||||
// @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages)
|
// @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages)
|
||||||
// @TODO: Implement in V2 strong.margin-left(v-once)
|
// @TODO: Implement in V2 strong.margin-left(v-once)
|
||||||
.svg-icon.calendar-icon(v-html="icons.calendarIcon")
|
.svg-icon.calendar-icon(v-html="icons.calendarIcon")
|
||||||
@@ -180,7 +180,7 @@ import challengeMemberProgressModal from './challengeMemberProgressModal';
|
|||||||
import challengeMemberSearchMixin from 'client/mixins/challengeMemberSearch';
|
import challengeMemberSearchMixin from 'client/mixins/challengeMemberSearch';
|
||||||
import leaveChallengeModal from './leaveChallengeModal';
|
import leaveChallengeModal from './leaveChallengeModal';
|
||||||
import sidebarSection from '../sidebarSection';
|
import sidebarSection from '../sidebarSection';
|
||||||
|
import userLink from '../userLink';
|
||||||
import taskDefaults from 'common/script/libs/taskDefaults';
|
import taskDefaults from 'common/script/libs/taskDefaults';
|
||||||
|
|
||||||
import gemIcon from 'assets/svg/gem.svg';
|
import gemIcon from 'assets/svg/gem.svg';
|
||||||
@@ -202,6 +202,7 @@ export default {
|
|||||||
sidebarSection,
|
sidebarSection,
|
||||||
TaskColumn: Column,
|
TaskColumn: Column,
|
||||||
TaskModal,
|
TaskModal,
|
||||||
|
userLink,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ div
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data'}),
|
...mapState({user: 'user.data'}),
|
||||||
},
|
},
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
challenges: [],
|
challenges: [],
|
||||||
icons: Object.freeze({
|
icons: Object.freeze({
|
||||||
@@ -136,24 +136,24 @@ div
|
|||||||
directives: {
|
directives: {
|
||||||
markdown: markdownDirective,
|
markdown: markdownDirective,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
this.loadChallenges();
|
this.loadChallenges();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
async groupId() {
|
async groupId () {
|
||||||
this.loadChallenges();
|
this.loadChallenges();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadChallenges() {
|
async loadChallenges () {
|
||||||
this.groupIdForChallenges = this.groupId;
|
this.groupIdForChallenges = this.groupId;
|
||||||
if (this.groupId === 'party' && this.user.party._id) this.groupIdForChallenges = this.user.party._id;
|
if (this.groupId === 'party' && this.user.party._id) this.groupIdForChallenges = this.user.party._id;
|
||||||
this.challenges = await this.$store.dispatch('challenges:getGroupChallenges', {groupId: this.groupIdForChallenges});
|
this.challenges = await this.$store.dispatch('challenges:getGroupChallenges', {groupId: this.groupIdForChallenges});
|
||||||
},
|
},
|
||||||
createChallenge() {
|
createChallenge () {
|
||||||
this.$root.$emit('bv::show::modal', 'challenge-modal');
|
this.$root.$emit('bv::show::modal', 'challenge-modal');
|
||||||
},
|
},
|
||||||
challengeCreated(challenge) {
|
challengeCreated (challenge) {
|
||||||
if (challenge.group._id !== this.groupIdForChallenges) return;
|
if (challenge.group._id !== this.groupIdForChallenges) return;
|
||||||
this.challenges.push(challenge);
|
this.challenges.push(challenge);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
.row
|
.row
|
||||||
.col-12.col-md-6.title-details
|
.col-12.col-md-6.title-details
|
||||||
h1 {{group.name}}
|
h1 {{group.name}}
|
||||||
strong.float-left(v-once) {{$t('groupLeader')}}
|
strong.float-left(v-once) {{$t('groupLeader')}}:
|
||||||
span.leader.float-left(v-if='group.leader.profile', @click='showMemberProfile(group.leader)') : {{group.leader.profile.name}}
|
user-link.mx-1.float-left(:user="group.leader")
|
||||||
.col-12.col-md-6
|
.col-12.col-md-6
|
||||||
.row.icon-row
|
.row.icon-row
|
||||||
.col-4.offset-4(v-bind:class="{ 'offset-8': isParty }")
|
.col-4.offset-4(v-bind:class="{ 'offset-8': isParty }")
|
||||||
@@ -93,10 +93,6 @@
|
|||||||
color: $purple-200;
|
color: $purple-200;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leader:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-container {
|
.button-container {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|
||||||
@@ -281,6 +277,7 @@ import questSidebarSection from 'client/components/groups/questSidebarSection';
|
|||||||
import markdownDirective from 'client/directives/markdown';
|
import markdownDirective from 'client/directives/markdown';
|
||||||
import communityGuidelines from './communityGuidelines';
|
import communityGuidelines from './communityGuidelines';
|
||||||
import sidebarSection from '../sidebarSection';
|
import sidebarSection from '../sidebarSection';
|
||||||
|
import userLink from '../userLink';
|
||||||
|
|
||||||
import deleteIcon from 'assets/svg/delete.svg';
|
import deleteIcon from 'assets/svg/delete.svg';
|
||||||
import copyIcon from 'assets/svg/copy.svg';
|
import copyIcon from 'assets/svg/copy.svg';
|
||||||
@@ -310,6 +307,7 @@ export default {
|
|||||||
questSidebarSection,
|
questSidebarSection,
|
||||||
communityGuidelines,
|
communityGuidelines,
|
||||||
sidebarSection,
|
sidebarSection,
|
||||||
|
userLink
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
markdown: markdownDirective,
|
markdown: markdownDirective,
|
||||||
@@ -624,13 +622,6 @@ export default {
|
|||||||
}
|
}
|
||||||
// $rootScope.$state.go('options.inventory.quests');
|
// $rootScope.$state.go('options.inventory.quests');
|
||||||
},
|
},
|
||||||
async showMemberProfile (leader) {
|
|
||||||
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: leader._id });
|
|
||||||
this.$root.$emit('habitica:show-profile', {
|
|
||||||
user: heroDetails.data.data,
|
|
||||||
startingPage: 'profile',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
showGroupGems () {
|
showGroupGems () {
|
||||||
this.$root.$emit('bv::show::modal', 'group-gems-modal');
|
this.$root.$emit('bv::show::modal', 'group-gems-modal');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
icons: {
|
icons: {
|
||||||
upIcon,
|
upIcon,
|
||||||
downIcon,
|
downIcon,
|
||||||
information: informationIcon
|
information: informationIcon,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
21
website/client/components/userLink.vue
Normal file
21
website/client/components/userLink.vue
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
b-link(
|
||||||
|
v-if='user && user.profile',
|
||||||
|
@click.prevent='showProfile(user)'
|
||||||
|
) {{user.profile.name}}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: ['user'],
|
||||||
|
methods: {
|
||||||
|
async showProfile (user) {
|
||||||
|
let heroDetails = await this.$store.dispatch('members:fetchMember', { memberId: user._id });
|
||||||
|
this.$root.$emit('habitica:show-profile', {
|
||||||
|
user: heroDetails.data.data,
|
||||||
|
startingPage: 'profile',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user