aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-edit/shared')
-rw-r--r--client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts94
-rw-r--r--client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts8
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts26
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.module.ts16
4 files changed, 117 insertions, 27 deletions
diff --git a/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts
new file mode 100644
index 000000000..b05852ff8
--- /dev/null
+++ b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts
@@ -0,0 +1,94 @@
1import { I18n } from '@ngx-translate/i18n-polyfill'
2import { Injectable } from '@angular/core'
3
4@Injectable()
5export class I18nPrimengCalendarService {
6 private readonly calendarLocale: any = {}
7
8 constructor (private i18n: I18n) {
9 this.calendarLocale = {
10 firstDayOfWeek: 0,
11 dayNames: [
12 this.i18n('Sunday'),
13 this.i18n('Monday'),
14 this.i18n('Tuesday'),
15 this.i18n('Wednesday'),
16 this.i18n('Thursday'),
17 this.i18n('Friday'),
18 this.i18n('Saturday')
19 ],
20
21 dayNamesShort: [
22 this.i18n({ value: 'Sun', description: 'Day name short' }),
23 this.i18n({ value: 'Mon', description: 'Day name short' }),
24 this.i18n({ value: 'Tue', description: 'Day name short' }),
25 this.i18n({ value: 'Wed', description: 'Day name short' }),
26 this.i18n({ value: 'Thu', description: 'Day name short' }),
27 this.i18n({ value: 'Fri', description: 'Day name short' }),
28 this.i18n({ value: 'Sat', description: 'Day name short' })
29 ],
30
31 dayNamesMin: [
32 this.i18n({ value: 'Su', description: 'Day name min' }),
33 this.i18n({ value: 'Mo', description: 'Day name min' }),
34 this.i18n({ value: 'Tu', description: 'Day name min' }),
35 this.i18n({ value: 'We', description: 'Day name min' }),
36 this.i18n({ value: 'Th', description: 'Day name min' }),
37 this.i18n({ value: 'Fr', description: 'Day name min' }),
38 this.i18n({ value: 'Sa', description: 'Day name min' })
39 ],
40
41 monthNames: [
42 this.i18n('January'),
43 this.i18n('February'),
44 this.i18n('March'),
45 this.i18n('April'),
46 this.i18n('May'),
47 this.i18n('June'),
48 this.i18n('July'),
49 this.i18n('August'),
50 this.i18n('September'),
51 this.i18n('October'),
52 this.i18n('November'),
53 this.i18n('December')
54 ],
55
56 monthNamesShort: [
57 this.i18n({ value: 'Jan', description: 'Month name short' }),
58 this.i18n({ value: 'Feb', description: 'Month name short' }),
59 this.i18n({ value: 'Mar', description: 'Month name short' }),
60 this.i18n({ value: 'Apr', description: 'Month name short' }),
61 this.i18n({ value: 'May', description: 'Month name short' }),
62 this.i18n({ value: 'Jun', description: 'Month name short' }),
63 this.i18n({ value: 'Jul', description: 'Month name short' }),
64 this.i18n({ value: 'Aug', description: 'Month name short' }),
65 this.i18n({ value: 'Sep', description: 'Month name short' }),
66 this.i18n({ value: 'Oct', description: 'Month name short' }),
67 this.i18n({ value: 'Nov', description: 'Month name short' }),
68 this.i18n({ value: 'Dec', description: 'Month name short' })
69 ],
70
71 today: this.i18n('Today'),
72
73 clear: this.i18n('Clear')
74 }
75 }
76
77 getCalendarLocale () {
78 return this.calendarLocale
79 }
80
81 getTimezone () {
82 const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]
83 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
84
85 return `${timezone} - ${gmt}`
86 }
87
88 getDateFormat () {
89 return this.i18n({
90 value: 'yy-mm-dd ',
91 description: 'Date format in this locale.'
92 })
93 }
94}
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
index 9856aac9e..a90d04ce8 100644
--- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -1,11 +1,9 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { FormReactive } from '@app/shared'
3import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
4import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validators/video-captions-validators.service'
5import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
6import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 3import { FormReactive, FormValidatorService, VideoCaptionsValidatorsService } from '@app/shared/shared-forms'
4import { VideoCaptionEdit } from '@app/shared/shared-main'
7import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 5import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
8import { ServerConfig, VideoConstant } from '../../../../../../shared' 6import { ServerConfig, VideoConstant } from '@shared/models'
9 7
10@Component({ 8@Component({
11 selector: 'my-video-caption-add-modal', 9 selector: 'my-video-caption-add-modal',
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index 15073fc44..239e453ad 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -1,19 +1,13 @@
1import { map } from 'rxjs/operators'
1import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 2import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' 3import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 4import { ServerService } from '@app/core'
4import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' 5import { removeElementFromArray } from '@app/helpers'
5import { Notifier } from '@app/core' 6import { FormReactiveValidationMessages, FormValidatorService, VideoValidatorsService } from '@app/shared/shared-forms'
6import { ServerService } from '../../../core/server' 7import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
7import { VideoEdit } from '../../../shared/video/video-edit.model' 8import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
8import { map } from 'rxjs/operators' 9import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 10import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
10import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar'
11import { VideoCaptionService } from '@app/shared/video-caption'
12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component'
13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
14import { removeElementFromArray } from '@app/shared/misc/utils'
15import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared'
16import { VideoService } from '@app/shared/video/video.service'
17 11
18@Component({ 12@Component({
19 selector: 'my-video-edit', 13 selector: 'my-video-edit',
@@ -60,11 +54,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
60 constructor ( 54 constructor (
61 private formValidatorService: FormValidatorService, 55 private formValidatorService: FormValidatorService,
62 private videoValidatorsService: VideoValidatorsService, 56 private videoValidatorsService: VideoValidatorsService,
63 private videoCaptionService: VideoCaptionService,
64 private videoService: VideoService, 57 private videoService: VideoService,
65 private route: ActivatedRoute,
66 private router: Router,
67 private notifier: Notifier,
68 private serverService: ServerService, 58 private serverService: ServerService,
69 private i18nPrimengCalendarService: I18nPrimengCalendarService, 59 private i18nPrimengCalendarService: I18nPrimengCalendarService,
70 private ngZone: NgZone 60 private ngZone: NgZone
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.module.ts b/client/src/app/videos/+video-edit/shared/video-edit.module.ts
index 1357d607c..96061a300 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.module.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.module.ts
@@ -1,16 +1,20 @@
1import { NgModule } from '@angular/core'
2import { TagInputModule } from 'ngx-chips' 1import { TagInputModule } from 'ngx-chips'
3import { SharedModule } from '../../../shared/'
4import { VideoEditComponent } from './video-edit.component'
5import { CalendarModule } from 'primeng/calendar' 2import { CalendarModule } from 'primeng/calendar'
3import { NgModule } from '@angular/core'
4import { SharedFormModule } from '@app/shared/shared-forms'
5import { SharedGlobalIconModule } from '@app/shared/shared-icons'
6import { SharedMainModule } from '@app/shared/shared-main'
6import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' 7import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
8import { VideoEditComponent } from './video-edit.component'
7 9
8@NgModule({ 10@NgModule({
9 imports: [ 11 imports: [
10 TagInputModule, 12 TagInputModule,
11 CalendarModule, 13 CalendarModule,
12 14
13 SharedModule 15 SharedMainModule,
16 SharedFormModule,
17 SharedGlobalIconModule
14 ], 18 ],
15 19
16 declarations: [ 20 declarations: [
@@ -22,6 +26,10 @@ import { VideoCaptionAddModalComponent } from './video-caption-add-modal.compone
22 TagInputModule, 26 TagInputModule,
23 CalendarModule, 27 CalendarModule,
24 28
29 SharedMainModule,
30 SharedFormModule,
31 SharedGlobalIconModule,
32
25 VideoEditComponent 33 VideoEditComponent
26 ], 34 ],
27 35