Files
habitica/website/client/components/tasks/brokenTaskModal.vue
negue 4108a22d78 [WIP] bootstrap-vue upgrade (#9178)
* update bootstrap-vue to 1.0.0-beta.9 - remove all individual bootstrap components and use BootstrapVue into Vue

* change modal action names from show::modal to bv::show::modal

* check if drops are undefined

* fix modal widths - sellModal now using input instead of dropbox

* upgrade to bootstrap 4.0beta

* include package-lock changes

* fix app menu dropdown position

* upgrade bootstrap to beta2 (was missing grid offset and other fixes) - refix header menu position

* fix tags popup (auto width to max not working) - fix filter panel width (adding width: 100% works until max-width)

* show hide logo on different screensize (new css breakpoints - http://getbootstrap.com/docs/4.0/utilities/display/ )

* fix package-lock?

* fix active button style / app header toggle button

* fix package-lock !

* update package lock after merge - new mixin "openedItemRows" to save the "show more/show less" in stable

* mixin naming style

* fix buyQuestModal marginTop

* fix customMenuDropdown position

* fix userDropdown items
2017-11-08 18:40:37 +01:00

94 lines
3.1 KiB
Vue

<template lang='pug'>
b-modal#broken-task-modal(title="Broken Challenge", size='sm', :hide-footer="true")
.modal-body(v-if='brokenChallengeTask && brokenChallengeTask.challenge')
div(v-if='brokenChallengeTask.challenge.broken === "TASK_DELETED" || brokenChallengeTask.challenge.broken === "CHALLENGE_TASK_NOT_FOUND"')
h2 {{ $t('brokenTask') }}
div
button.btn.btn-primary(@click='unlink("keep")') {{ $t('keepIt') }}
button.btn.btn-danger(@click='removeTask(obj)') {{ $t('removeIt') }}
div(v-if='brokenChallengeTask.challenge.broken === "CHALLENGE_DELETED"')
h2 {{ $t('brokenChallenge') }}
div
button.btn.btn-primary(@click='unlink("keep-all")') {{ $t('keepThem') }}
button.btn.btn-danger(@click='unlink("remove-all")') {{ $t('removeThem') }}
div(v-if='brokenChallengeTask.challenge.broken === "CHALLENGE_CLOSED"')
h2(v-html="$t('challengeCompleted', {user: brokenChallengeTask.challenge.winner})")
div
button.btn.btn-primary(@click='unlink("keep-all")') {{ $t('keepThem') }}
button.btn.btn-danger(@click='unlink("remove-all")') {{ $t('removeThem') }}
// @TODO: I ported this over, but do we use it anymore?
//div(v-if='brokenChallengeTask.challenge.broken === "UNSUBSCRIBED"')
p {{ $t('unsubChallenge') }}
p
a(@click="unlink('keep-all')") {{ $t('keepThem') }}
| &nbsp;|&nbsp;
a(@click="unlink('remove-all')") {{ $t('removeThem') }}
</template>
<style scoped>
.modal-body {
padding-bottom: 2em;
}
</style>
<script>
import { mapActions } from 'client/libs/store';
import notifications from 'client/mixins/notifications';
export default {
mixins: [notifications],
data () {
return {
brokenChallengeTask: {},
};
},
created () {
this.$root.$on('handle-broken-task', (task) => {
this.brokenChallengeTask = Object.assign({}, task);
this.$root.$emit('show::modal', 'broken-task-modal');
});
},
removed () {
this.$root.$remove('handle-broken-task');
},
methods: {
...mapActions({
destroyTask: 'tasks:destroy',
unlinkOneTask: 'tasks:unlinkOneTask',
unlinkAllTasks: 'tasks:unlinkAllTasks',
}),
async unlink (keepOption) {
if (keepOption.indexOf('-all') !== -1) {
this.unlinkAllTasks({
challengeId: this.brokenChallengeTask.challenge.id,
keep: keepOption,
});
await this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true});
if (this.brokenChallengeTask.type === 'todo') {
await this.$store.dispatch('tasks:fetchCompletedTodos', {forceLoad: true});
}
this.close();
return;
}
this.unlinkOneTask({
task: this.brokenChallengeTask,
keep: keepOption,
});
this.close();
},
removeTask () {
if (!confirm('Are you sure you want to delete this task?')) return;
this.destroyTask(this.brokenChallengeTask);
},
close () {
this.$store.state.brokenChallengeTask = {};
this.$root.$emit('bv::hide::modal', 'broken-task-modal');
},
},
};
</script>