entry edit, fix menu touch
This commit is contained in:
@@ -32,6 +32,21 @@
|
||||
{{'settings.gravity.zero' | i18n}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<button
|
||||
*ngIf="user.settings.entryDelay || form.get('entryDelay').value != settings.defaultEntryDelay"
|
||||
matPrefix mat-icon-button (click)="resetEntryDelay()">
|
||||
<mat-icon>cancel</mat-icon>
|
||||
</button>
|
||||
<input type="number" min="0" max="15" step="1" matInput placeholder="{{'settings.entryDelay' | i18n}}"
|
||||
formControlName="entryDelay">
|
||||
<mat-hint *ngIf="form.get('entryDelay').value != 0">
|
||||
{{'settings.entryDelay.hint' | i18n}}
|
||||
</mat-hint>
|
||||
<mat-hint *ngIf="form.get('entryDelay').value == 0">
|
||||
{{'settings.entryDelay.zero' | i18n}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<button
|
||||
*ngIf="user.settings.commentDelay || form.get('commentDelay').value != settings.defaultCommentDelay"
|
||||
|
||||
@@ -30,6 +30,7 @@ export class PageSettings implements OnInit {
|
||||
email: [ '', Validators.nullValidator ],
|
||||
about: [ '', Validators.nullValidator ],
|
||||
gravity: [ '', Validators.nullValidator ],
|
||||
entryDelay: [ '', Validators.nullValidator ],
|
||||
commentDelay: [ '', Validators.nullValidator ],
|
||||
});
|
||||
|
||||
@@ -47,6 +48,7 @@ export class PageSettings implements OnInit {
|
||||
this.settingsService.settings.subscribe((settings) => {
|
||||
this.settings = settings;
|
||||
this.form.get('gravity').setValue(this.user.settings.gravity || this.settings.defaultGravity);
|
||||
this.form.get('entryDelay').setValue(this.user.settings.entryDelay || this.settings.defaultEntryDelay);
|
||||
this.form.get('commentDelay').setValue(this.user.settings.commentDelay || this.settings.defaultCommentDelay);
|
||||
});
|
||||
})
|
||||
@@ -63,6 +65,11 @@ export class PageSettings implements OnInit {
|
||||
this.form.get('gravity').setValue(this.settings.defaultGravity);
|
||||
}
|
||||
|
||||
resetEntryDelay(): void {
|
||||
this.user.settings.entryDelay = null;
|
||||
this.form.get('entryDelay').setValue(this.settings.defaultEntryDelay);
|
||||
}
|
||||
|
||||
resetCommentDelay(): void {
|
||||
this.user.settings.commentDelay = null;
|
||||
this.form.get('commentDelay').setValue(this.settings.defaultCommentDelay);
|
||||
@@ -89,10 +96,16 @@ export class PageSettings implements OnInit {
|
||||
this.user.settings.gravity = this.form.get('gravity').value;
|
||||
}
|
||||
|
||||
if (this.form.get('entryDelay').value != this.settings.defaultEntryDelay && !this.user.settings.entryDelay) {
|
||||
this.user.settings.entryDelay = this.form.get('entryDelay').value;
|
||||
} else if (this.user.settings.entryDelay) {
|
||||
this.user.settings.entryDelay = this.form.get('entryDelay').value;
|
||||
}
|
||||
|
||||
if (this.form.get('commentDelay').value != this.settings.defaultCommentDelay && !this.user.settings.commentDelay) {
|
||||
this.user.settings.commentDelay = this.form.get('commentDelay').value;
|
||||
} else if (this.user.settings.commentDelay) {
|
||||
this.user.settings.commentDelay = this.form.get('gravity').value;
|
||||
this.user.settings.commentDelay = this.form.get('commentDelay').value;
|
||||
}
|
||||
|
||||
this.userService.update(this.user).subscribe((data) => {
|
||||
|
||||
Reference in New Issue
Block a user