mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
Merge pull request #2615 from DSpace/backport-2602-to-dspace-7_x
[Port dspace-7_x] Support for freetext values in submission for vocabulary controlled `onebox` and `tag` types
This commit is contained in:
@@ -89,6 +89,18 @@ export class DsDynamicTagComponent extends DsDynamicVocabularyComponent implemen
|
||||
}
|
||||
}),
|
||||
map((list: PaginatedList<VocabularyEntry>) => list.page),
|
||||
// Add user input as last item of the list
|
||||
map((list: VocabularyEntry[]) => {
|
||||
if (list && list.length > 0) {
|
||||
if (isNotEmpty(this.currentValue)) {
|
||||
let vocEntry = new VocabularyEntry();
|
||||
vocEntry.display = this.currentValue;
|
||||
vocEntry.value = this.currentValue;
|
||||
list.push(vocEntry);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}),
|
||||
tap(() => this.changeSearchingStatus(false)),
|
||||
merge(this.hideSearchingWhenUnsubscribed));
|
||||
|
||||
|
@@ -10,6 +10,9 @@
|
||||
<button class="btn btn-outline-secondary" type="button" (click)="reset()">
|
||||
{{'vocabulary-treeview.search.form.reset' | translate}}
|
||||
</button>
|
||||
<button class="btn btn-outline-primary" type="button" (click)="add()" [disabled]="this.vocabularyOptions.closed">
|
||||
{{'vocabulary-treeview.search.form.add' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -293,6 +293,15 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
|
||||
}
|
||||
}
|
||||
|
||||
add() {
|
||||
const userVocabularyEntry = {
|
||||
value: this.searchText,
|
||||
display: this.searchText,
|
||||
} as VocabularyEntryDetail;
|
||||
this.select.emit(userVocabularyEntry);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unsubscribe from all subscriptions
|
||||
*/
|
||||
|
@@ -5240,4 +5240,6 @@
|
||||
|
||||
"access-control-option-end-date-note": "Select the date until which the related access condition is applied",
|
||||
|
||||
"vocabulary-treeview.search.form.add": "Add",
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user