aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 14:33:47 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 14:33:47 +0100
commit6913f69134947432a192890b2de7c2d48094e85c (patch)
treec741ecbea6fdeb67a3eb2a6c9581a9925feac220
parentb718fd22374d64534bcfe69932cf562894abed6a (diff)
downloadPeerTube-6913f69134947432a192890b2de7c2d48094e85c.tar.gz
PeerTube-6913f69134947432a192890b2de7c2d48094e85c.tar.zst
PeerTube-6913f69134947432a192890b2de7c2d48094e85c.zip
Move original publication date in advanced settings
-rw-r--r--client/src/app/shared/video/video-edit.model.ts2
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.html92
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts2
-rw-r--r--server/initializers/migrations/0340-add-originally-published-at.ts16
4 files changed, 55 insertions, 57 deletions
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index c5d5bb406..1f633d427 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -57,7 +57,7 @@ export class VideoEdit implements VideoUpdate {
57 this.previewUrl = video.previewUrl 57 this.previewUrl = video.previewUrl
58 58
59 this.scheduleUpdate = video.scheduledUpdate 59 this.scheduleUpdate = video.scheduledUpdate
60 this.originallyPublishedAt = new Date(video.originallyPublishedAt) 60 this.originallyPublishedAt = video.originallyPublishedAt ? new Date(video.originallyPublishedAt) : null
61 } 61 }
62 } 62 }
63 63
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html
index 2fb540170..1be1084ad 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.html
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html
@@ -114,20 +114,6 @@
114 </div> 114 </div>
115 </div> 115 </div>
116 116
117 <div class="form-group">
118 <label i18n for="originallyPublishedAt">Original publication date</label>
119 <my-help i18n-preHtml preHtml="This is the date when the content was originally published (e.g. the release date for a film)"></my-help>
120 <p-calendar
121 id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
122 [locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
123 >
124 </p-calendar>
125
126 <div *ngIf="formErrors.originallyPublishedAt" class="form-error">
127 {{ formErrors.originallyPublishedAt }}
128 </div>
129 </div>
130
131 <my-peertube-checkbox 117 <my-peertube-checkbox
132 inputName="nsfw" formControlName="nsfw" 118 inputName="nsfw" formControlName="nsfw"
133 i18n-labelText labelText="This video contains mature or explicit content" 119 i18n-labelText labelText="This video contains mature or explicit content"
@@ -199,42 +185,60 @@
199 185
200 <ngb-tab i18n-title title="Advanced settings"> 186 <ngb-tab i18n-title title="Advanced settings">
201 <ng-template ngbTabContent> 187 <ng-template ngbTabContent>
202 <div class="advanced-settings"> 188 <div class="row advanced-settings">
203 <div class="form-group"> 189 <div class="col-md-12 col-xl-8">
204 <my-video-image 190 <div class="form-group">
205 i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile" 191 <my-video-image
206 previewWidth="200px" previewHeight="110px" 192 i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile"
207 ></my-video-image> 193 previewWidth="200px" previewHeight="110px"
208 </div> 194 ></my-video-image>
195 </div>
209 196
210 <div class="form-group"> 197 <div class="form-group">
211 <my-video-image 198 <my-video-image
212 i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile" 199 i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile"
213 previewWidth="360px" previewHeight="200px" 200 previewWidth="360px" previewHeight="200px"
214 ></my-video-image> 201 ></my-video-image>
215 </div> 202 </div>
216 203
217 <div class="form-group"> 204 <div class="form-group">
218 <label i18n for="support">Support</label> 205 <label i18n for="support">Support</label>
219 <my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help> 206 <my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help>
220 <my-markdown-textarea 207 <my-markdown-textarea
221 id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced" 208 id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced"
222 [classes]="{ 'input-error': formErrors['support'] }" 209 [classes]="{ 'input-error': formErrors['support'] }"
223 ></my-markdown-textarea> 210 ></my-markdown-textarea>
224 <div *ngIf="formErrors.support" class="form-error"> 211 <div *ngIf="formErrors.support" class="form-error">
225 {{ formErrors.support }} 212 {{ formErrors.support }}
213 </div>
226 </div> 214 </div>
227 </div> 215 </div>
228 216
229 <my-peertube-checkbox 217 <div class="col-md-12 col-xl-4">
230 inputName="commentsEnabled" formControlName="commentsEnabled" 218 <div class="form-group originally-published-at">
231 i18n-labelText labelText="Enable video comments" 219 <label i18n for="originallyPublishedAt">Original publication date</label>
232 ></my-peertube-checkbox> 220 <my-help i18n-preHtml preHtml="This is the date when the content was originally published (e.g. the release date for a film)"></my-help>
221 <p-calendar
222 id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
223 [locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
224 >
225 </p-calendar>
226
227 <div *ngIf="formErrors.originallyPublishedAt" class="form-error">
228 {{ formErrors.originallyPublishedAt }}
229 </div>
230 </div>
231
232 <my-peertube-checkbox
233 inputName="commentsEnabled" formControlName="commentsEnabled"
234 i18n-labelText labelText="Enable video comments"
235 ></my-peertube-checkbox>
233 236
234 <my-peertube-checkbox 237 <my-peertube-checkbox
235 inputName="downloadEnabled" formControlName="downloadEnabled" 238 inputName="downloadEnabled" formControlName="downloadEnabled"
236 i18n-labelText labelText="Enable download" 239 i18n-labelText labelText="Enable download"
237 ></my-peertube-checkbox> 240 ></my-peertube-checkbox>
241 </div>
238 </div> 242 </div>
239 </ng-template> 243 </ng-template>
240 </ngb-tab> 244 </ngb-tab>
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 836452948..c7ebcec25 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
@@ -26,7 +26,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
26 @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = [] 26 @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = []
27 @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] 27 @Input() userVideoChannels: { id: number, label: string, support: string }[] = []
28 @Input() schedulePublicationPossible = true 28 @Input() schedulePublicationPossible = true
29 @Input() videoCaptions: VideoCaptionEdit[] = [] 29 @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = []
30 @Input() waitTranscodingEnabled = true 30 @Input() waitTranscodingEnabled = true
31 31
32 @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent 32 @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent
diff --git a/server/initializers/migrations/0340-add-originally-published-at.ts b/server/initializers/migrations/0340-add-originally-published-at.ts
index ab8d66854..fe4f4a5f9 100644
--- a/server/initializers/migrations/0340-add-originally-published-at.ts
+++ b/server/initializers/migrations/0340-add-originally-published-at.ts
@@ -6,19 +6,13 @@ async function up (utils: {
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
9 { 9 const data = {
10 const data = { 10 type: Sequelize.DATE,
11 type: Sequelize.DATE, 11 allowNull: true,
12 allowNull: true, 12 defaultValue: null
13 defaultValue: Sequelize.NOW
14 }
15 await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
16 } 13 }
14 await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
17 15
18 {
19 const query = 'UPDATE video SET "originallyPublishedAt" = video."publishedAt"'
20 await utils.sequelize.query(query)
21 }
22} 16}
23 17
24function down (options) { 18function down (options) {