debian-mirror-gitlab/app/assets/javascripts/notes/components/discussion_counter.vue

84 lines
2.5 KiB
Vue
Raw Normal View History

2018-03-27 19:54:05 +05:30
<script>
2020-03-13 15:44:24 +05:30
import { mapGetters } from 'vuex';
2019-02-15 15:39:39 +05:30
import { GlTooltipDirective } from '@gitlab/ui';
2018-12-13 13:39:08 +05:30
import Icon from '~/vue_shared/components/icon.vue';
2018-11-18 11:00:15 +05:30
import discussionNavigation from '../mixins/discussion_navigation';
2018-03-27 19:54:05 +05:30
2018-05-09 12:01:36 +05:30
export default {
directives: {
2019-02-15 15:39:39 +05:30
GlTooltip: GlTooltipDirective,
2018-05-09 12:01:36 +05:30
},
2018-12-13 13:39:08 +05:30
components: {
Icon,
},
2018-11-18 11:00:15 +05:30
mixins: [discussionNavigation],
2018-05-09 12:01:36 +05:30
computed: {
...mapGetters([
'getUserData',
'getNoteableData',
2019-02-15 15:39:39 +05:30
'resolvableDiscussionsCount',
'unresolvedDiscussionsCount',
2018-05-09 12:01:36 +05:30
]),
isLoggedIn() {
return this.getUserData.id;
2018-03-27 19:54:05 +05:30
},
2018-05-09 12:01:36 +05:30
hasNextButton() {
return this.isLoggedIn && !this.allResolved;
},
allResolved() {
2019-02-15 15:39:39 +05:30
return this.unresolvedDiscussionsCount === 0;
2018-03-27 19:54:05 +05:30
},
2018-05-09 12:01:36 +05:30
resolveAllDiscussionsIssuePath() {
return this.getNoteableData.create_issue_to_resolve_discussions_path;
},
2019-02-15 15:39:39 +05:30
resolvedDiscussionsCount() {
return this.resolvableDiscussionsCount - this.unresolvedDiscussionsCount;
},
2018-05-09 12:01:36 +05:30
},
};
2018-03-27 19:54:05 +05:30
</script>
<template>
2019-09-04 21:01:54 +05:30
<div v-if="resolvableDiscussionsCount > 0" class="line-resolve-all-container full-width-mobile">
<div class="full-width-mobile d-flex d-sm-block">
2019-02-15 15:39:39 +05:30
<div :class="{ 'has-next-btn': hasNextButton }" class="line-resolve-all">
2018-03-27 19:54:05 +05:30
<span
:class="{ 'is-active': allResolved }"
class="line-resolve-btn is-disabled"
2018-12-13 13:39:08 +05:30
type="button"
>
2019-09-04 21:01:54 +05:30
<icon :name="allResolved ? 'check-circle-filled' : 'check-circle'" />
2018-03-27 19:54:05 +05:30
</span>
2018-10-15 14:42:47 +05:30
<span class="line-resolve-text">
2019-02-15 15:39:39 +05:30
{{ resolvedDiscussionsCount }}/{{ resolvableDiscussionsCount }}
2019-09-30 21:07:59 +05:30
{{ n__('thread resolved', 'threads resolved', resolvableDiscussionsCount) }}
2018-03-27 19:54:05 +05:30
</span>
</div>
2019-09-04 21:01:54 +05:30
<div
v-if="resolveAllDiscussionsIssuePath && !allResolved"
class="btn-group btn-group-sm"
role="group"
>
2018-03-27 19:54:05 +05:30
<a
2019-02-15 15:39:39 +05:30
v-gl-tooltip
2018-11-08 19:23:39 +05:30
:href="resolveAllDiscussionsIssuePath"
2019-09-30 21:07:59 +05:30
:title="s__('Resolve all threads in new issue')"
2019-02-15 15:39:39 +05:30
class="new-issue-for-discussion btn btn-default discussion-create-issue-btn"
>
2018-12-13 13:39:08 +05:30
<icon name="issue-new" />
2018-03-27 19:54:05 +05:30
</a>
</div>
2019-09-04 21:01:54 +05:30
<div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group">
2018-03-27 19:54:05 +05:30
<button
2019-02-15 15:39:39 +05:30
v-gl-tooltip
2020-03-13 15:44:24 +05:30
title="Jump to next unresolved thread"
2018-11-08 19:23:39 +05:30
class="btn btn-default discussion-next-btn"
2020-03-13 15:44:24 +05:30
@click="jumpToNextDiscussion"
2019-02-15 15:39:39 +05:30
>
2018-12-13 13:39:08 +05:30
<icon name="comment-next" />
2018-03-27 19:54:05 +05:30
</button>
</div>
</div>
</div>
</template>