diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-15 14:31:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-15 14:34:47 +0100 |
commit | 2e3a0215d051dca1f7c8ef423564c8d37a255f77 (patch) | |
tree | 9a3c5139f9459fca8a079173f1f522af249cb5f9 /client/src | |
parent | 44a9a76e29aab81e94b528895faa816ccbb09f07 (diff) | |
download | PeerTube-2e3a0215d051dca1f7c8ef423564c8d37a255f77.tar.gz PeerTube-2e3a0215d051dca1f7c8ef423564c8d37a255f77.tar.zst PeerTube-2e3a0215d051dca1f7c8ef423564c8d37a255f77.zip |
Add short description in config
Diffstat (limited to 'client/src')
5 files changed, 29 insertions, 1 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index c7ddaaf01..6658a095d 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -16,6 +16,17 @@ | |||
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <div class="form-group"> | 18 | <div class="form-group"> |
19 | <label for="instanceShortDescription">Short description</label> | ||
20 | <textarea | ||
21 | id="instanceShortDescription" formControlName="instanceShortDescription" | ||
22 | [ngClass]="{ 'input-error': formErrors['instanceShortDescription'] }" | ||
23 | ></textarea> | ||
24 | <div *ngIf="formErrors.instanceShortDescription" class="form-error"> | ||
25 | {{ formErrors.instanceShortDescription }} | ||
26 | </div> | ||
27 | </div> | ||
28 | |||
29 | <div class="form-group"> | ||
19 | <label for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help> | 30 | <label for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help> |
20 | <my-markdown-textarea | 31 | <my-markdown-textarea |
21 | id="instanceDescription" formControlName="instanceDescription" textareaWidth="500px" [previewColumn]="true" | 32 | id="instanceDescription" formControlName="instanceDescription" textareaWidth="500px" [previewColumn]="true" |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss index e72f30c69..e81044554 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss | |||
@@ -34,4 +34,8 @@ textarea { | |||
34 | @include peertube-textarea(500px, 150px); | 34 | @include peertube-textarea(500px, 150px); |
35 | 35 | ||
36 | display: block; | 36 | display: block; |
37 | |||
38 | &#instanceShortDescription { | ||
39 | height: 100px; | ||
40 | } | ||
37 | } | 41 | } |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index c38bc326a..9ab8b08d0 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -8,7 +8,7 @@ import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared' | |||
8 | import { | 8 | import { |
9 | ADMIN_EMAIL, | 9 | ADMIN_EMAIL, |
10 | CACHE_PREVIEWS_SIZE, | 10 | CACHE_PREVIEWS_SIZE, |
11 | INSTANCE_NAME, | 11 | INSTANCE_NAME, INSTANCE_SHORT_DESCRIPTION, |
12 | SIGNUP_LIMIT, | 12 | SIGNUP_LIMIT, |
13 | TRANSCODING_THREADS | 13 | TRANSCODING_THREADS |
14 | } from '@app/shared/forms/form-validators/custom-config' | 14 | } from '@app/shared/forms/form-validators/custom-config' |
@@ -44,6 +44,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
44 | form: FormGroup | 44 | form: FormGroup |
45 | formErrors = { | 45 | formErrors = { |
46 | instanceName: '', | 46 | instanceName: '', |
47 | instanceShortDescription: '', | ||
47 | instanceDescription: '', | 48 | instanceDescription: '', |
48 | instanceTerms: '', | 49 | instanceTerms: '', |
49 | instanceDefaultClientRoute: '', | 50 | instanceDefaultClientRoute: '', |
@@ -56,6 +57,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
56 | customizationCSS: '' | 57 | customizationCSS: '' |
57 | } | 58 | } |
58 | validationMessages = { | 59 | validationMessages = { |
60 | instanceShortDescription: INSTANCE_SHORT_DESCRIPTION.MESSAGES, | ||
59 | instanceName: INSTANCE_NAME.MESSAGES, | 61 | instanceName: INSTANCE_NAME.MESSAGES, |
60 | cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES, | 62 | cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES, |
61 | signupLimit: SIGNUP_LIMIT.MESSAGES, | 63 | signupLimit: SIGNUP_LIMIT.MESSAGES, |
@@ -84,6 +86,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
84 | buildForm () { | 86 | buildForm () { |
85 | const formGroupData = { | 87 | const formGroupData = { |
86 | instanceName: [ '', INSTANCE_NAME.VALIDATORS ], | 88 | instanceName: [ '', INSTANCE_NAME.VALIDATORS ], |
89 | instanceShortDescription: [ '', INSTANCE_SHORT_DESCRIPTION.VALIDATORS ], | ||
87 | instanceDescription: [ '' ], | 90 | instanceDescription: [ '' ], |
88 | instanceTerms: [ '' ], | 91 | instanceTerms: [ '' ], |
89 | instanceDefaultClientRoute: [ '' ], | 92 | instanceDefaultClientRoute: [ '' ], |
@@ -158,6 +161,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
158 | const data: CustomConfig = { | 161 | const data: CustomConfig = { |
159 | instance: { | 162 | instance: { |
160 | name: this.form.value['instanceName'], | 163 | name: this.form.value['instanceName'], |
164 | shortDescription: this.form.value['instanceShortDescription'], | ||
161 | description: this.form.value['instanceDescription'], | 165 | description: this.form.value['instanceDescription'], |
162 | terms: this.form.value['instanceTerms'], | 166 | terms: this.form.value['instanceTerms'], |
163 | defaultClientRoute: this.form.value['instanceDefaultClientRoute'], | 167 | defaultClientRoute: this.form.value['instanceDefaultClientRoute'], |
@@ -214,6 +218,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
214 | private updateForm () { | 218 | private updateForm () { |
215 | const data = { | 219 | const data = { |
216 | instanceName: this.customConfig.instance.name, | 220 | instanceName: this.customConfig.instance.name, |
221 | instanceShortDescription: this.customConfig.instance.shortDescription, | ||
217 | instanceDescription: this.customConfig.instance.description, | 222 | instanceDescription: this.customConfig.instance.description, |
218 | instanceTerms: this.customConfig.instance.terms, | 223 | instanceTerms: this.customConfig.instance.terms, |
219 | instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute, | 224 | instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute, |
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 2135c3268..bd85d9f0f 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -21,6 +21,7 @@ export class ServerService { | |||
21 | private config: ServerConfig = { | 21 | private config: ServerConfig = { |
22 | instance: { | 22 | instance: { |
23 | name: 'PeerTube', | 23 | name: 'PeerTube', |
24 | shortDescription: '', | ||
24 | defaultClientRoute: '', | 25 | defaultClientRoute: '', |
25 | customizations: { | 26 | customizations: { |
26 | javascript: '', | 27 | javascript: '', |
diff --git a/client/src/app/shared/forms/form-validators/custom-config.ts b/client/src/app/shared/forms/form-validators/custom-config.ts index a0966a9a7..c9cef2e09 100644 --- a/client/src/app/shared/forms/form-validators/custom-config.ts +++ b/client/src/app/shared/forms/form-validators/custom-config.ts | |||
@@ -7,6 +7,13 @@ export const INSTANCE_NAME = { | |||
7 | } | 7 | } |
8 | } | 8 | } |
9 | 9 | ||
10 | export const INSTANCE_SHORT_DESCRIPTION = { | ||
11 | VALIDATORS: [ Validators.max(250) ], | ||
12 | MESSAGES: { | ||
13 | 'max': 'Short description should not be longer than 250 characters.' | ||
14 | } | ||
15 | } | ||
16 | |||
10 | export const CACHE_PREVIEWS_SIZE = { | 17 | export const CACHE_PREVIEWS_SIZE = { |
11 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | 18 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], |
12 | MESSAGES: { | 19 | MESSAGES: { |