Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Oct 22, 2024
1 parent 9101969 commit 7d64190
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions client/app/src/pages/admin/settings/tab4/tab4.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
</tr>
</thead>
<tbody>
@for (item of customTextsKeys(); track item) {
<tr [ngClass]="{'bg-danger': !default_texts[item.key]}" ngbTooltip="{{!default_texts[item.key] ? 'This custom text is no longer displayed on the platform. The original text has either changed or been removed.' : '' | translate}}">
<td class="preformatted">{{ item.key }}</td>
<td class="preformatted">{{ default_texts[item.key] }}</td>
@for (item of custom_texts_keys; track item) {
<tr [ngClass]="{'bg-danger': !default_texts[item]}" ngbTooltip="{{!default_texts[item] ? 'This custom text is no longer displayed on the platform. The original text has either changed or been removed.' : '' | translate}}">
<td class="preformatted">{{ item }}</td>
<td class="preformatted">{{ default_texts[item] }}</td>
<td class="clearfix">
<span class="preformatted">{{ custom_texts[item.key] }}</span>
<button class="deleteCustomTextButton float-end btn btn-sm btn-danger" (click)="deleteCustomText(custom_texts,item.key); updateCustomText(custom_texts,vars.language_to_customize)">
<span class="preformatted">{{ custom_texts[item] }}</span>
<button class="deleteCustomTextButton float-end btn btn-sm btn-danger" (click)="deleteCustomText(custom_texts,item); updateCustomText(custom_texts,vars.language_to_customize)">
<i class="fa fa-times"></i>
</button>
</td>
Expand All @@ -66,4 +66,4 @@
</div>
</div>
</div>
}
}
7 changes: 4 additions & 3 deletions client/app/src/pages/admin/settings/tab4/tab4.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class Tab4Component implements OnInit {
custom_text: ""
};
custom_texts: { [key: string]: string } = {}
custom_texts_keys: string[] = [];
default_texts: { [key: string]: string } = {}
custom_texts_selector: { key: string; value: string; }[] = [];
customTextsExist: boolean = false;
Expand All @@ -50,10 +51,10 @@ export class Tab4Component implements OnInit {
}
this.utilsService.AdminL10NResource(lang).subscribe(res => {
this.custom_texts = res;
this.updateCustomTextsKeys();
this.customTextsExist = Object.keys(this.custom_texts).length > 0;
});

this.customTextsKeys();
this.utilsService.DefaultL10NResource(lang).subscribe(default_texts => {
const list = [];
for (const key in default_texts) {
Expand All @@ -70,8 +71,8 @@ export class Tab4Component implements OnInit {
});
}

customTextsKeys(): { key: string }[] {
return Object.keys(this.custom_texts).map(key => ({key}));
updateCustomTextsKeys(): void {
this.custom_texts_keys = Object.keys(this.custom_texts);
}

updateCustomText(data: { [key: string]: string }, lang: string) {
Expand Down

0 comments on commit 7d64190

Please sign in to comment.