From 06f44efe7706e13b175b6c8d59de579eea43b0c2 Mon Sep 17 00:00:00 2001 From: Dara Silvera <dara.silvera@fing.edu.uy> Date: Tue, 8 Nov 2022 23:33:50 -0300 Subject: [PATCH] Traducciones aregladas para matefun y grupos --- .../src/app/layout/grupos/grupos.component.ts | 31 ++++++++++--------- .../app/layout/matefun/matefun.component.ts | 20 ++++++++---- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/Frontend Angular 4/src/app/layout/grupos/grupos.component.ts b/Frontend Angular 4/src/app/layout/grupos/grupos.component.ts index 36adbec..e8e3994 100755 --- a/Frontend Angular 4/src/app/layout/grupos/grupos.component.ts +++ b/Frontend Angular 4/src/app/layout/grupos/grupos.component.ts @@ -84,6 +84,12 @@ export class GruposComponent { }); } + private notificationTypeDictonarty = { + error: (message: string) => this.notifService.error(message), + success: (message: string) => this.notifService.success(message), + warning: (message: string) => this.notifService.warning(message), + }; + ngOnInit() { let cedula = this.authService.getUser().cedula; this.loading = true; @@ -97,6 +103,12 @@ export class GruposComponent { ); } + showNotification(type: "error" | "success" | "warning", traslation: string) { + this.translateService + .get(traslation) + .subscribe(this.notificationTypeDictonarty[type]); + } + //ordenar archivos del grupo seleccionado. ordenarAlph(a, b) { if (a.nombre.toLowerCase() < b.nombre.toLowerCase()) return -1; @@ -238,20 +250,11 @@ export class GruposComponent { } cargarArchivoCompartido() { - if (this.archivoSeleccionado) { - if (this.archivoSeleccionado.directorio) { - this.notifService.warning( - this.translateService.get("i18n.warning.file.noSelected").value, - false - ); - } else { - this.sessionService.setArchivo(this.archivoSeleccionado); - this.router.navigate(["/matefun"]); - } - } else { - this.notifService.warning( - this.translateService.get("i18n.warning.file.noSelected").value - ); + if (!this.archivoSeleccionado || this.archivoSeleccionado.directorio) { + this.showNotification("warning", "i18n.warning.file.noSelected"); + return; } + this.sessionService.setArchivo(this.archivoSeleccionado); + this.router.navigate(["/matefun"]); } } diff --git a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts index 36fdb1b..ce36cef 100755 --- a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts +++ b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts @@ -385,6 +385,12 @@ export class MateFunComponent { } } + private notificationTypeDictonarty = { + error: (message: string) => this.notifService.error(message), + success: (message: string) => this.notifService.success(message), + warning: (message: string) => this.notifService.warning(message), + }; + ngOnInit() { window["matefunComponent"] = { component: this }; @@ -504,6 +510,12 @@ export class MateFunComponent { } } + showNotification(type: "error" | "success" | "warning", traslation: string) { + this.translateService + .get(traslation) + .subscribe(this.notificationTypeDictonarty[type]); + } + makeAJump() { if (this.jump) { this.jump = false; @@ -808,9 +820,7 @@ export class MateFunComponent { const padreId = event.detail.padreId; if (nombre == undefined || nombre == "") { - this.notifService.error( - this.translateService.get("i18n.warning.file.invalidName").value - ); + this.showNotification("error", "i18n.warning.file.invalidName"); return; } @@ -818,9 +828,7 @@ export class MateFunComponent { var regex = /^[A-Z]/; if (!regex.test(nombre)) { - this.notifService.error( - this.translateService.get("i18n.warning.file.capitalLetter").value - ); + this.showNotification("error", "i18n.warning.file.capitalLetter"); return; } -- GitLab