1
0
Fork 0

Remember tab in upload page

This commit is contained in:
Chocobozzz 2021-05-11 15:03:30 +02:00
parent 32985a0a77
commit 3914a50b07
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 23 additions and 7 deletions

View file

@ -20,8 +20,8 @@
<ng-container *ngIf="secondStepType === 'upload'" i18n>Upload {{ videoName }}</ng-container>
</div>
<div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [ngClass]="{ 'hide-nav': secondStepType !== undefined }">
<ng-container ngbNavItem>
<div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" [ngClass]="{ 'hide-nav': !!secondStepType }">
<ng-container ngbNavItem="upload">
<a ngbNavLink>
<span i18n>Upload a file</span>
</a>
@ -31,7 +31,7 @@
</ng-template>
</ng-container>
<ng-container ngbNavItem *ngIf="isVideoImportHttpEnabled()">
<ng-container ngbNavItem="import-url" *ngIf="isVideoImportHttpEnabled()">
<a ngbNavLink>
<span i18n>Import with URL</span>
</a>
@ -41,7 +41,7 @@
</ng-template>
</ng-container>
<ng-container ngbNavItem *ngIf="isVideoImportTorrentEnabled()">
<ng-container ngbNavItem="import-torrent" *ngIf="isVideoImportTorrentEnabled()">
<a ngbNavLink>
<span i18n>Import with torrent</span>
</a>
@ -51,7 +51,7 @@
</ng-template>
</ng-container>
<ng-container ngbNavItem *ngIf="isVideoLiveEnabled()">
<ng-container ngbNavItem="go-live" *ngIf="isVideoLiveEnabled()">
<a ngbNavLink>
<span i18n>Go live</span>
</a>

View file

@ -1,4 +1,5 @@
import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
import { ServerConfig } from '@shared/models'
import { VideoEditType } from './shared/video-edit.type'
@ -22,11 +23,16 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
secondStepType: VideoEditType
videoName: string
serverConfig: ServerConfig
activeNav: string
private serverConfig: ServerConfig
constructor (
private auth: AuthService,
private serverService: ServerService
private serverService: ServerService,
private route: ActivatedRoute,
private router: Router
) {}
get userInformationLoaded () {
@ -42,6 +48,16 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
.subscribe(config => this.serverConfig = config)
this.user = this.auth.getUser()
if (this.route.snapshot.fragment) {
this.onNavChange(this.route.snapshot.fragment)
}
}
onNavChange (newActiveNav: string) {
this.activeNav = newActiveNav
this.router.navigate([], { fragment: this.activeNav })
}
onFirstStepDone (type: VideoEditType, videoName: string) {