Move original publication date in advanced settings

This commit is contained in:
Chocobozzz 2019-02-11 14:33:47 +01:00
parent b718fd2237
commit 6913f69134
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 55 additions and 57 deletions

View File

@ -57,7 +57,7 @@ export class VideoEdit implements VideoUpdate {
this.previewUrl = video.previewUrl this.previewUrl = video.previewUrl
this.scheduleUpdate = video.scheduledUpdate this.scheduleUpdate = video.scheduledUpdate
this.originallyPublishedAt = new Date(video.originallyPublishedAt) this.originallyPublishedAt = video.originallyPublishedAt ? new Date(video.originallyPublishedAt) : null
} }
} }

View File

@ -114,20 +114,6 @@
</div> </div>
</div> </div>
<div class="form-group">
<label i18n for="originallyPublishedAt">Original publication date</label>
<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>
<p-calendar
id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
[locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
>
</p-calendar>
<div *ngIf="formErrors.originallyPublishedAt" class="form-error">
{{ formErrors.originallyPublishedAt }}
</div>
</div>
<my-peertube-checkbox <my-peertube-checkbox
inputName="nsfw" formControlName="nsfw" inputName="nsfw" formControlName="nsfw"
i18n-labelText labelText="This video contains mature or explicit content" i18n-labelText labelText="This video contains mature or explicit content"
@ -199,42 +185,60 @@
<ngb-tab i18n-title title="Advanced settings"> <ngb-tab i18n-title title="Advanced settings">
<ng-template ngbTabContent> <ng-template ngbTabContent>
<div class="advanced-settings"> <div class="row advanced-settings">
<div class="form-group"> <div class="col-md-12 col-xl-8">
<my-video-image <div class="form-group">
i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile" <my-video-image
previewWidth="200px" previewHeight="110px" i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile"
></my-video-image> previewWidth="200px" previewHeight="110px"
</div> ></my-video-image>
</div>
<div class="form-group"> <div class="form-group">
<my-video-image <my-video-image
i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile" i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile"
previewWidth="360px" previewHeight="200px" previewWidth="360px" previewHeight="200px"
></my-video-image> ></my-video-image>
</div> </div>
<div class="form-group"> <div class="form-group">
<label i18n for="support">Support</label> <label i18n for="support">Support</label>
<my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help> <my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help>
<my-markdown-textarea <my-markdown-textarea
id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced" id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced"
[classes]="{ 'input-error': formErrors['support'] }" [classes]="{ 'input-error': formErrors['support'] }"
></my-markdown-textarea> ></my-markdown-textarea>
<div *ngIf="formErrors.support" class="form-error"> <div *ngIf="formErrors.support" class="form-error">
{{ formErrors.support }} {{ formErrors.support }}
</div>
</div> </div>
</div> </div>
<my-peertube-checkbox <div class="col-md-12 col-xl-4">
inputName="commentsEnabled" formControlName="commentsEnabled" <div class="form-group originally-published-at">
i18n-labelText labelText="Enable video comments" <label i18n for="originallyPublishedAt">Original publication date</label>
></my-peertube-checkbox> <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>
<p-calendar
id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
[locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
>
</p-calendar>
<my-peertube-checkbox <div *ngIf="formErrors.originallyPublishedAt" class="form-error">
inputName="downloadEnabled" formControlName="downloadEnabled" {{ formErrors.originallyPublishedAt }}
i18n-labelText labelText="Enable download" </div>
></my-peertube-checkbox> </div>
<my-peertube-checkbox
inputName="commentsEnabled" formControlName="commentsEnabled"
i18n-labelText labelText="Enable video comments"
></my-peertube-checkbox>
<my-peertube-checkbox
inputName="downloadEnabled" formControlName="downloadEnabled"
i18n-labelText labelText="Enable download"
></my-peertube-checkbox>
</div>
</div> </div>
</ng-template> </ng-template>
</ngb-tab> </ngb-tab>

View File

@ -26,7 +26,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
@Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = [] @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = []
@Input() userVideoChannels: { id: number, label: string, support: string }[] = [] @Input() userVideoChannels: { id: number, label: string, support: string }[] = []
@Input() schedulePublicationPossible = true @Input() schedulePublicationPossible = true
@Input() videoCaptions: VideoCaptionEdit[] = [] @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = []
@Input() waitTranscodingEnabled = true @Input() waitTranscodingEnabled = true
@ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent

View File

@ -6,19 +6,13 @@ async function up (utils: {
sequelize: Sequelize.Sequelize sequelize: Sequelize.Sequelize
}): Promise<void> { }): Promise<void> {
{ const data = {
const data = { type: Sequelize.DATE,
type: Sequelize.DATE, allowNull: true,
allowNull: true, defaultValue: null
defaultValue: Sequelize.NOW
}
await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
} }
await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
{
const query = 'UPDATE video SET "originallyPublishedAt" = video."publishedAt"'
await utils.sequelize.query(query)
}
} }
function down (options) { function down (options) {