Skip to content

Commit

Permalink
Clear funding input type only when the type is N/A (DSpace#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak authored Jun 4, 2024
1 parent bdf1343 commit d7394fa
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export class DsDynamicSponsorScrollableDropdownComponent extends DsDynamicScroll
(input as DsDynamicInputModel).value = '';
break;
case DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN:
(input as DynamicScrollableDropdownModel).value = '';
// Remove it only if the funding type is `N/A`
if (this.fundingTypeIsNotApplicable(fundingTypeValue)) {
(input as DynamicScrollableDropdownModel).value = '';
}
break;
default:
break;
Expand Down Expand Up @@ -142,10 +145,17 @@ export class DsDynamicSponsorScrollableDropdownComponent extends DsDynamicScroll
}

// if the funding type is `N/A` -> clean inputs
if (isEqual(fundingTypeValue, this.translateService.instant('autocomplete.suggestion.sponsor.empty'))) {
if (this.fundingTypeIsNotApplicable(fundingTypeValue)) {
return true;
}

return false;
}

/**
* Check if the funding type is `N/A`
*/
fundingTypeIsNotApplicable(fundingTypeValue) {
return isEqual(fundingTypeValue, this.translateService.instant('autocomplete.suggestion.sponsor.empty'));
}
}

0 comments on commit d7394fa

Please sign in to comment.