Skip to content
Snippets Groups Projects
Commit 49c2b00e authored by Mohammad Alayoub's avatar Mohammad Alayoub
Browse files

added notification if there are no keywords in search mode

parent 7c58293f
No related merge requests found
......@@ -14,7 +14,7 @@
[(ngModel)]="searchedKeyword" matInput type="text"
placeholder="{{'topic-cloud-dialog.keyword-search' | translate}}">
<button *ngIf="searchedKeyword !== ''"
(click)="searchedKeyword = ''; hideKeywords = false;"
(click)="searchedKeyword = ''; searchMode = false;"
mat-button matSuffix mat-icon-button aria-label="topic-cloud-dialog.keyword-search">
<mat-icon>close</mat-icon>
</button>
......@@ -38,9 +38,16 @@
</mat-menu>
<mat-accordion>
<mat-expansion-panel hideToggle *ngIf="searchMode && filteredKeywords.length === 0">
<mat-expansion-panel-header>
<mat-panel-title fxLayoutAlign="center">
{{'topic-cloud-dialog.noKeywords' | translate}}
</mat-panel-title>
</mat-expansion-panel-header>
</mat-expansion-panel>
<mat-expansion-panel (opened)="panelOpenState = true"
(closed)="panelOpenState = false"
*ngFor="let keyword of (hideKeywords ? filteredKeywords : keywords)">
*ngFor="let keyword of (searchMode ? filteredKeywords : keywords)">
<mat-expansion-panel-header class="color">
<mat-panel-title [ngClass]="{'edit-keyword': editedKeyword}">
{{keyword.keyword}}
......
......@@ -65,5 +65,4 @@ mat-panel-title, mat-panel-description {
animation-iteration-count: 2;
opacity: 1.0 !important;
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ export class TopicCloudAdministrationComponent implements OnInit {
sortModeEnum: typeof SortMode = SortMode; // needed for use in template
editedKeyword:boolean = false;
searchedKeyword: string = "";
hideKeywords: boolean = false;
searchMode: boolean = false;
filteredKeywords: Keyword[] = [];
keywords: Keyword[] = [
......@@ -174,9 +174,13 @@ export class TopicCloudAdministrationComponent implements OnInit {
if (keyword.keywordID == id)
this.keywords.splice(this.keywords.indexOf(keyword, 0), 1);
});
if (this.keywords.length == 0) {
if (this.keywords.length === 0) {
this.cloudDialogRef.close();
}
if (this.searchMode === true){
/* update filtered array if it is searchmode */
this.searchKeyword();
}
}
cancelEdit(): void {
......@@ -209,12 +213,12 @@ export class TopicCloudAdministrationComponent implements OnInit {
searchKeyword(): void{
if (this.searchedKeyword === ''){
this.hideKeywords = false;
this.searchMode = false;
} else{
this.filteredKeywords = this.keywords.filter(keyword =>
keyword.keyword.toLowerCase().includes(this.searchedKeyword)
);
this.hideKeywords = true;
this.searchMode = true;
}
}
}
......
......@@ -114,6 +114,8 @@ export class TagCloudComponent implements OnInit {
}
openAdministrationDialog(){
this.dialog.open(TopicCloudAdministrationComponent);
this.dialog.open(TopicCloudAdministrationComponent, {
minWidth: '50%'
});
}
}
......@@ -306,7 +306,8 @@
"considerVotes": "Votes berücksichtigen",
"sort-Alpha": "alphabetisch",
"sort-Count": "Fragenanzahl",
"keyword-search": "Keyword suchen"
"keyword-search": "Keyword suchen",
"noKeywords": "Es gibt keine Keywords"
},
"topic-cloud-confirm-dialog":{
"cancel": "abbrechen",
......
......@@ -309,7 +309,8 @@
"considerVotes": "Consider Votes",
"sort-Alpha": "Alphabetically",
"sort-Count": "questions count",
"keyword-search": "search keyword"
"keyword-search": "search keyword",
"noKeywords": "there are no keywords"
},
"topic-cloud-confirm-dialog":{
"cancel": "cancel",
......
......@@ -229,7 +229,8 @@
"tags-lowercase": "Themen klein schreiben",
"sort-Alpha": "Alphabetisch",
"sort-Count": "Fragenanzahl",
"keyword-search": "keyword suchen"
"keyword-search": "keyword suchen",
"noKeywords": "es gibt keine keywords"
},
"topic-cloud-confirm-dialog":{
"cancel": "Abbrechen",
......
......@@ -235,7 +235,8 @@
"tags-lowercase": "Topics in lowercase",
"sort-Alpha": "Alphabetically",
"sort-Count": "Questions count",
"keyword-search": "search keyword"
"keyword-search": "search keyword",
"noKeywords": "there are no keywords"
},
"topic-cloud-confirm-dialog":{
"cancel": "Cancel",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment