Skip to content

Commit

Permalink
Load previous keyword from file properly
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox committed Jan 17, 2025
1 parent 0c613f3 commit 50c0174
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deposit/static/deposit/js/metadata-form.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions metadata_form/src/js/TreeKeywordSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TreeKeywordSelector extends React.Component {
// Filter out empty objects (when no keyword has been selected yet for example)
newVal = this.props.formData.filter(x => !this.isEmpty(x)).map((keyObj) => {
// Convert schema structure to expected structure for TreeSelect
if (Object.keys(keyObj).includes('valueURI')) {
if (Object.keys(keyObj).includes('valueUri')) {
return { label: keyObj.subject, value: [keyObj.subject, keyObj.valueUri].join(':') }
} else {
return { label: keyObj.subject, value: keyObj.subject + ':' }
Expand Down Expand Up @@ -183,10 +183,12 @@ class TreeKeywordSelector extends React.Component {
const title = this.props.schema.title || this.props.uiSchema['ui:title']
const required = this.props.required
const fullLine = title + (required ? '*' : '')
const labelClasses = "w-100" + (required ? ' select-required' : '')
+ (this.fieldNeedsAttention() ? ' text-danger' : '')
+ ((!('minItems' in this.props.schema) && required) ||
(required && 'minItems' in this.props.schema && this.state.value.length >= this.props.schema.minItems) ? ' select-filled' : '')
const labelClasses = 'w-100' + (required ? ' select-required' : '') +
(this.fieldNeedsAttention() ? ' text-danger' : '') +
((!('minItems' in this.props.schema) && required) ||
(required && 'minItems' in this.props.schema && this.state.value.length >= this.props.schema.minItems)
? ' select-filled'
: '')
return <label className={labelClasses}>{fullLine}</label>
}

Expand Down
2 changes: 1 addition & 1 deletion research/static/research/js/metadata-form.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vault/static/vault/js/metadata-form.js

Large diffs are not rendered by default.

0 comments on commit 50c0174

Please sign in to comment.