profile + i18n
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<mat-dialog-content>
|
||||
{{text}}
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false">{{'cancel' | i18n}}</button>
|
||||
<button mat-raised-button [mat-dialog-close]="true" color="accent">{{'confirm' | i18n}}</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,3 @@
|
||||
mat-form-field {
|
||||
display: block;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import {MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||
import {I18nService} from '../../services/i18n.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'confirm.component.html',
|
||||
styleUrls: ['./confirm.component.scss']
|
||||
})
|
||||
export class ConfirmDialog {
|
||||
|
||||
|
||||
text;
|
||||
|
||||
constructor(private i18nService: I18nService,
|
||||
public dialogRef: MatDialogRef<ConfirmDialog>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.text = i18nService.get(data.label, data.args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1 mat-dialog-title></h1>
|
||||
<h1 mat-dialog-title>{{'profileField.name.' + profileField.name | i18n}}</h1>
|
||||
<mat-dialog-content>
|
||||
<pre>
|
||||
{{profileField.blob}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1 mat-dialog-title></h1>
|
||||
<h1 mat-dialog-title>{{'profileField.name.' + profileField.name | i18n}}</h1>
|
||||
<mat-dialog-content>
|
||||
<form [formGroup]="form">
|
||||
<mat-form-field>
|
||||
|
||||
@@ -4,6 +4,7 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||
import {I18nService} from '../../services/i18n.service';
|
||||
import {ProfileService} from '../../services/profile.service';
|
||||
import {ConfirmDialog} from '../confirm/confirm.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profilefields',
|
||||
@@ -55,7 +56,7 @@ export class ProfileFieldsComponent implements OnInit {
|
||||
|
||||
const dialogRef = this.dialog.open(ProfileFieldDialog, {
|
||||
data: profileField,
|
||||
minWidth : '400px'
|
||||
minWidth: '400px'
|
||||
});
|
||||
|
||||
|
||||
@@ -74,16 +75,27 @@ export class ProfileFieldsComponent implements OnInit {
|
||||
}
|
||||
|
||||
confirmDelete(profileField) {
|
||||
this.profileService.delete(profileField.name).subscribe((result: any) => {
|
||||
this.profileFields.splice(this.profileFields.indexOf(profileField), 1);
|
||||
this.profileFields = [...this.profileFields];
|
||||
const dialogRef = this.dialog.open(ConfirmDialog, {
|
||||
data: {
|
||||
'label': 'profileField.confirmDelete',
|
||||
'args': ['profileField.name.' + profileField.name]
|
||||
}
|
||||
})
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if(result) {
|
||||
this.profileService.delete(profileField.name).subscribe((result: any) => {
|
||||
this.profileFields.splice(this.profileFields.indexOf(profileField), 1);
|
||||
this.profileFields = [...this.profileFields];
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openCreate() {
|
||||
const dialogRef = this.dialog.open(ProfileFieldDialog, {
|
||||
data: {"type": "TEXT", "visibility": "PRIVATE"},
|
||||
minWidth : '400px'
|
||||
minWidth: '400px'
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
@@ -100,7 +112,7 @@ export class ProfileFieldsComponent implements OnInit {
|
||||
openBlob(profileField) {
|
||||
this.dialog.open(ProfileFieldBlob, {
|
||||
data: profileField,
|
||||
minWidth : '400px'
|
||||
minWidth: '400px'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user