2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
2023-03-04 22:38:38 +05:30
|
|
|
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
|
|
|
|
import SafeHtml from '~/vue_shared/directives/safe_html';
|
2021-04-29 21:17:54 +05:30
|
|
|
import { __ } from '~/locale';
|
2018-11-08 19:23:39 +05:30
|
|
|
import eventHub from '../event_hub';
|
2021-03-11 19:13:27 +05:30
|
|
|
import animateMixin from '../mixins/animate';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
export default {
|
2021-04-29 21:17:54 +05:30
|
|
|
i18n: {
|
|
|
|
editTitleAndDescription: __('Edit title and description'),
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
components: {
|
|
|
|
GlButton,
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
directives: {
|
2020-11-24 15:15:51 +05:30
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
SafeHtml,
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
mixins: [animateMixin],
|
|
|
|
props: {
|
|
|
|
issuableRef: {
|
|
|
|
type: [String, Number],
|
|
|
|
required: true,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
canUpdate: {
|
|
|
|
required: false,
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
titleHtml: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
titleText: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
showInlineEditButton: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
preAnimation: false,
|
|
|
|
pulseAnimation: false,
|
|
|
|
titleEl: document.querySelector('title'),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
titleHtml() {
|
|
|
|
this.setPageTitle();
|
|
|
|
this.animateChange();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setPageTitle() {
|
|
|
|
const currentPageTitleScope = this.titleEl.innerText.split('·');
|
|
|
|
currentPageTitleScope[0] = `${this.titleText} (${this.issuableRef}) `;
|
|
|
|
this.titleEl.textContent = currentPageTitleScope.join('·');
|
|
|
|
},
|
|
|
|
edit() {
|
|
|
|
eventHub.$emit('open.form');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2017-09-10 17:25:29 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-03-17 18:26:18 +05:30
|
|
|
<div class="title-container">
|
2022-05-07 20:08:51 +05:30
|
|
|
<h1
|
2020-11-24 15:15:51 +05:30
|
|
|
v-safe-html="titleHtml"
|
2018-03-17 18:26:18 +05:30
|
|
|
:class="{
|
|
|
|
'issue-realtime-pre-pulse': preAnimation,
|
2019-02-15 15:39:39 +05:30
|
|
|
'issue-realtime-trigger-pulse': pulseAnimation,
|
2018-03-17 18:26:18 +05:30
|
|
|
}"
|
2022-08-13 15:12:31 +05:30
|
|
|
class="title gl-font-size-h-display"
|
|
|
|
data-qa-selector="title_content"
|
2019-07-31 22:56:46 +05:30
|
|
|
dir="auto"
|
2022-05-07 20:08:51 +05:30
|
|
|
></h1>
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-button
|
2018-03-17 18:26:18 +05:30
|
|
|
v-if="showInlineEditButton && canUpdate"
|
2020-11-24 15:15:51 +05:30
|
|
|
v-gl-tooltip.bottom
|
|
|
|
icon="pencil"
|
2022-08-13 15:12:31 +05:30
|
|
|
class="btn-edit js-issuable-edit"
|
2021-04-29 21:17:54 +05:30
|
|
|
:title="$options.i18n.editTitleAndDescription"
|
|
|
|
:aria-label="$options.i18n.editTitleAndDescription"
|
2018-03-17 18:26:18 +05:30
|
|
|
@click="edit"
|
2020-11-24 15:15:51 +05:30
|
|
|
/>
|
2018-03-17 18:26:18 +05:30
|
|
|
</div>
|
2017-09-10 17:25:29 +05:30
|
|
|
</template>
|