mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 13:47:33 +01:00
* change "Keep/Remove It" to "Keep/Remove Them" when asking about all challenge tasks while leaving a challenge * change "Leave" button on groups to "Leave Guild" or "Leave Party" This is because the button is underneath the challenges so this clarifies that it is referring to the group, not a challenge. * change "Keep/Remove Them" to "Keep/Remove Tasks"
46 lines
1.2 KiB
Vue
46 lines
1.2 KiB
Vue
<template lang="pug">
|
|
b-modal#leave-challenge-modal(:title="$t('leaveChallenge')", size='sm', :hide-footer="true")
|
|
.modal-body
|
|
h2 {{ $t('confirmKeepChallengeTasks') }}
|
|
div
|
|
button.btn.btn-primary(@click='leaveChallenge("keep")') {{ $t('keepThem') }}
|
|
button.btn.btn-danger(@click='leaveChallenge("remove-all")') {{ $t('removeThem') }}
|
|
</template>
|
|
|
|
<style scoped>
|
|
.modal-body {
|
|
padding-bottom: 2em;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import findIndex from 'lodash/findIndex';
|
|
import { mapState } from 'client/libs/store';
|
|
import notifications from 'client/mixins/notifications';
|
|
|
|
export default {
|
|
props: ['challengeId'],
|
|
mixins: [notifications],
|
|
computed: {
|
|
...mapState({user: 'user.data'}),
|
|
},
|
|
methods: {
|
|
async leaveChallenge (keep) {
|
|
let index = findIndex(this.user.challenges, (id) => {
|
|
return id === this.challengeId;
|
|
});
|
|
this.user.challenges.splice(index, 1);
|
|
await this.$store.dispatch('challenges:leaveChallenge', {
|
|
challengeId: this.challengeId,
|
|
keep,
|
|
});
|
|
await this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true});
|
|
this.close();
|
|
},
|
|
close () {
|
|
this.$root.$emit('bv::hide::modal', 'leave-challenge-modal');
|
|
},
|
|
},
|
|
};
|
|
</script>
|