Skip to content

Commit

Permalink
client: new routes for create/update channel
Browse files Browse the repository at this point in the history
  • Loading branch information
kontrollanten committed Dec 12, 2021
1 parent 740d1da commit 1ff6b64
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 30 deletions.
31 changes: 31 additions & 0 deletions client/src/app/+manage/manage-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { VideoChannelCreateComponent } from './video-channel-edit/video-channel-create.component'
import { VideoChannelUpdateComponent } from './video-channel-edit/video-channel-update.component'

const manageRoutes: Routes = [
{
path: 'create',
component: VideoChannelCreateComponent,
data: {
meta: {
title: $localize`Create a new video channel`
}
}
},
{
path: 'update/:videoChannelName',
component: VideoChannelUpdateComponent,
data: {
meta: {
title: $localize`Update video channel`
}
}
}
]

@NgModule({
imports: [ RouterModule.forChild(manageRoutes) ],
exports: [ RouterModule ]
})
export class ManageRoutingModule {}
36 changes: 36 additions & 0 deletions client/src/app/+manage/manage.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { NgModule } from '@angular/core'
import { SharedFormModule } from '@app/shared/shared-forms'
import { SharedGlobalIconModule } from '@app/shared/shared-icons'
import { SharedMainModule } from '@app/shared/shared-main'
import { SharedModerationModule } from '@app/shared/shared-moderation'
import { SharedSupportModal } from '@app/shared/shared-support-modal'
import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
import { SharedActorImageModule } from '../shared/shared-actor-image/shared-actor-image.module'
import { SharedActorImageEditModule } from '@app/shared/shared-actor-image-edit'
import { VideoChannelCreateComponent } from './video-channel-edit/video-channel-create.component'
import { VideoChannelUpdateComponent } from './video-channel-edit/video-channel-update.component'
import { ManageRoutingModule } from './manage-routing.module'

@NgModule({
imports: [
ManageRoutingModule,
SharedMainModule,
SharedFormModule,
SharedGlobalIconModule,
SharedActorImageModule,
SharedActorImageEditModule
],

declarations: [
VideoChannelCreateComponent,
VideoChannelUpdateComponent
],

exports: [
],

providers: []
})
export class ManageModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const myVideoChannelsRoutes: Routes = [
title: $localize`My video channels`
}
}
},
{
path: 'create',
redirectTo: '/manage/create'
},
{
path: 'update/:videoChannelName',
redirectTo: '/manage/update/:videoChannelName'
}
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>
<div class="video-channels-header d-flex justify-content-between">
<my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>

<a class="create-button" routerLink="/c/@create">
<a class="create-button" routerLink="/manage/create">
<my-global-icon iconName="add" aria-hidden="true"></my-global-icon>
<ng-container i18n>Create video channel</ng-container>
</a>
Expand Down Expand Up @@ -37,7 +37,7 @@ <h1>
<div i18n class="video-channel-videos">{videoChannel.videosCount, plural, =0 {No videos} =1 {1 video} other {{{ videoChannel.videosCount }} videos}}</div>

<div class="video-channel-buttons">
<my-edit-button label [routerLink]="[ '/c', videoChannel.nameWithHost, 'update' ]"></my-edit-button>
<my-edit-button label [routerLink]="[ '/manage/update', videoChannel.nameWithHost ]"></my-edit-button>
<my-delete-button label (click)="deleteVideoChannel(videoChannel)"></my-delete-button>
</div>

Expand Down
21 changes: 0 additions & 21 deletions client/src/app/+video-channels/video-channels-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { VideoChannelCreateComponent } from './video-channel-edit/video-channel-create.component'
import { VideoChannelUpdateComponent } from './video-channel-edit/video-channel-update.component'
import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-channel-playlists.component'
import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component'
import { VideoChannelsComponent } from './video-channels.component'

const videoChannelsRoutes: Routes = [
{
path: '@create',
component: VideoChannelCreateComponent,
data: {
meta: {
title: $localize`Create a new video channel`
}
}
},
{
path: ':videoChannelName',
component: VideoChannelsComponent,
Expand Down Expand Up @@ -48,16 +37,6 @@ const videoChannelsRoutes: Routes = [
}
}
]
},
{
path: ':videoChannelName/update',
component: VideoChannelUpdateComponent,

data: {
meta: {
title: $localize`Update video channel`
}
}
}
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="channel-info">

<ng-template #buttonsTemplate>
<a *ngIf="isManageable()" [routerLink]="[ 'update' ]" class="peertube-button-link orange-button" i18n>
<a *ngIf="isManageable()" [routerLink]="[ '/manage/update', videoChannel.nameWithHost ]" class="peertube-button-link orange-button" i18n>
Manage channel
</a>

Expand Down
6 changes: 1 addition & 5 deletions client/src/app/+video-channels/video-channels.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { VideoChannelPlaylistsComponent } from './video-channel-playlists/video-
import { VideoChannelVideosComponent } from './video-channel-videos/video-channel-videos.component'
import { VideoChannelsRoutingModule } from './video-channels-routing.module'
import { VideoChannelsComponent } from './video-channels.component'
import { VideoChannelCreateComponent } from './video-channel-edit/video-channel-create.component'
import { VideoChannelUpdateComponent } from './video-channel-edit/video-channel-update.component'
import { SharedActorImageEditModule } from '@app/shared/shared-actor-image-edit'

@NgModule({
Expand All @@ -35,9 +33,7 @@ import { SharedActorImageEditModule } from '@app/shared/shared-actor-image-edit'
declarations: [
VideoChannelsComponent,
VideoChannelVideosComponent,
VideoChannelPlaylistsComponent,
VideoChannelCreateComponent,
VideoChannelUpdateComponent
VideoChannelPlaylistsComponent
],

exports: [
Expand Down
6 changes: 5 additions & 1 deletion client/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ const routes: Routes = [
loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
canActivateChild: [ MetaGuard ]
},

{
path: 'manage',
loadChildren: () => import('./+manage/manage.module').then(m => m.ManageModule),
canActivateChild: [ MetaGuard ]
},
{
path: 'about',
loadChildren: () => import('./+about/about.module').then(m => m.AboutModule),
Expand Down

0 comments on commit 1ff6b64

Please sign in to comment.