Fixed Translation error for Error message on item card [SCI-9601]

This commit is contained in:
Gregor Lasnibat 2023-11-02 12:58:40 +01:00
parent 4fd3933bdb
commit 68dc671f06
3 changed files with 15 additions and 19 deletions

View file

@ -1,25 +1,15 @@
<template> <template>
<inline-edit <inline-edit v-if="editable" class="item-name my-auto text-xl font-semibold" :value="name" :characterLimit="255"
v-if="editable" :characterMinLimit="0" :allowBlank="false" :smartAnnotation="false"
class="item-name my-auto text-xl font-semibold" :attributeName="`${i18n.t('repositories.item_card.header_title')}`" :singleLine="true"
:value="name" @editingEnabled="editingName = true" @editingDisabled="editingName = false" @update="updateName" @delete="handleDelete"></inline-edit>
:characterLimit="255"
:characterMinLimit="0"
:allowBlank="false"
:smartAnnotation="false"
:attributeName="`${i18n.t('Repository_row')} ${i18n.t('Name')} `"
:singleLine="true"
@editingEnabled="editingName = true"
@editingDisabled="editingName = false"
@update="updateName"
></inline-edit>
<h4 v-else class="item-name my-auto truncate text-xl" :title="name"> <h4 v-else class="item-name my-auto truncate text-xl" :title="name">
{{ name }} {{ name }}
</h4> </h4>
</template> </template>
<script> <script>
import InlineEdit from "../shared/inline_edit.vue"; import InlineEdit from "../shared/inline_edit.vue";
export default { export default {
name: "RepositoryItemSidebarTitle", name: "RepositoryItemSidebarTitle",

View file

@ -107,7 +107,10 @@
}, },
computed: { computed: {
isBlank() { isBlank() {
return this.newValue.length === 0; if (typeof this.newValue === 'string') {
return this.newValue.trim().length === 0;
}
return true; // treat as blank for non-string values
}, },
isContentDefault() { isContentDefault() {
return this.newValue === this.defaultValue; return this.newValue === this.defaultValue;
@ -152,8 +155,11 @@
this.$emit('blur'); this.$emit('blur');
if (this.allowBlank || !this.isBlank) { if (this.allowBlank || !this.isBlank) {
this.$nextTick(this.update); this.$nextTick(this.update);
} else { } else if (this.isBlank) {
this.$emit('delete'); this.newValue = this.value || '';
}
else {
this.$emit('delete')
} }
}, },
focus() { focus() {

View file

@ -2221,6 +2221,7 @@ en:
my_module_assigned_snapshot_service: my_module_assigned_snapshot_service:
invalid_arguments: "Can't find %{key}" invalid_arguments: "Can't find %{key}"
item_card: item_card:
header_title: "Inventory item"
section: section:
information: "Information" information: "Information"
assigned: "Assigned (%{count})" assigned: "Assigned (%{count})"
@ -3909,7 +3910,6 @@ en:
Tables: "Tables" Tables: "Tables"
Repositories_team: "Inventories - %{team}" Repositories_team: "Inventories - %{team}"
Repository: "Inventory" Repository: "Inventory"
Repository_row: "Inventory item"
Reports: "Reports" Reports: "Reports"
Comments: "Comments" Comments: "Comments"
Step: "Step" Step: "Step"