ActivityPub-federated video streaming platform using P2P directly in your web browser
Add loader when expanding long video description
Chocobozzz80958c78fdc7
diff --git a/client/src/app/videos/video-list/shared/loader.component.html b/client/src/app/shared/misc/loader.component.htmlsimilarity index 100%rename from client/src/app/videos/video-list/shared/loader.component.htmlrename to client/src/app/shared/misc/loader.component.htmldiff --git a/client/src/app/videos/video-list/shared/loader.component.ts b/client/src/app/shared/misc/loader.component.tssimilarity index 100%rename from client/src/app/videos/video-list/shared/loader.component.tsrename to client/src/app/shared/misc/loader.component.tsdiff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.tsindex 47f651590c..456ce851e5 100644--- a/client/src/app/shared/shared.module.ts+++ b/client/src/app/shared/shared.module.ts@@ -19,6 +19,7 @@ import { SearchComponent, SearchService } from './search'import { UserService } from './users'import { VideoAbuseService } from './video-abuse'import { VideoBlacklistService } from './video-blacklist'+import { LoaderComponent } from './misc/loader.component'@NgModule({imports: [@@ -40,7 +41,8 @@ import { VideoBlacklistService } from './video-blacklist'declarations: [BytesPipe,KeysPipe,- SearchComponent+ SearchComponent,+ LoaderComponent],exports: [@@ -59,7 +61,8 @@ import { VideoBlacklistService } from './video-blacklist'BytesPipe,KeysPipe,- SearchComponent+ SearchComponent,+ LoaderComponent],providers: [diff --git a/client/src/app/videos/+video-edit/video-edit.component.scss b/client/src/app/videos/+video-edit/shared/video-edit.component.scsssimilarity index 100%rename from client/src/app/videos/+video-edit/video-edit.component.scssrename to client/src/app/videos/+video-edit/shared/video-edit.component.scssdiff --git a/client/src/app/videos/+video-edit/video-edit.module.ts b/client/src/app/videos/+video-edit/shared/video-edit.module.tssimilarity index 88%rename from client/src/app/videos/+video-edit/video-edit.module.tsrename to client/src/app/videos/+video-edit/shared/video-edit.module.tsindex 33f6549600..c64cea9203 100644--- a/client/src/app/videos/+video-edit/video-edit.module.ts+++ b/client/src/app/videos/+video-edit/shared/video-edit.module.ts@@ -3,8 +3,8 @@ import { NgModule } from '@angular/core'import { TagInputModule } from 'ngx-chips'import { TabsModule } from 'ngx-bootstrap/tabs'-import { VideoService, MarkdownService, VideoDescriptionComponent } from '../shared'-import { SharedModule } from '../../shared'+import { VideoService, MarkdownService, VideoDescriptionComponent } from '../../shared'+import { SharedModule } from '../../../shared'@NgModule({imports: [diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.tsindex c8094f7927..1704cf486f 100644--- a/client/src/app/videos/+video-edit/video-add.component.ts+++ b/client/src/app/videos/+video-edit/video-add.component.ts@@ -23,7 +23,7 @@ import { HttpEventType, HttpResponse } from '@angular/common/http'@Component({selector: 'my-videos-add',- styleUrls: [ './video-edit.component.scss' ],+ styleUrls: [ './shared/video-edit.component.scss' ],templateUrl: './video-add.component.html'})diff --git a/client/src/app/videos/+video-edit/video-add.module.ts b/client/src/app/videos/+video-edit/video-add.module.tsindex 3d937b008f..f58d12dac6 100644--- a/client/src/app/videos/+video-edit/video-add.module.ts+++ b/client/src/app/videos/+video-edit/video-add.module.ts@@ -1,9 +1,8 @@import { NgModule } from '@angular/core'-+import { SharedModule } from '../../shared'+import { VideoEditModule } from './shared/video-edit.module'import { VideoAddRoutingModule } from './video-add-routing.module'import { VideoAddComponent } from './video-add.component'-import { VideoEditModule } from './video-edit.module'-import { SharedModule } from '../../shared'@NgModule({imports: [diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.tsindex be663575f5..0e966cb509 100644--- a/client/src/app/videos/+video-edit/video-update.component.ts+++ b/client/src/app/videos/+video-edit/video-update.component.ts@@ -21,7 +21,7 @@ import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.@Component({selector: 'my-videos-update',- styleUrls: [ './video-edit.component.scss' ],+ styleUrls: [ './shared/video-edit.component.scss' ],templateUrl: './video-update.component.html'})diff --git a/client/src/app/videos/+video-edit/video-update.module.ts b/client/src/app/videos/+video-edit/video-update.module.tsindex f7bd77c752..3b45c72a53 100644--- a/client/src/app/videos/+video-edit/video-update.module.ts+++ b/client/src/app/videos/+video-edit/video-update.module.ts@@ -1,9 +1,8 @@import { NgModule } from '@angular/core'-+import { SharedModule } from '../../shared'+import { VideoEditModule } from './shared/video-edit.module'import { VideoUpdateRoutingModule } from './video-update-routing.module'import { VideoUpdateComponent } from './video-update.component'-import { VideoEditModule } from './video-edit.module'-import { SharedModule } from '../../shared'@NgModule({imports: [diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.htmlindex fd3ce2b84f..f528d73c31 100644--- a/client/src/app/videos/+video-watch/video-watch.component.html+++ b/client/src/app/videos/+video-watch/video-watch.component.html@@ -130,14 +130,15 @@<div class="video-details-description" [innerHTML]="videoHTMLDescription"></div>- <div *ngIf="completeDescriptionShown === false && video.description.length === 250" (click)="showMoreDescription()" class="video-details-description-more">+ <div class="video-details-description-more" *ngIf="completeDescriptionShown === false && video.description.length === 250" (click)="showMoreDescription()">Show more- <span class="glyphicon glyphicon-menu-down"></span>+ <span *ngIf="descriptionLoading === false" class="glyphicon glyphicon-menu-down"></span>+ <my-loader class="description-loading" [loading]="descriptionLoading"></my-loader></div><div *ngIf="completeDescriptionShown === true" (click)="showLessDescription()" class="video-details-description-more">Show less- <span class="glyphicon glyphicon-menu-up"></span>+ <span *ngIf="descriptionLoading === false" class="glyphicon glyphicon-menu-up"></span></div></div>diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scssindex fcad7f7b0d..cad21dd189 100644--- a/client/src/app/videos/+video-watch/video-watch.component.scss+++ b/client/src/app/videos/+video-watch/video-watch.component.scss@@ -166,6 +166,10 @@.video-details-date-description {padding-left: $video-watch-info-padding-left;+ .description-loading {+ display: inline-block;+ }+.video-details-date {font-weight: bold;margin-bottom: 30px;diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.tsindex 5e2486b9ce..2a7290cbd9 100644--- a/client/src/app/videos/+video-watch/video-watch.component.ts+++ b/client/src/app/videos/+video-watch/video-watch.component.ts@@ -16,6 +16,7 @@ import { VideoReportComponent } from './video-report.component'import { VideoDetails, VideoService, MarkdownService } from '../shared'import { VideoBlacklistService } from '../../shared'import { UserVideoRateType, VideoRateType } from '../../../../../shared'+import { BehaviorSubject } from 'rxjs/BehaviorSubject'@Component({selector: 'my-video-watch',@@ -38,6 +39,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {video: VideoDetails = nullvideoPlayerLoaded = falsevideoNotFound = false+ descriptionLoading = falsecompleteDescriptionShown = falsecompleteVideoDescription: string@@ -159,32 +161,39 @@ export class VideoWatchComponent implements OnInit, OnDestroy {}showMoreDescription () {- this.completeDescriptionShown = true-if (this.completeVideoDescription === undefined) {return this.loadCompleteDescription()}this.updateVideoDescription(this.completeVideoDescription)+ this.completeDescriptionShown = true}showLessDescription () {- this.completeDescriptionShown = falsethis.updateVideoDescription(this.shortVideoDescription)+ this.completeDescriptionShown = false}loadCompleteDescription () {+ this.descriptionLoading = true+this.videoService.loadCompleteDescription(this.video.descriptionPath).subscribe(description => {+ this.completeDescriptionShown = true+ this.descriptionLoading = false+this.shortVideoDescription = this.video.descriptionthis.completeVideoDescription = descriptionthis.updateVideoDescription(this.completeVideoDescription)},- error => this.notificationsService.error('Error', error.text)+ error => {+ this.descriptionLoading = false+ this.notificationsService.error('Error', error.text)+ })}diff --git a/client/src/app/videos/video-list/shared/index.ts b/client/src/app/videos/video-list/shared/index.tsindex 2c9804e6df..d8f73bcda3 100644--- a/client/src/app/videos/video-list/shared/index.ts+++ b/client/src/app/videos/video-list/shared/index.ts@@ -1,4 +1,3 @@export * from './abstract-video-list'-export * from './loader.component'export * from './video-miniature.component'export * from './video-sort.component'diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.tsindex ecc351b654..4f3054c3a7 100644--- a/client/src/app/videos/videos.module.ts+++ b/client/src/app/videos/videos.module.ts@@ -1,16 +1,9 @@import { NgModule } from '@angular/core'-+import { SharedModule } from '../shared'+import { VideoService } from './shared'+import { MyVideosComponent, VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list'import { VideosRoutingModule } from './videos-routing.module'import { VideosComponent } from './videos.component'-import {- LoaderComponent,- VideoListComponent,- MyVideosComponent,- VideoMiniatureComponent,- VideoSortComponent-} from './video-list'-import { VideoService } from './shared'-import { SharedModule } from '../shared'@NgModule({imports: [@@ -24,9 +17,7 @@ import { SharedModule } from '../shared'VideoListComponent,MyVideosComponent,VideoMiniatureComponent,- VideoSortComponent,-- LoaderComponent+ VideoSortComponent],exports: [