Skip to content

Commit 7e2db83

Browse files
Merge pull request #4782 from specify/issue-4774
Filter out empty conditional format def
2 parents 0b377e2 + b48a4fb commit 7e2db83

File tree

3 files changed

+10
-59
lines changed

3 files changed

+10
-59
lines changed

specifyweb/frontend/js_src/lib/components/Formatters/Definitions.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,7 @@ function ConditionalFormatter({
181181
) : null}
182182
</div>
183183
{isExpanded ? (
184-
<span>
185-
{index === 0
186-
? resourcesText.elseConditionDescription()
187-
: resourcesText.conditionDescription()}
188-
</span>
184+
<span>{resourcesText.conditionDescription()}</span>
189185
) : null}
190186
</Label.Block>
191187
</div>

specifyweb/frontend/js_src/lib/components/Formatters/spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ export const formattersSpec = f.store(() =>
2222
...formatter,
2323
definition: {
2424
...definition,
25-
fields: definition.fields.map((fieldGroup) => ({
26-
...fieldGroup,
27-
fields: fieldGroup.fields.filter(
28-
(field) => field.field !== undefined
29-
),
30-
})),
25+
fields: definition.fields
26+
.filter((fieldGroup) => fieldGroup.fields.length > 0)
27+
.map((fieldGroup) => ({
28+
...fieldGroup,
29+
fields: fieldGroup.fields.filter(
30+
(field) => field.field !== undefined
31+
),
32+
})),
3133
isSingle: definition.fields.length <= 1,
3234
},
3335
})

specifyweb/frontend/js_src/lib/localization/resources.ts

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -621,54 +621,7 @@ export const resourcesText = createDictionary({
621621
conditionDescription: {
622622
'en-us': `
623623
This format will be used only if the condition field value equals this
624-
condition.
625-
`,
626-
'de-ch': `
627-
Dieses Format wird nur verwendet, wenn der Wert des Bedingungsfelds dieser
628-
Bedingung entspricht.
629-
`,
630-
'es-es': `
631-
Este formato se utilizará sólo si el valor del campo de condición es igual
632-
a esta condición.
633-
`,
634-
'fr-fr': `
635-
Ce format ne sera utilisé que si la valeur du champ de condition est égale
636-
à cette condition.
637-
`,
638-
'ru-ru': `
639-
Этот формат будет использоваться только в том случае, если значение поля
640-
условия соответствует этому условию.
641-
`,
642-
'uk-ua': `
643-
Цей формат використовуватиметься, лише якщо значення поля умови дорівнює
644-
цій умові.
645-
`,
646-
},
647-
elseConditionDescription: {
648-
'en-us': `
649-
This format will be used only if the condition field value equals this
650-
condition or if no other format matches it.
651-
`,
652-
'de-ch': `
653-
Dieses Format wird nur verwendet, wenn der Wert des Bedingungsfelds dieser
654-
Bedingung entspricht oder wenn kein anderes Format damit übereinstimmt.
655-
`,
656-
'es-es': `
657-
Este formato se utilizará sólo si el valor del campo de condición es igual
658-
a esta condición o si ningún otro formato coincide con ella.
659-
`,
660-
'fr-fr': `
661-
Ce format ne sera utilisé que si la valeur du champ de condition est égale
662-
à cette condition ou si aucun autre format ne lui correspond.
663-
`,
664-
'ru-ru': `
665-
Этот формат будет использоваться только в том случае, если значение поля
666-
условия соответствует этому условию или если ему не соответствует никакой
667-
другой формат.
668-
`,
669-
'uk-ua': `
670-
Цей формат використовуватиметься, лише якщо значення поля умови дорівнює
671-
цій умові або якщо жоден інший формат їй не відповідає.
624+
condition and is not null.
672625
`,
673626
},
674627
wrongScopeWarning: {

0 commit comments

Comments
 (0)