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 | |
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')
18 files changed, 136 insertions, 114 deletions
diff --git a/client/src/app/account/account-change-password/account-change-password.component.html b/client/src/app/account/account-change-password/account-change-password.component.html deleted file mode 100644 index 92d9f900a..000000000 --- a/client/src/app/account/account-change-password/account-change-password.component.html +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
2 | |||
3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> | ||
4 | <div class="form-group"> | ||
5 | <label for="new-password">New password</label> | ||
6 | <input | ||
7 | type="password" class="form-control" id="new-password" | ||
8 | formControlName="new-password" | ||
9 | > | ||
10 | <div *ngIf="formErrors['new-password']" class="alert alert-danger"> | ||
11 | {{ formErrors['new-password'] }} | ||
12 | </div> | ||
13 | </div> | ||
14 | |||
15 | <div class="form-group"> | ||
16 | <label for="name">Confirm new password</label> | ||
17 | <input | ||
18 | type="password" class="form-control" id="new-confirmed-password" | ||
19 | formControlName="new-confirmed-password" | ||
20 | > | ||
21 | </div> | ||
22 | |||
23 | <input type="submit" value="Change password" class="btn btn-default" [disabled]="!form.valid"> | ||
24 | </form> | ||
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-routing.module.ts b/client/src/app/account/account-routing.module.ts index 74d9aa03e..2e9de1cfb 100644 --- a/client/src/app/account/account-routing.module.ts +++ b/client/src/app/account/account-routing.module.ts | |||
@@ -5,17 +5,33 @@ import { MetaGuard } from '@ngx-meta/core' | |||
5 | 5 | ||
6 | import { LoginGuard } from '../core' | 6 | import { LoginGuard } from '../core' |
7 | import { AccountComponent } from './account.component' | 7 | import { AccountComponent } from './account.component' |
8 | import { AccountSettingsComponent } from './account-settings/account-settings.component' | ||
8 | 9 | ||
9 | const accountRoutes: Routes = [ | 10 | const accountRoutes: Routes = [ |
10 | { | 11 | { |
11 | path: 'account', | 12 | path: 'account', |
12 | component: AccountComponent, | 13 | component: AccountComponent, |
13 | canActivate: [ MetaGuard, LoginGuard ], | 14 | canActivateChild: [ MetaGuard, LoginGuard ], |
14 | data: { | 15 | children: [ |
15 | meta: { | 16 | { |
16 | title: 'My account' | 17 | path: 'settings', |
17 | } | 18 | component: AccountSettingsComponent, |
18 | } | 19 | data: { |
20 | meta: { | ||
21 | title: 'Account settings' | ||
22 | } | ||
23 | } | ||
24 | }, | ||
25 | // { | ||
26 | // path: 'videos', | ||
27 | // component: AccountVideosComponent, | ||
28 | // data: { | ||
29 | // meta: { | ||
30 | // title: 'Account videos' | ||
31 | // } | ||
32 | // } | ||
33 | // } | ||
34 | ] | ||
19 | } | 35 | } |
20 | ] | 36 | ] |
21 | 37 | ||
diff --git a/client/src/app/account/account-settings/account-change-password/account-change-password.component.html b/client/src/app/account/account-settings/account-change-password/account-change-password.component.html new file mode 100644 index 000000000..bfb55218f --- /dev/null +++ b/client/src/app/account/account-settings/account-change-password/account-change-password.component.html | |||
@@ -0,0 +1,18 @@ | |||
1 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
2 | |||
3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> | ||
4 | <input | ||
5 | type="password" class="form-control" id="new-password" placeholder="Old password" | ||
6 | formControlName="new-password" | ||
7 | > | ||
8 | <div *ngIf="formErrors['new-password']" class="alert alert-danger"> | ||
9 | {{ formErrors['new-password'] }} | ||
10 | </div> | ||
11 | |||
12 | <input | ||
13 | type="password" id="new-confirmed-password" placeholder="New password" | ||
14 | formControlName="new-confirmed-password" | ||
15 | > | ||
16 | |||
17 | <input type="submit" value="Change password" [disabled]="!form.valid"> | ||
18 | </form> | ||
diff --git a/client/src/app/account/account-settings/account-change-password/account-change-password.component.scss b/client/src/app/account/account-settings/account-change-password/account-change-password.component.scss new file mode 100644 index 000000000..593355b70 --- /dev/null +++ b/client/src/app/account/account-settings/account-change-password/account-change-password.component.scss | |||
@@ -0,0 +1,9 @@ | |||
1 | input[type=password] { | ||
2 | @include peertube-input-text(340px); | ||
3 | display: block; | ||
4 | margin-bottom: 10px; | ||
5 | } | ||
6 | |||
7 | input[type=submit] { | ||
8 | @include peertube-button; | ||
9 | } | ||
diff --git a/client/src/app/account/account-change-password/account-change-password.component.ts b/client/src/app/account/account-settings/account-change-password/account-change-password.component.ts index 69edec54b..8979e1734 100644 --- a/client/src/app/account/account-change-password/account-change-password.component.ts +++ b/client/src/app/account/account-settings/account-change-password/account-change-password.component.ts | |||
@@ -1,16 +1,13 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { Router } from '@angular/router' | ||
4 | |||
5 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
6 | 4 | import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' | |
7 | import { FormReactive, UserService, USER_PASSWORD } from '../../shared' | ||
8 | 5 | ||
9 | @Component({ | 6 | @Component({ |
10 | selector: 'my-account-change-password', | 7 | selector: 'my-account-change-password', |
11 | templateUrl: './account-change-password.component.html' | 8 | templateUrl: './account-change-password.component.html', |
9 | styleUrls: [ './account-change-password.component.scss' ] | ||
12 | }) | 10 | }) |
13 | |||
14 | export class AccountChangePasswordComponent extends FormReactive implements OnInit { | 11 | export class AccountChangePasswordComponent extends FormReactive implements OnInit { |
15 | error: string = null | 12 | error: string = null |
16 | 13 | ||
diff --git a/client/src/app/account/account-change-password/index.ts b/client/src/app/account/account-settings/account-change-password/index.ts index 44c330b66..44c330b66 100644 --- a/client/src/app/account/account-change-password/index.ts +++ b/client/src/app/account/account-settings/account-change-password/index.ts | |||
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.html b/client/src/app/account/account-settings/account-details/account-details.component.html new file mode 100644 index 000000000..c3cf6b629 --- /dev/null +++ b/client/src/app/account/account-settings/account-details/account-details.component.html | |||
@@ -0,0 +1,14 @@ | |||
1 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
2 | |||
3 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> | ||
4 | <input | ||
5 | type="checkbox" id="displayNSFW" | ||
6 | formControlName="displayNSFW" | ||
7 | > | ||
8 | <label for="displayNSFW">Display videos that contain mature or explicit content</label> | ||
9 | <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger"> | ||
10 | {{ formErrors['displayNSFW'] }} | ||
11 | </div> | ||
12 | |||
13 | <input type="submit" value="Update" [disabled]="!form.valid"> | ||
14 | </form> | ||
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.scss b/client/src/app/account/account-settings/account-details/account-details.component.scss new file mode 100644 index 000000000..b1810d4f9 --- /dev/null +++ b/client/src/app/account/account-settings/account-details/account-details.component.scss | |||
@@ -0,0 +1,11 @@ | |||
1 | label { | ||
2 | font-size: 15px; | ||
3 | font-weight: $font-regular; | ||
4 | margin-left: 5px; | ||
5 | } | ||
6 | |||
7 | input[type=submit] { | ||
8 | @include peertube-button; | ||
9 | |||
10 | display: block; | ||
11 | } | ||
diff --git a/client/src/app/account/account-details/account-details.component.ts b/client/src/app/account/account-settings/account-details/account-details.component.ts index d7a6e6871..d835c53e5 100644 --- a/client/src/app/account/account-details/account-details.component.ts +++ b/client/src/app/account/account-settings/account-details/account-details.component.ts | |||
@@ -1,21 +1,14 @@ | |||
1 | import { Component, OnInit, Input } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { Router } from '@angular/router' | ||
4 | |||
5 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
6 | 4 | import { UserUpdateMe } from '../../../../../../shared' | |
7 | import { AuthService } from '../../core' | 5 | import { AuthService } from '../../../core' |
8 | import { | 6 | import { FormReactive, User, UserService } from '../../../shared' |
9 | FormReactive, | ||
10 | User, | ||
11 | UserService, | ||
12 | USER_PASSWORD | ||
13 | } from '../../shared' | ||
14 | import { UserUpdateMe } from '../../../../../shared' | ||
15 | 7 | ||
16 | @Component({ | 8 | @Component({ |
17 | selector: 'my-account-details', | 9 | selector: 'my-account-details', |
18 | templateUrl: './account-details.component.html' | 10 | templateUrl: './account-details.component.html', |
11 | styleUrls: [ './account-details.component.scss' ] | ||
19 | }) | 12 | }) |
20 | 13 | ||
21 | export class AccountDetailsComponent extends FormReactive implements OnInit { | 14 | export class AccountDetailsComponent extends FormReactive implements OnInit { |
diff --git a/client/src/app/account/account-details/index.ts b/client/src/app/account/account-settings/account-details/index.ts index 4829f608a..4829f608a 100644 --- a/client/src/app/account/account-details/index.ts +++ b/client/src/app/account/account-settings/account-details/index.ts | |||
diff --git a/client/src/app/account/account-settings/account-settings.component.html b/client/src/app/account/account-settings/account-settings.component.html new file mode 100644 index 000000000..2509eb5aa --- /dev/null +++ b/client/src/app/account/account-settings/account-settings.component.html | |||
@@ -0,0 +1,9 @@ | |||
1 | <div class="user-info"> | ||
2 | {{ user.username }} | ||
3 | </div> | ||
4 | |||
5 | <div class="account-title">Account settings</div> | ||
6 | <my-account-change-password></my-account-change-password> | ||
7 | |||
8 | <div class="account-title">Filtering</div> | ||
9 | <my-account-details [user]="user"></my-account-details> | ||
diff --git a/client/src/app/account/account-settings/account-settings.component.scss b/client/src/app/account/account-settings/account-settings.component.scss new file mode 100644 index 000000000..a0822631d --- /dev/null +++ b/client/src/app/account/account-settings/account-settings.component.scss | |||
@@ -0,0 +1,13 @@ | |||
1 | .user-info { | ||
2 | font-size: 20px; | ||
3 | font-weight: $font-bold; | ||
4 | } | ||
5 | |||
6 | .account-title { | ||
7 | text-transform: uppercase; | ||
8 | color: $orange-color; | ||
9 | font-weight: $font-bold; | ||
10 | font-size: 13px; | ||
11 | margin-top: 55px; | ||
12 | margin-bottom: 30px; | ||
13 | } | ||
diff --git a/client/src/app/account/account-settings/account-settings.component.ts b/client/src/app/account/account-settings/account-settings.component.ts new file mode 100644 index 000000000..c3b670e02 --- /dev/null +++ b/client/src/app/account/account-settings/account-settings.component.ts | |||
@@ -0,0 +1,18 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { User } from '../../shared' | ||
3 | import { AuthService } from '../../core' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-account-settings', | ||
7 | templateUrl: './account-settings.component.html', | ||
8 | styleUrls: [ './account-settings.component.scss' ] | ||
9 | }) | ||
10 | export class AccountSettingsComponent implements OnInit { | ||
11 | user: User = null | ||
12 | |||
13 | constructor (private authService: AuthService) {} | ||
14 | |||
15 | ngOnInit () { | ||
16 | this.user = this.authService.getUser() | ||
17 | } | ||
18 | } | ||
diff --git a/client/src/app/account/account.component.html b/client/src/app/account/account.component.html index 177e54999..d82a4ca4d 100644 --- a/client/src/app/account/account.component.html +++ b/client/src/app/account/account.component.html | |||
@@ -1,25 +1,11 @@ | |||
1 | <div class="row"> | 1 | <div class="row"> |
2 | <div class="content-padding"> | 2 | <div class="sub-menu"> |
3 | <h3>Account</h3> | 3 | <a routerLink="/account/settings" routerLinkActive="active" class="title-page">My account</a> |
4 | 4 | ||
5 | <div class="col-md-6 col-sm-12"> | 5 | <a routerLink="/account/videos" routerLinkActive="active" class="title-page">My videos</a> |
6 | <div class="panel panel-default"> | 6 | </div> |
7 | <div class="panel-heading">Change password</div> | ||
8 | |||
9 | <div class="panel-body"> | ||
10 | <my-account-change-password></my-account-change-password> | ||
11 | </div> | ||
12 | </div> | ||
13 | </div> | ||
14 | |||
15 | <div class="col-md-6 col-sm-12"> | ||
16 | <div class="panel panel-default"> | ||
17 | <div class="panel-heading">Update my informations</div> | ||
18 | 7 | ||
19 | <div class="panel-body"> | 8 | <div class="margin-content"> |
20 | <my-account-details [user]="user"></my-account-details> | 9 | <router-outlet></router-outlet> |
21 | </div> | ||
22 | </div> | ||
23 | </div> | ||
24 | </div> | 10 | </div> |
25 | </div> | 11 | </div> |
diff --git a/client/src/app/account/account.component.scss b/client/src/app/account/account.component.scss index 61b80d0a7..e69de29bb 100644 --- a/client/src/app/account/account.component.scss +++ b/client/src/app/account/account.component.scss | |||
@@ -1,3 +0,0 @@ | |||
1 | .panel { | ||
2 | margin-top: 40px; | ||
3 | } | ||
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts index 929934f67..3d3677ab0 100644 --- a/client/src/app/account/account.component.ts +++ b/client/src/app/account/account.component.ts | |||
@@ -1,28 +1,8 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component } 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 | 2 | ||
15 | @Component({ | 3 | @Component({ |
16 | selector: 'my-account', | 4 | selector: 'my-account', |
17 | templateUrl: './account.component.html', | 5 | templateUrl: './account.component.html', |
18 | styleUrls: [ './account.component.scss' ] | 6 | styleUrls: [ './account.component.scss' ] |
19 | }) | 7 | }) |
20 | export class AccountComponent implements OnInit { | 8 | export class AccountComponent {} |
21 | user: User = null | ||
22 | |||
23 | constructor (private authService: AuthService) {} | ||
24 | |||
25 | ngOnInit () { | ||
26 | this.user = this.authService.getUser() | ||
27 | } | ||
28 | } | ||
diff --git a/client/src/app/account/account.module.ts b/client/src/app/account/account.module.ts index 380e9d235..ff444ddeb 100644 --- a/client/src/app/account/account.module.ts +++ b/client/src/app/account/account.module.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | 2 | import { SharedModule } from '../shared' | |
3 | import { AccountRoutingModule } from './account-routing.module' | 3 | import { AccountRoutingModule } from './account-routing.module' |
4 | import { AccountChangePasswordComponent } from './account-settings/account-change-password/account-change-password.component' | ||
5 | import { AccountDetailsComponent } from './account-settings/account-details/account-details.component' | ||
6 | import { AccountSettingsComponent } from './account-settings/account-settings.component' | ||
4 | import { AccountComponent } from './account.component' | 7 | import { AccountComponent } from './account.component' |
5 | import { AccountChangePasswordComponent } from './account-change-password' | ||
6 | import { AccountDetailsComponent } from './account-details' | ||
7 | import { AccountService } from './account.service' | 8 | import { AccountService } from './account.service' |
8 | import { SharedModule } from '../shared' | ||
9 | 9 | ||
10 | @NgModule({ | 10 | @NgModule({ |
11 | imports: [ | 11 | imports: [ |
@@ -15,6 +15,7 @@ import { SharedModule } from '../shared' | |||
15 | 15 | ||
16 | declarations: [ | 16 | declarations: [ |
17 | AccountComponent, | 17 | AccountComponent, |
18 | AccountSettingsComponent, | ||
18 | AccountChangePasswordComponent, | 19 | AccountChangePasswordComponent, |
19 | AccountDetailsComponent | 20 | AccountDetailsComponent |
20 | ], | 21 | ], |