Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ufal/vocabulaties-still-closed #446

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ <h4 class="modal-title">{{'vocabulary-treeview.header' | translate}}</h4>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit {
this.searchText = '';
}

add() {
const userVocabularyEntry = {
value: this.searchText,
display: this.searchText,
} as VocabularyEntryDetail;
this.select.emit(userVocabularyEntry);
}


/**
* Unsubscribe from all subscriptions
*/
Expand Down
5 changes: 4 additions & 1 deletion src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5879,5 +5879,8 @@

"navbar.about.service-integrations": "Service integrations",

"navbar.about.project-partnership": "Project partnerships"
"navbar.about.project-partnership": "Project partnerships",

"vocabulary-treeview.search.form.add": "Add",

}
Loading