diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-01 17:38:26 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-01 17:38:26 +0100 |
commit | c30745f342480b59fb0856a059c8c2fbffbcfc6a (patch) | |
tree | 06209d7831131120b097b538c0ed851f8e40a280 /client/src/app/account/account-details | |
parent | 2bbb34127fccd187ed690949b6791e49fdd77194 (diff) | |
download | PeerTube-c30745f342480b59fb0856a059c8c2fbffbcfc6a.tar.gz PeerTube-c30745f342480b59fb0856a059c8c2fbffbcfc6a.tar.zst PeerTube-c30745f342480b59fb0856a059c8c2fbffbcfc6a.zip |
Add account settings new design
Diffstat (limited to 'client/src/app/account/account-details')
3 files changed, 0 insertions, 85 deletions
diff --git a/client/src/app/account/account-details/account-details.component.html b/client/src/app/account/account-details/account-details.component.html deleted file mode 100644 index 8f4f176af..000000000 --- a/client/src/app/account/account-details/account-details.component.html +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
2 | |||
3 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> | ||
4 | <div class="form-group"> | ||
5 | <input | ||
6 | type="checkbox" id="displayNSFW" | ||
7 | formControlName="displayNSFW" | ||
8 | > | ||
9 | <label for="displayNSFW">Display videos that contain mature or explicit content</label> | ||
10 | <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger"> | ||
11 | {{ formErrors['displayNSFW'] }} | ||
12 | </div> | ||
13 | </div> | ||
14 | |||
15 | <input type="submit" value="Update" class="btn btn-default" [disabled]="!form.valid"> | ||
16 | </form> | ||
diff --git a/client/src/app/account/account-details/account-details.component.ts b/client/src/app/account/account-details/account-details.component.ts deleted file mode 100644 index d7a6e6871..000000000 --- a/client/src/app/account/account-details/account-details.component.ts +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | import { Component, OnInit, Input } from '@angular/core' | ||
2 | import { FormBuilder, FormGroup } from '@angular/forms' | ||
3 | import { Router } from '@angular/router' | ||
4 | |||
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | |||
7 | import { AuthService } from '../../core' | ||
8 | import { | ||
9 | FormReactive, | ||
10 | User, | ||
11 | UserService, | ||
12 | USER_PASSWORD | ||
13 | } from '../../shared' | ||
14 | import { UserUpdateMe } from '../../../../../shared' | ||
15 | |||
16 | @Component({ | ||
17 | selector: 'my-account-details', | ||
18 | templateUrl: './account-details.component.html' | ||
19 | }) | ||
20 | |||
21 | export class AccountDetailsComponent extends FormReactive implements OnInit { | ||
22 | @Input() user: User = null | ||
23 | |||
24 | error: string = null | ||
25 | |||
26 | form: FormGroup | ||
27 | formErrors = {} | ||
28 | validationMessages = {} | ||
29 | |||
30 | constructor ( | ||
31 | private authService: AuthService, | ||
32 | private formBuilder: FormBuilder, | ||
33 | private notificationsService: NotificationsService, | ||
34 | private userService: UserService | ||
35 | ) { | ||
36 | super() | ||
37 | } | ||
38 | |||
39 | buildForm () { | ||
40 | this.form = this.formBuilder.group({ | ||
41 | displayNSFW: [ this.user.displayNSFW ] | ||
42 | }) | ||
43 | |||
44 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) | ||
45 | } | ||
46 | |||
47 | ngOnInit () { | ||
48 | this.buildForm() | ||
49 | } | ||
50 | |||
51 | updateDetails () { | ||
52 | const displayNSFW = this.form.value['displayNSFW'] | ||
53 | const details: UserUpdateMe = { | ||
54 | displayNSFW | ||
55 | } | ||
56 | |||
57 | this.error = null | ||
58 | this.userService.updateMyDetails(details).subscribe( | ||
59 | () => { | ||
60 | this.notificationsService.success('Success', 'Information updated.') | ||
61 | |||
62 | this.authService.refreshUserInformation() | ||
63 | }, | ||
64 | |||
65 | err => this.error = err.message | ||
66 | ) | ||
67 | } | ||
68 | } | ||
diff --git a/client/src/app/account/account-details/index.ts b/client/src/app/account/account-details/index.ts deleted file mode 100644 index 4829f608a..000000000 --- a/client/src/app/account/account-details/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './account-details.component' | ||