TextComponent.editable
This commit is contained in:
parent
7dc4c3ca7c
commit
65617c1538
@ -60,7 +60,8 @@ export class UserService {
|
||||
return this.subject.subscribe(next);
|
||||
}
|
||||
|
||||
owns(group: Group): boolean {
|
||||
iOwn(group: Group): boolean {
|
||||
return this.user?.publicUuid === group.owner.publicUuid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,15 +8,15 @@
|
||||
<tr>
|
||||
<th>Titel</th>
|
||||
<td>
|
||||
<app-text *ngIf="userService.owns(group)" [initial]="group.title" (onChange)="changeTitle(group, $event)"></app-text>
|
||||
<ng-container *ngIf="!userService.owns(group)"></ng-container>
|
||||
<app-text [initial]="group.title" [editable]="userService.iOwn(group)" (onChange)="changeTitle(group, $event)"></app-text>
|
||||
<ng-container *ngIf="!userService.iOwn(group)"></ng-container>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Passwort</th>
|
||||
<td>
|
||||
<app-text *ngIf="userService.owns(group)" [initial]="group.password" (onChange)="changePassword(group, $event)"></app-text>
|
||||
<ng-container *ngIf="!userService.owns(group)"></ng-container>
|
||||
<app-text [initial]="group.password" [editable]="userService.iOwn(group)" (onChange)="changePassword(group, $event)"></app-text>
|
||||
<ng-container *ngIf="!userService.iOwn(group)"></ng-container>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -1 +1,2 @@
|
||||
<input [(ngModel)]="model" (focus)="begin()" (blur)="apply()" (keydown.enter)="apply()" (keydown.escape)="abort()">
|
||||
<input *ngIf="editable" [(ngModel)]="model" (focus)="begin()" (blur)="apply()" (keydown.enter)="apply()" (keydown.escape)="abort()">
|
||||
<div *ngIf="!editable">{{ _initial }}</div>
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {FormsModule} from "@angular/forms";
|
||||
import {NgIf} from "@angular/common";
|
||||
|
||||
@Component({
|
||||
selector: 'app-text',
|
||||
standalone: true,
|
||||
imports: [
|
||||
FormsModule
|
||||
FormsModule,
|
||||
NgIf
|
||||
],
|
||||
templateUrl: './text.component.html',
|
||||
styleUrl: './text.component.less'
|
||||
})
|
||||
export class TextComponent implements OnInit {
|
||||
|
||||
private _initial: string = "";
|
||||
protected _initial: string = "";
|
||||
|
||||
protected model: string = this._initial;
|
||||
|
||||
@ -29,6 +31,9 @@ export class TextComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
@Input()
|
||||
editable: boolean = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.model = this._initial;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user