Skip to content

Commit

Permalink
Merge pull request #410 from datacite/fix_bug_nametye_unknown
Browse files Browse the repository at this point in the history
fix: 🐛 enable setting values for when name-type is not defined/unk…
  • Loading branch information
kjgarza authored May 11, 2020
2 parents 1e64a15 + 9f646ce commit a981308
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions app/components/person-base-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,35 @@ export default Component.extend({
this.set('isReadonlyNameParts', false);
this.set('isReadonlyNameType', false);
}
switch (true) {
case this.fragment.get('nameType') === 'Personal':
this.set('isReadonly', true);

if (this.fragment.get('nameType') === 'Personal') {
this.set('isReadonly', true);

this.fragment.set('givenName', options.givenName);
this.fragment.set('familyName', options.familyName);
this.fragment.set('givenName', options.givenName);
this.fragment.set('familyName', options.familyName);

if (options.givenName && options.familyName) {
this.fragment.set('name', options.familyName + ', ' + options.givenName);
} else if (options.givenName) {
this.fragment.set('name', options.givenName);
} else if (options.familyName) {
this.fragment.set('name', options.familyName);
} else {
this.fragment.set('name', '');
}
} else {
this.fragment.set('givenName', null);
this.fragment.set('familyName', null);
this.fragment.set('name', options.name);
this.set('isReadonly', false);
if (options.givenName && options.familyName) {
this.fragment.set('name', options.familyName + ', ' + options.givenName);
} else if (options.givenName) {
this.fragment.set('name', options.givenName);
} else if (options.familyName) {
this.fragment.set('name', options.familyName);
} else {
this.fragment.set('name', '');
}
return true;
case this.fragment.get('nameType') === 'Organizational':
this.fragment.set('givenName', null);
this.fragment.set('familyName', null);
this.fragment.set('name', options.name);
this.set('isReadonly', false);
return true;
default:
this.fragment.set('givenName', options.givenName);
this.fragment.set('familyName', options.familyName);
this.fragment.set('name', options.name);
this.set('isReadonly', false);
return true;
}
},
selectNameType(value) {
Expand Down

0 comments on commit a981308

Please sign in to comment.