Reinstate routerLink property of upload button
authorRigel Kent <sendmemail@rigelk.eu>
Fri, 10 Jan 2020 14:52:25 +0000 (15:52 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Fri, 10 Jan 2020 14:52:25 +0000 (15:52 +0100)
client/src/app/header/header.component.html
client/src/app/header/header.component.ts

index 4b3d5e10515c5a1e2ed5fcd0bfb9d0dadc9c978f..5998618174b8138dc86f711a01c64392a1736edb 100644 (file)
@@ -4,7 +4,7 @@
 >
 <span (click)="doSearch()" class="icon icon-search"></span>
 
-<a class="upload-button" (click)="goToUpload()">
+<a class="upload-button" [routerLink]="routerLink">
   <my-global-icon iconName="upload"></my-global-icon>
   <span i18n class="upload-button-label">Upload</span>
 </a>
index 192d6945b3fcffd2763d6ebc7ba76ca4ec601731..5805356691ec261bf1f423ad97cf36140cb14239 100644 (file)
@@ -42,6 +42,16 @@ export class HeaderComponent implements OnInit {
     )
   }
 
+  get routerLink () {
+    if (this.isUserLoggedIn()) {
+      return [ '/videos/upload' ]
+    } else if (this.isRegistrationAllowed()) {
+      return [ '/signup' ]
+    } else {
+      return [ '/login', { fromUpload: true } ]
+    }
+  }
+
   doSearch () {
     const queryParams: Params = {}
 
@@ -67,16 +77,6 @@ export class HeaderComponent implements OnInit {
            this.serverConfig.signup.allowedForCurrentIP
   }
 
-  goToUpload () {
-    if (this.isUserLoggedIn()) {
-      this.router.navigate([ '/videos/upload' ])
-    } else if (this.isRegistrationAllowed()) {
-      this.router.navigate([ '/signup' ])
-    } else {
-      this.router.navigate([ '/login', { fromUpload: true } ])
-    }
-  }
-
   private loadUserLanguagesIfNeeded (queryParams: any) {
     if (queryParams && queryParams.languageOneOf) return of(queryParams)