Make Challenge Owner's Name Clickable (#9283)

This commit is contained in:
Marvin Rabe
2018-05-01 17:23:02 +02:00
parent 4e4181a394
commit 88b14592c5
5 changed files with 36 additions and 23 deletions

View File

@@ -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 {

View File

@@ -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');
}, },

View File

@@ -81,7 +81,7 @@
icons: { icons: {
upIcon, upIcon,
downIcon, downIcon,
information: informationIcon information: informationIcon,
}, },
}; };
}, },

View 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>