Skip to content

Commit

Permalink
fix(template-filler): Hide template fields with unknown labels
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>

[skip ci]
  • Loading branch information
elzody authored and backportbot[bot] committed Feb 13, 2025
1 parent c7c773b commit 71110cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions apps/files/src/components/TemplateFiller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
-->

<template>
<NcModal>
<NcModal label-id="template-field-modal__label">
<div class="template-field-modal__content">
<form>
<h3>{{ t('files', 'Fill template fields') }}</h3>
<h3 id="template-field-modal__label">
{{ t('files', 'Fill template fields') }}
</h3>

<div v-for="field in fields" :key="field.index">
<component :is="getFieldComponent(field.type)" :field="field" @input="trackInput" />
<component :is="getFieldComponent(field.type)"
v-if="fieldHasLabel(field)"
:field="field"
@input="trackInput" />
</div>
</form>
</div>
Expand Down Expand Up @@ -80,6 +85,9 @@ export default defineComponent({

return `Template${fieldComponentType}Field`
},
fieldHasLabel(field) {
return field.name || field.alias
},
async submit() {
this.loading = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineComponent({

computed: {
fieldLabel() {
const label = this.field.name ?? this.field.alias ?? 'Unknown field'
const label = this.field.name || this.field.alias

return label.charAt(0).toUpperCase() + label.slice(1)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({

computed: {
fieldLabel() {
const label = this.field.name ?? this.field.alias ?? 'Unknown field'
const label = this.field.name || this.field.alias

return (label.charAt(0).toUpperCase() + label.slice(1))
},
Expand Down

0 comments on commit 71110cf

Please sign in to comment.