Remember tab in upload page
This commit is contained in:
parent
32985a0a77
commit
3914a50b07
2 changed files with 23 additions and 7 deletions
|
@ -20,8 +20,8 @@
|
||||||
<ng-container *ngIf="secondStepType === 'upload'" i18n>Upload {{ videoName }}</ng-container>
|
<ng-container *ngIf="secondStepType === 'upload'" i18n>Upload {{ videoName }}</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [ngClass]="{ 'hide-nav': secondStepType !== undefined }">
|
<div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" [ngClass]="{ 'hide-nav': !!secondStepType }">
|
||||||
<ng-container ngbNavItem>
|
<ng-container ngbNavItem="upload">
|
||||||
<a ngbNavLink>
|
<a ngbNavLink>
|
||||||
<span i18n>Upload a file</span>
|
<span i18n>Upload a file</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container ngbNavItem *ngIf="isVideoImportHttpEnabled()">
|
<ng-container ngbNavItem="import-url" *ngIf="isVideoImportHttpEnabled()">
|
||||||
<a ngbNavLink>
|
<a ngbNavLink>
|
||||||
<span i18n>Import with URL</span>
|
<span i18n>Import with URL</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container ngbNavItem *ngIf="isVideoImportTorrentEnabled()">
|
<ng-container ngbNavItem="import-torrent" *ngIf="isVideoImportTorrentEnabled()">
|
||||||
<a ngbNavLink>
|
<a ngbNavLink>
|
||||||
<span i18n>Import with torrent</span>
|
<span i18n>Import with torrent</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container ngbNavItem *ngIf="isVideoLiveEnabled()">
|
<ng-container ngbNavItem="go-live" *ngIf="isVideoLiveEnabled()">
|
||||||
<a ngbNavLink>
|
<a ngbNavLink>
|
||||||
<span i18n>Go live</span>
|
<span i18n>Go live</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
|
import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
|
import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
|
||||||
import { ServerConfig } from '@shared/models'
|
import { ServerConfig } from '@shared/models'
|
||||||
import { VideoEditType } from './shared/video-edit.type'
|
import { VideoEditType } from './shared/video-edit.type'
|
||||||
|
@ -22,11 +23,16 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
|
||||||
|
|
||||||
secondStepType: VideoEditType
|
secondStepType: VideoEditType
|
||||||
videoName: string
|
videoName: string
|
||||||
serverConfig: ServerConfig
|
|
||||||
|
activeNav: string
|
||||||
|
|
||||||
|
private serverConfig: ServerConfig
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private auth: AuthService,
|
private auth: AuthService,
|
||||||
private serverService: ServerService
|
private serverService: ServerService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
get userInformationLoaded () {
|
get userInformationLoaded () {
|
||||||
|
@ -42,6 +48,16 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
|
||||||
.subscribe(config => this.serverConfig = config)
|
.subscribe(config => this.serverConfig = config)
|
||||||
|
|
||||||
this.user = this.auth.getUser()
|
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) {
|
onFirstStepDone (type: VideoEditType, videoName: string) {
|
||||||
|
|
Loading…
Reference in a new issue