Added Markdown formatting in all the fields of the "About" page (#3371)

* Added Markdown formatting in all the fields of the "About" page

Fixes https://github.com/Chocobozzz/PeerTube/issues/3368

* Fixed compilation error in AboutInstanceComponent

Moved creationReason, maintenanceLifetime and businessModel into the html dict

* Removed textareaHeight for all md textareas in EditCustomConfig HTML

* Fixed failing bundlewatch
pull/3385/head
Florian CUNY 2020-11-30 15:05:57 +01:00 committed by GitHub
parent 972de8f111
commit f45c7cc770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 30 deletions

View File

@ -21,7 +21,7 @@
<div class="anchor" id="administrators-and-sustainability"></div> <div class="anchor" id="administrators-and-sustainability"></div>
<a <a
*ngIf="html.administrator || maintenanceLifetime || businessModel" *ngIf="html.administrator || html.maintenanceLifetime || html.businessModel"
class="anchor-link" class="anchor-link"
routerLink="/about/instance" routerLink="/about/instance"
fragment="administrators-and-sustainability" fragment="administrators-and-sustainability"
@ -47,7 +47,7 @@
<div [innerHTML]="html.administrator"></div> <div [innerHTML]="html.administrator"></div>
</div> </div>
<div class="block creation-reason" *ngIf="creationReason"> <div class="block creation-reason" *ngIf="html.creationReason">
<div class="anchor" id="creation-reason"></div> <div class="anchor" id="creation-reason"></div>
<a <a
class="anchor-link" class="anchor-link"
@ -58,10 +58,10 @@
<h3 i18n class="section-title">Why we created this instance</h3> <h3 i18n class="section-title">Why we created this instance</h3>
</a> </a>
<p>{{ creationReason }}</p> <div [innerHTML]="html.creationReason"></div>
</div> </div>
<div class="block maintenance-lifetime" *ngIf="maintenanceLifetime"> <div class="block maintenance-lifetime" *ngIf="html.maintenanceLifetime">
<div class="anchor" id="maintenance-lifetime"></div> <div class="anchor" id="maintenance-lifetime"></div>
<a <a
class="anchor-link" class="anchor-link"
@ -72,10 +72,10 @@
<h3 i18n class="section-title">How long we plan to maintain this instance</h3> <h3 i18n class="section-title">How long we plan to maintain this instance</h3>
</a> </a>
<p>{{ maintenanceLifetime }}</p> <div [innerHTML]="html.maintenanceLifetime"></div>
</div> </div>
<div class="block business-model" *ngIf="businessModel"> <div class="block business-model" *ngIf="html.businessModel">
<div class="anchor" id="business-model"></div> <div class="anchor" id="business-model"></div>
<a <a
class="anchor-link" class="anchor-link"
@ -86,7 +86,7 @@
<h3 i18n class="section-title">How we will pay for this instance</h3> <h3 i18n class="section-title">How we will pay for this instance</h3>
</a> </a>
<p>{{ businessModel }}</p> <div [innerHTML]="html.businessModel"></div>
</div> </div>
<div class="anchor" id="information"></div> <div class="anchor" id="information"></div>

View File

@ -24,13 +24,12 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
codeOfConduct: '', codeOfConduct: '',
moderationInformation: '', moderationInformation: '',
administrator: '', administrator: '',
creationReason: '',
maintenanceLifetime: '',
businessModel: '',
hardwareInformation: '' hardwareInformation: ''
} }
creationReason = ''
maintenanceLifetime = ''
businessModel = ''
languages: string[] = [] languages: string[] = []
categories: string[] = [] categories: string[] = []
@ -69,10 +68,6 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
this.shortDescription = about.instance.shortDescription this.shortDescription = about.instance.shortDescription
this.creationReason = about.instance.creationReason
this.maintenanceLifetime = about.instance.maintenanceLifetime
this.businessModel = about.instance.businessModel
this.html = await this.instanceService.buildHtml(about) this.html = await this.instanceService.buildHtml(about)
this.initialized = true this.initialized = true

View File

