2023-10-24 21:49:37 +08:00
|
|
|
<template>
|
2023-11-02 19:58:40 +08:00
|
|
|
<inline-edit v-if="editable" class="item-name my-auto text-xl font-semibold" :value="name" :characterLimit="255"
|
|
|
|
:characterMinLimit="0" :allowBlank="false" :smartAnnotation="false"
|
2023-11-20 20:24:59 +08:00
|
|
|
:preventLeavingUntilFilled="true"
|
2023-11-02 19:58:40 +08:00
|
|
|
:attributeName="`${i18n.t('repositories.item_card.header_title')}`" :singleLine="true"
|
2024-09-16 17:59:35 +08:00
|
|
|
@editingEnabled="editingName = true" @editingDisabled="editingName = false" @update="updateName"></inline-edit>
|
2023-11-29 23:08:19 +08:00
|
|
|
<h4 v-else class="item-name my-auto truncate text-xl" :title="computedName">
|
2023-11-29 23:08:19 +08:00
|
|
|
{{ computedName }}
|
2023-10-24 21:49:37 +08:00
|
|
|
</h4>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-01-04 23:34:36 +08:00
|
|
|
import InlineEdit from '../shared/inline_edit.vue';
|
2023-10-24 21:49:37 +08:00
|
|
|
|
|
|
|
export default {
|
2024-01-04 23:34:36 +08:00
|
|
|
name: 'RepositoryItemSidebarTitle',
|
2023-10-24 21:49:37 +08:00
|
|
|
components: {
|
2024-01-04 23:34:36 +08:00
|
|
|
'inline-edit': InlineEdit
|
2023-10-24 21:49:37 +08:00
|
|
|
},
|
2023-11-24 00:35:34 +08:00
|
|
|
emits: ['update'],
|
2023-10-24 21:49:37 +08:00
|
|
|
props: {
|
|
|
|
editable: Boolean,
|
|
|
|
name: String,
|
2024-01-04 23:34:36 +08:00
|
|
|
archived: Boolean
|
2023-11-29 23:08:19 +08:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computedName() {
|
|
|
|
return this.archived ? `(A) ${this.name}` : this.name;
|
2024-01-04 23:34:36 +08:00
|
|
|
}
|
2023-10-24 21:49:37 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateName(name) {
|
2024-01-04 23:34:36 +08:00
|
|
|
this.$emit('update', { repository_row: { name } });
|
|
|
|
}
|
|
|
|
}
|
2023-10-24 21:49:37 +08:00
|
|
|
};
|
|
|
|
</script>
|