@@ -44,6 +44,7 @@ import { Card, Container, Grid, Ref, Sticky } from "semantic-ui-react";
44
44
import PropTypes from "prop-types" ;
45
45
import Overridable from "react-overridable" ;
46
46
import { ShareDraftButton } from "./ShareDraftButton" ;
47
+ import { depositFormSectionsConfig , severityChecksConfig } from "./config" ;
47
48
48
49
export class RDMDepositForm extends Component {
49
50
constructor ( props ) {
@@ -90,6 +91,9 @@ export class RDMDepositForm extends Component {
90
91
this . noFiles = true ;
91
92
}
92
93
94
+ this . sectionsConfig = depositFormSectionsConfig ;
95
+ this . severityChecks = severityChecksConfig ;
96
+
93
97
// hide community header for branded communities
94
98
this . hide_community_selection = this . config . hide_community_selection || false ;
95
99
}
@@ -111,11 +115,11 @@ export class RDMDepositForm extends Component {
111
115
allowEmptyFiles,
112
116
} = this . props ;
113
117
118
+ // Adding section id to custom fields UI, to be used for accordions
114
119
const customFieldsUI = this . config . custom_fields . ui . map ( ( section ) => ( {
115
120
...section ,
116
121
id : section . section . toLowerCase ( ) . replace ( / \s + / g, "-" ) + "-section" ,
117
122
} ) ) ;
118
- const sectionsConfig = this . config . sections_config ;
119
123
120
124
return (
121
125
< Overridable
@@ -147,7 +151,7 @@ export class RDMDepositForm extends Component {
147
151
< FormFeedback
148
152
fieldPath = "message"
149
153
labels = { this . config . custom_fields . error_labels }
150
- sectionsConfig = { sectionsConfig }
154
+ sectionsConfig = { this . sectionsConfig }
151
155
/>
152
156
</ Overridable >
153
157
@@ -172,7 +176,8 @@ export class RDMDepositForm extends Component {
172
176
noFiles = { this . noFiles }
173
177
>
174
178
< AccordionField
175
- includesPaths = { sectionsConfig [ "files-section" ] }
179
+ includesPaths = { this . sectionsConfig [ "files-section" ] }
180
+ severityChecks = { this . severityChecks }
176
181
active
177
182
label = { i18next . t ( "Files" ) }
178
183
id = "files-section"
@@ -208,7 +213,8 @@ export class RDMDepositForm extends Component {
208
213
vocabularies = { this . vocabularies }
209
214
>
210
215
< AccordionField
211
- includesPaths = { sectionsConfig [ "basic-information-section" ] }
216
+ includesPaths = { this . sectionsConfig [ "basic-information-section" ] }
217
+ severityChecks = { this . severityChecks }
212
218
active
213
219
label = { i18next . t ( "Basic information" ) }
214
220
id = "basic-information-section"
@@ -366,7 +372,10 @@ export class RDMDepositForm extends Component {
366
372
record = { record }
367
373
>
368
374
< AccordionField
369
- includesPaths = { sectionsConfig [ "recommended-information-section" ] }
375
+ includesPaths = {
376
+ this . sectionsConfig [ "recommended-information-section" ]
377
+ }
378
+ severityChecks = { this . severityChecks }
370
379
label = { i18next . t ( "Recommended information" ) }
371
380
id = "recommended-information-section"
372
381
>
@@ -457,7 +466,8 @@ export class RDMDepositForm extends Component {
457
466
ui = { this . accordionStyle }
458
467
>
459
468
< AccordionField
460
- includesPaths = { sectionsConfig [ "funding-section" ] }
469
+ includesPaths = { this . sectionsConfig [ "funding-section" ] }
470
+ severityChecks = { this . severityChecks }
461
471
active
462
472
label = "Funding"
463
473
ui = { this . accordionStyle }
@@ -551,7 +561,8 @@ export class RDMDepositForm extends Component {
551
561
vocabularies = { this . vocabularies }
552
562
>
553
563
< AccordionField
554
- includesPaths = { sectionsConfig [ "alternate-identifiers-section" ] }
564
+ includesPaths = { this . sectionsConfig [ "alternate-identifiers-section" ] }
565
+ severityChecks = { this . severityChecks }
555
566
active
556
567
label = { i18next . t ( "Alternate identifiers" ) }
557
568
id = "alternate-identifiers-section"
@@ -577,7 +588,8 @@ export class RDMDepositForm extends Component {
577
588
vocabularies = { this . vocabularies }
578
589
>
579
590
< AccordionField
580
- includesPaths = { sectionsConfig [ "related-works-section" ] }
591
+ includesPaths = { this . sectionsConfig [ "related-works-section" ] }
592
+ severityChecks = { this . severityChecks }
581
593
active
582
594
label = { i18next . t ( "Related works" ) }
583
595
id = "related-works-section"
@@ -600,7 +612,8 @@ export class RDMDepositForm extends Component {
600
612
vocabularies = { this . vocabularies }
601
613
>
602
614
< AccordionField
603
- includesPaths = { sectionsConfig [ "references-section" ] }
615
+ includesPaths = { this . sectionsConfig [ "references-section" ] }
616
+ severityChecks = { this . severityChecks }
604
617
active
605
618
label = { i18next . t ( "References" ) }
606
619
id = "references-section"
0 commit comments