@ -162,11 +162,11 @@
<div class="form-group form-group-right col-12 col-lg-8 col-xl-9"> <div class="form-group form-group-right col-12 col-lg-8 col-xl-9">
<div class="form-group"> <div class="form-group">
<label i18n for="instanceAdministrator">Who is behind the instance?</label> <label i18n for="instanceAdministrator">Who is behind the instance?</label><my-help helpType="markdownText"></my-help>
<div i18n class="label-small-info">A single person? A non-profit? A company?</div> <div i18n class="label-small-info">A single person? A non-profit? A company?</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceAdministrator" formControlName="administrator" textareaMaxWidth="500px" textareaHeight="75px" name="instanceAdministrator" formControlName="administrator" textareaMaxWidth="500px"
[classes]="{ 'input-error': formErrors['instance.administrator'] }" [classes]="{ 'input-error': formErrors['instance.administrator'] }"
></my-markdown-textarea> ></my-markdown-textarea>
@ -174,35 +174,35 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label i18n for="instanceCreationReason">Why did you create this instance?</label> <label i18n for="instanceCreationReason">Why did you create this instance?</label><my-help helpType="markdownText"></my-help>
<div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div> <div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div>
<textarea <my-markdown-textarea
id="instanceCreationReason" formControlName="creationReason" class="small" class="form-control" id="instanceCreationReason" formControlName="creationReason" textareaMaxWidth="500px"
[ngClass]="{ 'input-error': formErrors['instance.creationReason'] }" [ngClass]="{ 'input-error': formErrors['instance.creationReason'] }"
></textarea> ></my-markdown-textarea>
<div *ngIf="formErrors.instance.creationReason" class="form-error">{{ formErrors.instance.creationReason }}</div> <div *ngIf="formErrors.instance.creationReason" class="form-error">{{ formErrors.instance.creationReason }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label i18n for="instanceMaintenanceLifetime">How long do you plan to maintain this instance?</label> <label i18n for="instanceMaintenanceLifetime">How long do you plan to maintain this instance?</label><my-help helpType="markdownText"></my-help>
<div i18n class="label-small-info">It's important to know for users who want to register on your instance</div> <div i18n class="label-small-info">It's important to know for users who want to register on your instance</div>
<textarea <my-markdown-textarea
id="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" class="form-control small" id="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" textareaMaxWidth="500px"
[ngClass]="{ 'input-error': formErrors['instance.maintenanceLifetime'] }" [ngClass]="{ 'input-error': formErrors['instance.maintenanceLifetime'] }"
></textarea> ></my-markdown-textarea>
<div *ngIf="formErrors.instance.maintenanceLifetime" class="form-error">{{ formErrors.instance.maintenanceLifetime }}</div> <div *ngIf="formErrors.instance.maintenanceLifetime" class="form-error">{{ formErrors.instance.maintenanceLifetime }}</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label i18n for="instanceBusinessModel">How will you finance the PeerTube server?</label> <label i18n for="instanceBusinessModel">How will you finance the PeerTube server?</label><my-help helpType="markdownText"></my-help>
<div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div> <div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div>
<textarea <my-markdown-textarea
id="instanceBusinessModel" formControlName="businessModel" class="form-control small" id="instanceBusinessModel" formControlName="businessModel" textareaMaxWidth="500px"
[ngClass]="{ 'input-error': formErrors['instance.businessModel'] }" [ngClass]="{ 'input-error': formErrors['instance.businessModel'] }"
></textarea> ></my-markdown-textarea>
<div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div> <div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div>
</div> </div>
@ -221,7 +221,7 @@
<div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div> <div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div>
<my-markdown-textarea <my-markdown-textarea
name="instanceHardwareInformation" formControlName="hardwareInformation" textareaMaxWidth="500px" textareaHeight="75px" name="instanceHardwareInformation" formControlName="hardwareInformation" textareaMaxWidth="500px"
[classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }"
></my-markdown-textarea> ></my-markdown-textarea>

View File

@ -45,6 +45,9 @@ export class InstanceService {
codeOfConduct: '', codeOfConduct: '',
moderationInformation: '', moderationInformation: '',
administrator: '', administrator: '',
creationReason: '',
maintenanceLifetime: '',
businessModel: '',
hardwareInformation: '' hardwareInformation: ''
} }