aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-28 15:40:53 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-28 17:13:51 +0100
commit80958c78fdc733c02077a9d2200be0c3f5ee623e (patch)
treea5f024c8127f98e9f08c3db369a9d219cf8c30c7 /client/src/app/videos/+video-watch/video-watch.component.ts
parent83c663ef0e94242762ed5f6d2875fc55f4a5603e (diff)
downloadPeerTube-80958c78fdc733c02077a9d2200be0c3f5ee623e.tar.gz
PeerTube-80958c78fdc733c02077a9d2200be0c3f5ee623e.tar.zst
PeerTube-80958c78fdc733c02077a9d2200be0c3f5ee623e.zip
Add loader when expanding long video description
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 5e2486b9c..2a7290cbd 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'
16import { VideoDetails, VideoService, MarkdownService } from '../shared' 16import { VideoDetails, VideoService, MarkdownService } from '../shared'
17import { VideoBlacklistService } from '../../shared' 17import { VideoBlacklistService } from '../../shared'
18import { UserVideoRateType, VideoRateType } from '../../../../../shared' 18import { UserVideoRateType, VideoRateType } from '../../../../../shared'
19import { BehaviorSubject } from 'rxjs/BehaviorSubject'
19 20
20@Component({ 21@Component({
21 selector: 'my-video-watch', 22 selector: 'my-video-watch',
@@ -38,6 +39,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
38 video: VideoDetails = null 39 video: VideoDetails = null
39 videoPlayerLoaded = false 40 videoPlayerLoaded = false
40 videoNotFound = false 41 videoNotFound = false
42 descriptionLoading = false
41 43
42 completeDescriptionShown = false 44 completeDescriptionShown = false
43 completeVideoDescription: string 45 completeVideoDescription: string
@@ -159,32 +161,39 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
159 } 161 }
160 162
161 showMoreDescription () { 163 showMoreDescription () {
162 this.completeDescriptionShown = true
163
164 if (this.completeVideoDescription === undefined) { 164 if (this.completeVideoDescription === undefined) {
165 return this.loadCompleteDescription() 165 return this.loadCompleteDescription()
166 } 166 }
167 167
168 this.updateVideoDescription(this.completeVideoDescription) 168 this.updateVideoDescription(this.completeVideoDescription)
169 this.completeDescriptionShown = true
169 } 170 }
170 171
171 showLessDescription () { 172 showLessDescription () {
172 this.completeDescriptionShown = false
173 173
174 this.updateVideoDescription(this.shortVideoDescription) 174 this.updateVideoDescription(this.shortVideoDescription)
175 this.completeDescriptionShown = false
175 } 176 }
176 177
177 loadCompleteDescription () { 178 loadCompleteDescription () {
179 this.descriptionLoading = true
180
178 this.videoService.loadCompleteDescription(this.video.descriptionPath) 181 this.videoService.loadCompleteDescription(this.video.descriptionPath)
179 .subscribe( 182 .subscribe(
180 description => { 183 description => {
184 this.completeDescriptionShown = true
185 this.descriptionLoading = false
186
181 this.shortVideoDescription = this.video.description 187 this.shortVideoDescription = this.video.description
182 this.completeVideoDescription = description 188 this.completeVideoDescription = description
183 189
184 this.updateVideoDescription(this.completeVideoDescription) 190 this.updateVideoDescription(this.completeVideoDescription)
185 }, 191 },
186 192
187 error => this.notificationsService.error('Error', error.text) 193 error => {
194 this.descriptionLoading = false
195 this.notificationsService.error('Error', error.text)
196 }
188 ) 197 )
189 } 198 }
190 199