aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-28 17:05:46 +0200
committerChocobozzz <me@florianbigard.com>2018-03-28 17:05:46 +0200
commit5afdd0a52f2f1fa79ed9bf241b5a525366658fa1 (patch)
tree58bc17102b26893530ca64e757c2389361a36473 /client/src/app/shared
parente33e7fc89e4f0e2fbd1d7e87a4e2a2d5aae94f29 (diff)
downloadPeerTube-5afdd0a52f2f1fa79ed9bf241b5a525366658fa1.tar.gz
PeerTube-5afdd0a52f2f1fa79ed9bf241b5a525366658fa1.tar.zst
PeerTube-5afdd0a52f2f1fa79ed9bf241b5a525366658fa1.zip
Add initial video quota info in registration form
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/misc/help.component.ts30
-rw-r--r--client/src/app/shared/misc/utils.ts5
2 files changed, 19 insertions, 16 deletions
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts
index 19ac38b58..89dd1dae5 100644
--- a/client/src/app/shared/misc/help.component.ts
+++ b/client/src/app/shared/misc/help.component.ts
@@ -1,4 +1,4 @@
1import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, HostListener, Input, OnInit, ViewChild, OnChanges } from '@angular/core'
2import { MarkdownService } from '@app/videos/shared' 2import { MarkdownService } from '@app/videos/shared'
3import { TooltipDirective } from 'ngx-bootstrap/tooltip' 3import { TooltipDirective } from 'ngx-bootstrap/tooltip'
4 4
@@ -8,7 +8,7 @@ import { TooltipDirective } from 'ngx-bootstrap/tooltip'
8 templateUrl: './help.component.html' 8 templateUrl: './help.component.html'
9}) 9})
10 10
11export class HelpComponent implements OnInit { 11export class HelpComponent implements OnInit, OnChanges {
12 @ViewChild('tooltipDirective') tooltipDirective: TooltipDirective 12 @ViewChild('tooltipDirective') tooltipDirective: TooltipDirective
13 @Input() preHtml = '' 13 @Input() preHtml = ''
14 @Input() postHtml = '' 14 @Input() postHtml = ''
@@ -20,6 +20,23 @@ export class HelpComponent implements OnInit {
20 constructor (private elementRef: ElementRef) { } 20 constructor (private elementRef: ElementRef) { }
21 21
22 ngOnInit () { 22 ngOnInit () {
23 this.init()
24 }
25
26 ngOnChanges () {
27 this.init()
28 }
29
30 @HostListener('document:click', ['$event.target'])
31 public onClick (targetElement) {
32 const clickedInside = this.elementRef.nativeElement.contains(targetElement)
33
34 if (this.tooltipDirective.isOpen && !clickedInside) {
35 this.tooltipDirective.hide()
36 }
37 }
38
39 private init () {
23 if (this.helpType === 'custom') { 40 if (this.helpType === 'custom') {
24 this.mainHtml = this.customHtml 41 this.mainHtml = this.customHtml
25 return 42 return
@@ -36,15 +53,6 @@ export class HelpComponent implements OnInit {
36 } 53 }
37 } 54 }
38 55
39 @HostListener('document:click', ['$event.target'])
40 public onClick (targetElement) {
41 const clickedInside = this.elementRef.nativeElement.contains(targetElement)
42
43 if (this.tooltipDirective.isOpen && !clickedInside) {
44 this.tooltipDirective.hide()
45 }
46 }
47
48 private formatMarkdownSupport (rules: string[]) { 56 private formatMarkdownSupport (rules: string[]) {
49 return '<a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noopener noreferrer">Markdown</a> ' + 57 return '<a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noopener noreferrer">Markdown</a> ' +
50 'compatible that supports:' + 58 'compatible that supports:' +
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index d520b1a7b..99f6b3cf0 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -17,10 +17,6 @@ function getParameterByName (name: string, url: string) {
17 return decodeURIComponent(results[2].replace(/\+/g, ' ')) 17 return decodeURIComponent(results[2].replace(/\+/g, ' '))
18} 18}
19 19
20function viewportHeight () {
21 return Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
22}
23
24function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) { 20function populateAsyncUserVideoChannels (authService: AuthService, channel: any[]) {
25 return new Promise(res => { 21 return new Promise(res => {
26 authService.userInformationLoaded 22 authService.userInformationLoaded
@@ -99,7 +95,6 @@ function isInMobileView () {
99} 95}
100 96
101export { 97export {
102 viewportHeight,
103 getParameterByName, 98 getParameterByName,
104 populateAsyncUserVideoChannels, 99 populateAsyncUserVideoChannels,
105 getAbsoluteAPIUrl, 100 getAbsoluteAPIUrl,