>
<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>
)
}
+ get routerLink () {
+ if (this.isUserLoggedIn()) {
+ return [ '/videos/upload' ]
+ } else if (this.isRegistrationAllowed()) {
+ return [ '/signup' ]
+ } else {
+ return [ '/login', { fromUpload: true } ]
+ }
+ }
+
doSearch () {
const queryParams: Params = {}
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)