debian-mirror-gitlab/app/assets/javascripts/issues/show/components/edited.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
2.3 KiB
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
2023-06-20 00:43:36 +05:30
import { GlLink, GlSprintf } from '@gitlab/ui';
import { n__, sprintf } from '~/locale';
2022-10-11 01:57:18 +05:30
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
2017-08-17 22:00:37 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
2022-10-11 01:57:18 +05:30
TimeAgoTooltip,
2023-06-20 00:43:36 +05:30
GlLink,
2022-11-25 23:54:43 +05:30
GlSprintf,
2018-12-13 13:39:08 +05:30
},
props: {
2023-06-20 00:43:36 +05:30
taskCompletionStatus: {
type: Object,
required: false,
default: () => ({}),
},
2018-12-13 13:39:08 +05:30
updatedAt: {
type: String,
required: false,
default: '',
2017-08-17 22:00:37 +05:30
},
2018-12-13 13:39:08 +05:30
updatedByName: {
type: String,
required: false,
default: '',
2017-08-17 22:00:37 +05:30
},
2018-12-13 13:39:08 +05:30
updatedByPath: {
type: String,
required: false,
default: '',
2017-08-17 22:00:37 +05:30
},
2018-12-13 13:39:08 +05:30
},
computed: {
2023-06-20 00:43:36 +05:30
completedCount() {
return this.taskCompletionStatus.completed_count;
},
count() {
return this.taskCompletionStatus.count;
},
2018-12-13 13:39:08 +05:30
hasUpdatedBy() {
return this.updatedByName && this.updatedByPath;
},
2023-06-20 00:43:36 +05:30
showCheck() {
return this.completedCount === this.count;
},
taskStatus() {
const { completedCount, count } = this;
if (!count) {
return undefined;
}
return sprintf(
n__(
'%{completedCount} of %{count} checklist item completed',
'%{completedCount} of %{count} checklist items completed',
count,
),
{ completedCount, count },
);
},
2018-12-13 13:39:08 +05:30
},
};
2017-08-17 22:00:37 +05:30
</script>
<template>
2022-06-21 17:19:12 +05:30
<small class="edited-text js-issue-widgets">
2023-06-20 00:43:36 +05:30
<template v-if="taskStatus">
<template v-if="showCheck">&check;</template>
{{ taskStatus }}
<template v-if="updatedAt">&middot;</template>
</template>
<template v-if="updatedAt">
<gl-sprintf v-if="!hasUpdatedBy" :message="__('Edited %{timeago}')">
<template #timeago>
<time-ago-tooltip :time="updatedAt" tooltip-placement="bottom" />
</template>
</gl-sprintf>
<gl-sprintf v-else :message="__('Edited %{timeago} by %{author}')">
<template #timeago>
<time-ago-tooltip :time="updatedAt" tooltip-placement="bottom" />
</template>
<template #author>
<gl-link :href="updatedByPath" class="gl-font-sm gl-hover-text-gray-900 gl-text-gray-700">
{{ updatedByName }}
</gl-link>
</template>
</gl-sprintf>
</template>
2017-08-17 22:00:37 +05:30
</small>
</template>