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"
|
|
|
|
@editingEnabled="editingName = true" @editingDisabled="editingName = false" @update="updateName" @delete="handleDelete"></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>
|
2023-11-02 19:58:40 +08:00
|
|
|
import InlineEdit from "../shared/inline_edit.vue";
|
2023-10-24 21:49:37 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "RepositoryItemSidebarTitle",
|
|
|
|
components: {
|
|
|
|
"inline-edit": InlineEdit
|
|
|
|
},
|
2023-11-24 00:35:34 +08:00
|
|
|
emits: ['update'],
|
2023-10-24 21:49:37 +08:00
|
|
|
props: {
|
|
|
|
editable: Boolean,
|
|
|
|
name: String,
|
2023-11-29 23:08:19 +08:00
|
|
|
archived: Boolean,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computedName() {
|
|
|
|
return this.archived ? `(A) ${this.name}` : this.name;
|
|
|
|
},
|
2023-10-24 21:49:37 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateName(name) {
|
|
|
|
this.$emit('update', { 'repository_row': { name: name } });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|