Skip to content
Snippets Groups Projects
Commit b6aad3eb authored by Stefan Plociennik's avatar Stefan Plociennik
Browse files

selected spacy labels are now written in topic cloud admin data for other groups

parent a5fe4e9a
Branches
Tags
No related merge requests found
export interface TopicCloudAdminData {
blacklist: string[];
wantedLabels: Labels;
wantedLabels: {
de: string[];
en: string[];
};
considerVotes: boolean;
profanityFilter: boolean;
blacklistIsActive: boolean;
......
......@@ -114,15 +114,15 @@
<mat-tab-group mat-align-tabs="center">
<mat-tab label="German">
<mat-selection-list>
<mat-list-option selected=true class="color-on-surface" *ngFor="let label of wantedLabels.de">
<mat-selection-list [(ngModel)]="wantedLabels.de">
<mat-list-option selected=true [value]="label.tag" class="color-on-surface" *ngFor="let label of spacyLabels.de">
{{label.label + " (" + label.tag + ")"}}
</mat-list-option>
</mat-selection-list>
</mat-tab>
<mat-tab label="English">
<mat-selection-list>
<mat-list-option selected=true class="color-on-surface" *ngFor="let label of wantedLabels.en">
<mat-selection-list [(ngModel)]="wantedLabels.en">
<mat-list-option selected=true [value]="label.tag" class="color-on-surface" *ngFor="let label of spacyLabels.en">
{{label.label + " (" + label.tag + ")"}}
</mat-list-option>
</mat-selection-list>
......@@ -130,7 +130,6 @@
</mat-tab-group>
</mat-expansion-panel>
</mat-accordion>
</mat-expansion-panel>
</mat-accordion>
......
......@@ -43,9 +43,11 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
keywordORfulltext: string = undefined;
userRole: UserRole;
wantedLabels: Labels;
englishLabels = true;
germanLabels = true;
spacyLabels: Labels;
wantedLabels: {
de: string[];
en: string[];
};
keywords: Keyword[] = [];
private topicCloudAdminData: TopicCloudAdminData;
......@@ -71,8 +73,12 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
this.blacklistSubscription = this.topicCloudAdminService.getBlacklist().subscribe(list => this.blacklist = list);
this.isCreatorOrMod = this.data ? (this.data.user.role !== UserRole.PARTICIPANT) : true;
this.translateService.use(localStorage.getItem('currentLang'));
this.spacyLabels = spacyLabels;
this.wantedLabels = {
de: [],
en: []
};
this.setDefaultAdminData();
this.wantedLabels = spacyLabels;
}
ngOnDestroy(){
......@@ -108,10 +114,13 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
});
}
setAdminData(){
setAdminData() {
this.topicCloudAdminData = {
blacklist: [],
wantedLabels: this.wantedLabels,
wantedLabels: {
de: this.wantedLabels.de,
en: this.wantedLabels.en
},
considerVotes: this.considerVotes,
profanityFilter: this.profanityFilter,
blacklistIsActive: this.blacklistIsActive,
......@@ -127,7 +136,10 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
this.profanityFilter = this.topicCloudAdminData.profanityFilter;
this.blacklistIsActive = this.topicCloudAdminData.blacklistIsActive;
this.keywordORfulltext = KeywordOrFulltext[this.topicCloudAdminData.keywordORfulltext];
this.wantedLabels = this.topicCloudAdminData.wantedLabels;
this.wantedLabels = {
de: this.topicCloudAdminData.wantedLabels.de,
en: this.topicCloudAdminData.wantedLabels.en
};
}
}
......@@ -289,7 +301,7 @@ export class TopicCloudAdministrationComponent implements OnInit, OnDestroy {
this.topicCloudAdminService.removeWordFromBlacklist(word);
}
refreshAllLists(){
refreshAllLists() {
this.searchKeyword();
}
}
......
......@@ -40,7 +40,10 @@ export class TopicCloudAdminService {
if (!data) {
data = {
blacklist: [],
wantedLabels: new Labels([], []),
wantedLabelsDE: {
de: [],
en: []
},
considerVotes: false,
profanityFilter: true,
blacklistIsActive: false,
......
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