Skip to content

Commit

Permalink
🚸 [#4969] Collapse form definition settings to declutter
Browse files Browse the repository at this point in the history
If a name and slug (required fields) are provided, the fieldset is
collapsed.
  • Loading branch information
sergei-maertens committed Jan 2, 2025
1 parent 0219f1c commit ddc6e97
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 31 deletions.
40 changes: 34 additions & 6 deletions src/openforms/js/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,12 @@
"value": "The email addresses to which the payment status update will be sent (defaults to general registration addresses)"
}
],
"7jY1U4": [
{
"type": 0,
"value": "Fields"
}
],
"7qqbU9": [
{
"type": 1,
Expand Down Expand Up @@ -5135,12 +5141,6 @@
"value": "Submission report PDF informatieobjecttype"
}
],
"jARYB7": [
{
"type": 0,
"value": "Form definition"
}
],
"jLg5l6": [
{
"type": 0,
Expand Down Expand Up @@ -6209,6 +6209,34 @@
"value": "option 1: € 10,99"
}
],
"t+J++o": [
{
"options": {
"other": {
"value": [
{
"type": 0,
"value": "Step"
}
]
},
"true": {
"value": [
{
"type": 0,
"value": "Reusable step"
}
]
}
},
"type": 5,
"value": "isReusable"
},
{
"type": 0,
"value": " settings"
}
],
"t5fg/K": [
{
"type": 0,
Expand Down
36 changes: 30 additions & 6 deletions src/openforms/js/compiled-lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,12 @@
"value": "De e-mailadressen waarnaar de update van de betalingsstatus wordt verzonden (standaard wordt het algemene e-mailadres gebruikt)."
}
],
"7jY1U4": [
{
"type": 0,
"value": "Velden"
}
],
"7qqbU9": [
{
"type": 1,
Expand Down Expand Up @@ -5153,12 +5159,6 @@
"value": "Informatieobjecttype inzendings-PDF"
}
],
"jARYB7": [
{
"type": 0,
"value": "(Herbruikbare) stapgegevens"
}
],
"jLg5l6": [
{
"type": 0,
Expand Down Expand Up @@ -6227,6 +6227,30 @@
"value": "optie 1: € 10,99"
}
],
"t+J++o": [
{
"options": {
"other": {
"value": [
{
"type": 0,
"value": "Stapinstellingen"
}
]
},
"true": {
"value": [
{
"type": 0,
"value": "Herbruikbare stapinstellingen"
}
]
}
},
"type": 5,
"value": "isReusable"
}
],
"t5fg/K": [
{
"type": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import FormIOBuilder from 'components/formio_builder/builder';
import AuthenticationWarning from './AuthenticationWarning';
import ChangedFormDefinitionWarning from './ChangedFormDefinitionWarning';
import {FormContext} from './Context';
import LanguageTabs from './LanguageTabs';
import LanguageTabs, {DEFAULT_LANGUAGE} from './LanguageTabs';
import LogicWarning from './LogicWarning';
import PluginWarning from './PluginWarning';
import useDetectConfigurationChanged from './useDetectConfigurationChanged';
Expand Down Expand Up @@ -168,21 +168,26 @@ const FormStepDefinition = ({
erroredLanguages.add(langCode);
}

const hasName = !!translations[DEFAULT_LANGUAGE].name;

return (
<>
<ChangedFormDefinitionWarning changed={changed} affectedForms={affectedForms} />
<PluginWarning loginRequired={loginRequired} configuration={configuration} />
<AuthenticationWarning loginRequired={loginRequired} configuration={configuration} />
<LogicWarning warnings={warnings} />

<Fieldset>
<h2>
<Fieldset
title={
<FormattedMessage
description="Form definition module title"
defaultMessage="Form definition"
defaultMessage="{isReusable, select, true {Reusable step} other {Step}} settings"
values={{isReusable: isReusable}}
/>
</h2>

}
collapsible
initialCollapsed={hasName && !!slug && !errors.length}
>
<LanguageTabs haveErrors={[...erroredLanguages]}>
{(langCode, defaultLang) => (
<>
Expand Down
15 changes: 10 additions & 5 deletions src/openforms/js/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@
"description": "Email registration options 'paymentEmails' label",
"originalDefault": "The email addresses to which the payment status update will be sent (defaults to general registration addresses)"
},
"7jY1U4": {
"defaultMessage": "Fields",
"description": "Form definition formio configuration",
"originalDefault": "Fields"
},
"833GAg": {
"defaultMessage": "Input mapping",
"description": "Input mapping title",
Expand Down Expand Up @@ -2414,11 +2419,6 @@
"description": "Objects API registration options \"Submission report PDF informatieobjecttype\" label",
"originalDefault": "Submission report PDF informatieobjecttype"
},
"jARYB7": {
"defaultMessage": "Form definition",
"description": "Form definition module title",
"originalDefault": "Form definition"
},
"jLv6k8": {
"defaultMessage": "DMN variable",
"description": "Accessible label for DMN variable dropdown",
Expand Down Expand Up @@ -2884,6 +2884,11 @@
"description": "Objects API registration backend: v2 switch warning message",
"originalDefault": "Switching to the new registration options will remove the existing JSON templates. You will also not be able to save the form until the variables are correctly mapped. Are you sure you want to continue?"
},
"t+J++o": {
"defaultMessage": "{isReusable, select, true {Reusable step} other {Step}} settings",
"description": "Form definition module title",
"originalDefault": "{isReusable, select, true {Reusable step} other {Step}} settings"
},
"t5fg/K": {
"defaultMessage": "one or more actions are invalid",
"description": "Logic rule warning message about problematic actions.",
Expand Down
15 changes: 10 additions & 5 deletions src/openforms/js/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@
"description": "Email registration options 'paymentEmails' label",
"originalDefault": "The email addresses to which the payment status update will be sent (defaults to general registration addresses)"
},
"7jY1U4": {
"defaultMessage": "Velden",
"description": "Form definition formio configuration",
"originalDefault": "Fields"
},
"833GAg": {
"defaultMessage": "Invoerparameters",
"description": "Input mapping title",
Expand Down Expand Up @@ -2435,11 +2440,6 @@
"description": "Objects API registration options \"Submission report PDF informatieobjecttype\" label",
"originalDefault": "Submission report PDF informatieobjecttype"
},
"jARYB7": {
"defaultMessage": "(Herbruikbare) stapgegevens",
"description": "Form definition module title",
"originalDefault": "Form definition"
},
"jLv6k8": {
"defaultMessage": "DMN-variabele",
"description": "Accessible label for DMN variable dropdown",
Expand Down Expand Up @@ -2905,6 +2905,11 @@
"description": "Objects API registration backend: v2 switch warning message",
"originalDefault": "Switching to the new registration options will remove the existing JSON templates. You will also not be able to save the form until the variables are correctly mapped. Are you sure you want to continue?"
},
"t+J++o": {
"defaultMessage": "{isReusable, select, true {Herbruikbare stapinstellingen} other {Stapinstellingen}}",
"description": "Form definition module title",
"originalDefault": "{isReusable, select, true {Reusable step} other {Step}} settings"
},
"t5fg/K": {
"defaultMessage": "één of meer acties zijn ongeldig",
"description": "Logic rule warning message about problematic actions.",
Expand Down
17 changes: 14 additions & 3 deletions src/openforms/scss/components/admin/_edit-panel.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'microscope-sass/lib/bem';

@import '../../vars';

.edit-panel {
Expand All @@ -8,7 +10,7 @@
margin-top: 20px;
}

&__submit-layer {
@include bem.element('submit-layer') {
position: fixed;
z-index: 1;
top: 0;
Expand All @@ -22,13 +24,13 @@
align-items: center;
}

&__nav {
@include bem.element('nav') {
width: 25%;
max-width: 300px;
margin-right: 10px;
}

&__edit-area {
@include bem.element('edit-area') {
flex-grow: 1;
min-width: 0;
width: 75%;
Expand All @@ -38,6 +40,15 @@
background: var(--edit-panel-title-bg);
color: var(--edit-panel-title-fg);
}

// provide sufficient contrast in light mode
@at-root & fieldset .collapse-toggle {
color: var(--edit-panel-title-fg);
}

@at-root & fieldset.collapsed .collapse-toggle {
color: var(--link-fg);
}
}
}

Expand Down

0 comments on commit ddc6e97

Please sign in to comment.