diff options
Diffstat (limited to 'client/src/app/header')
-rw-r--r-- | client/src/app/header/header.component.html | 2 | ||||
-rw-r--r-- | client/src/app/header/header.component.ts | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html index 4b3d5e105..599861817 100644 --- a/client/src/app/header/header.component.html +++ b/client/src/app/header/header.component.html | |||
@@ -4,7 +4,7 @@ | |||
4 | > | 4 | > |
5 | <span (click)="doSearch()" class="icon icon-search"></span> | 5 | <span (click)="doSearch()" class="icon icon-search"></span> |
6 | 6 | ||
7 | <a class="upload-button" (click)="goToUpload()"> | 7 | <a class="upload-button" [routerLink]="routerLink"> |
8 | <my-global-icon iconName="upload"></my-global-icon> | 8 | <my-global-icon iconName="upload"></my-global-icon> |
9 | <span i18n class="upload-button-label">Upload</span> | 9 | <span i18n class="upload-button-label">Upload</span> |
10 | </a> | 10 | </a> |
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts index 192d6945b..580535669 100644 --- a/client/src/app/header/header.component.ts +++ b/client/src/app/header/header.component.ts | |||
@@ -42,6 +42,16 @@ export class HeaderComponent implements OnInit { | |||
42 | ) | 42 | ) |
43 | } | 43 | } |
44 | 44 | ||
45 | get routerLink () { | ||
46 | if (this.isUserLoggedIn()) { | ||
47 | return [ '/videos/upload' ] | ||
48 | } else if (this.isRegistrationAllowed()) { | ||
49 | return [ '/signup' ] | ||
50 | } else { | ||
51 | return [ '/login', { fromUpload: true } ] | ||
52 | } | ||
53 | } | ||
54 | |||
45 | doSearch () { | 55 | doSearch () { |
46 | const queryParams: Params = {} | 56 | const queryParams: Params = {} |
47 | 57 | ||
@@ -67,16 +77,6 @@ export class HeaderComponent implements OnInit { | |||
67 | this.serverConfig.signup.allowedForCurrentIP | 77 | this.serverConfig.signup.allowedForCurrentIP |
68 | } | 78 | } |
69 | 79 | ||
70 | goToUpload () { | ||
71 | if (this.isUserLoggedIn()) { | ||
72 | this.router.navigate([ '/videos/upload' ]) | ||
73 | } else if (this.isRegistrationAllowed()) { | ||
74 | this.router.navigate([ '/signup' ]) | ||
75 | } else { | ||
76 | this.router.navigate([ '/login', { fromUpload: true } ]) | ||
77 | } | ||
78 | } | ||
79 | |||
80 | private loadUserLanguagesIfNeeded (queryParams: any) { | 80 | private loadUserLanguagesIfNeeded (queryParams: any) { |
81 | if (queryParams && queryParams.languageOneOf) return of(queryParams) | 81 | if (queryParams && queryParams.languageOneOf) return of(queryParams) |
82 | 82 | ||