1
0
Fork 0

Add loader when expanding long video description

This commit is contained in:
Chocobozzz 2017-11-28 15:40:53 +01:00
parent 83c663ef0e
commit 80958c78fd
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
14 changed files with 38 additions and 33 deletions

View File

@ -19,6 +19,7 @@ import { SearchComponent, SearchService } from './search'
import { UserService } from './users' import { UserService } from './users'
import { VideoAbuseService } from './video-abuse' import { VideoAbuseService } from './video-abuse'
import { VideoBlacklistService } from './video-blacklist' import { VideoBlacklistService } from './video-blacklist'
import { LoaderComponent } from './misc/loader.component'
@NgModule({ @NgModule({
imports: [ imports: [
@ -40,7 +41,8 @@ import { VideoBlacklistService } from './video-blacklist'
declarations: [ declarations: [
BytesPipe, BytesPipe,
KeysPipe, KeysPipe,
SearchComponent SearchComponent,
LoaderComponent
], ],
exports: [ exports: [
@ -59,7 +61,8 @@ import { VideoBlacklistService } from './video-blacklist'
BytesPipe, BytesPipe,
KeysPipe, KeysPipe,
SearchComponent SearchComponent,
LoaderComponent
], ],
providers: [ providers: [

View File

@ -3,8 +3,8 @@ import { NgModule } from '@angular/core'
import { TagInputModule } from 'ngx-chips' import { TagInputModule } from 'ngx-chips'
import { TabsModule } from 'ngx-bootstrap/tabs' import { TabsModule } from 'ngx-bootstrap/tabs'
import { VideoService, MarkdownService, VideoDescriptionComponent } from '../shared' import { VideoService, MarkdownService, VideoDescriptionComponent } from '../../shared'
import { SharedModule } from '../../shared' import { SharedModule } from '../../../shared'
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -23,7 +23,7 @@ import { HttpEventType, HttpResponse } from '@angular/common/http'
@Component({ @Component({
selector: 'my-videos-add', selector: 'my-videos-add',
styleUrls: [ './video-edit.component.scss' ], styleUrls: [ './shared/video-edit.component.scss' ],
templateUrl: './video-add.component.html' templateUrl: './video-add.component.html'
}) })

View File

@ -1,9 +1,8 @@
import { NgModule } from '@angular/core' import { NgModule } from '@angular/core'
import { SharedModule } from '../../shared'
import { VideoEditModule } from './shared/video-edit.module'
import { VideoAddRoutingModule } from './video-add-routing.module' import { VideoAddRoutingModule } from './video-add-routing.module'
import { VideoAddComponent } from './video-add.component' import { VideoAddComponent } from './video-add.component'
import { VideoEditModule } from './video-edit.module'
import { SharedModule } from '../../shared'
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -21,7 +21,7 @@ import { VideoPrivacy } from '../../../../../shared/models/videos/video-privacy.
@Component({ @Component({
selector: 'my-videos-update', selector: 'my-videos-update',
styleUrls: [ './video-edit.component.scss' ], styleUrls: [ './shared/video-edit.component.scss' ],
templateUrl: './video-update.component.html' templateUrl: './video-update.component.html'
}) })

View File

@ -1,9 +1,8 @@
import { NgModule } from '@angular/core' import { NgModule } from '@angular/core'
import { SharedModule } from '../../shared'
import { VideoEditModule } from './shared/video-edit.module'
import { VideoUpdateRoutingModule } from './video-update-routing.module' import { VideoUpdateRoutingModule } from './video-update-routing.module'
import { VideoUpdateComponent } from './video-update.component' import { VideoUpdateComponent } from './video-update.component'
import { VideoEditModule } from './video-edit.module'
import { SharedModule } from '../../shared'
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -130,14 +130,15 @@
<div class="video-details-description" [innerHTML]="videoHTMLDescription"></div> <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 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>
<div *ngIf="completeDescriptionShown === true" (click)="showLessDescription()" class="video-details-description-more"> <div *ngIf="completeDescriptionShown === true" (click)="showLessDescription()" class="video-details-description-more">
Show less Show less
<span class="glyphicon glyphicon-menu-up"></span> <span *ngIf="descriptionLoading === false" class="glyphicon glyphicon-menu-up"></span>
</div> </div>
</div> </div>

View File

@ -166,6 +166,10 @@
.video-details-date-description { .video-details-date-description {
padding-left: $video-watch-info-padding-left; padding-left: $video-watch-info-padding-left;
.description-loading {
display: inline-block;
}
.video-details-date { .video-details-date {
font-weight: bold; font-weight: bold;
margin-bottom: 30px; margin-bottom: 30px;

View File

@ -16,6 +16,7 @@ import { VideoReportComponent } from './video-report.component'
import { VideoDetails, VideoService, MarkdownService } from '../shared' import { VideoDetails, VideoService, MarkdownService } from '../shared'
import { VideoBlacklistService } from '../../shared' import { VideoBlacklistService } from '../../shared'
import { UserVideoRateType, VideoRateType } from '../../../../../shared' import { UserVideoRateType, VideoRateType } from '../../../../../shared'
import { BehaviorSubject } from 'rxjs/BehaviorSubject'
@Component({ @Component({
selector: 'my-video-watch', selector: 'my-video-watch',
@ -38,6 +39,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
video: VideoDetails = null video: VideoDetails = null
videoPlayerLoaded = false videoPlayerLoaded = false
videoNotFound = false videoNotFound = false
descriptionLoading = false
completeDescriptionShown = false completeDescriptionShown = false
completeVideoDescription: string completeVideoDescription: string
@ -159,32 +161,39 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
} }
showMoreDescription () { showMoreDescription () {
this.completeDescriptionShown = true
if (this.completeVideoDescription === undefined) { if (this.completeVideoDescription === undefined) {
return this.loadCompleteDescription() return this.loadCompleteDescription()
} }
this.updateVideoDescription(this.completeVideoDescription) this.updateVideoDescription(this.completeVideoDescription)
this.completeDescriptionShown = true
} }
showLessDescription () { showLessDescription () {
this.completeDescriptionShown = false
this.updateVideoDescription(this.shortVideoDescription) this.updateVideoDescription(this.shortVideoDescription)
this.completeDescriptionShown = false
} }
loadCompleteDescription () { loadCompleteDescription () {
this.descriptionLoading = true
this.videoService.loadCompleteDescription(this.video.descriptionPath) this.videoService.loadCompleteDescription(this.video.descriptionPath)
.subscribe( .subscribe(
description => { description => {
this.completeDescriptionShown = true
this.descriptionLoading = false
this.shortVideoDescription = this.video.description this.shortVideoDescription = this.video.description
this.completeVideoDescription = description this.completeVideoDescription = description
this.updateVideoDescription(this.completeVideoDescription) this.updateVideoDescription(this.completeVideoDescription)
}, },
error => this.notificationsService.error('Error', error.text) error => {
this.descriptionLoading = false
this.notificationsService.error('Error', error.text)
}
) )
} }

View File

@ -1,4 +1,3 @@
export * from './abstract-video-list' export * from './abstract-video-list'
export * from './loader.component'
export * from './video-miniature.component' export * from './video-miniature.component'
export * from './video-sort.component' export * from './video-sort.component'

View File

@ -1,16 +1,9 @@
import { NgModule } from '@angular/core' 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 { VideosRoutingModule } from './videos-routing.module'
import { VideosComponent } from './videos.component' import { VideosComponent } from './videos.component'
import {
LoaderComponent,
VideoListComponent,
MyVideosComponent,
VideoMiniatureComponent,
VideoSortComponent
} from './video-list'
import { VideoService } from './shared'
import { SharedModule } from '../shared'
@NgModule({ @NgModule({
imports: [ imports: [
@ -24,9 +17,7 @@ import { SharedModule } from '../shared'
VideoListComponent, VideoListComponent,
MyVideosComponent, MyVideosComponent,
VideoMiniatureComponent, VideoMiniatureComponent,
VideoSortComponent, VideoSortComponent
LoaderComponent
], ],
exports: [ exports: [