diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-20 15:56:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-20 15:56:16 +0200 |
commit | 9bc3622320dc43474ce4b60c222ec25e6e657b97 (patch) | |
tree | 081aadbe0c3e69425dbe1946d98fd890785c1aef /client/src/app/+admin | |
parent | 3031971ec21ed6400d3b73d1f7e00b44d1617667 (diff) | |
download | PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.tar.gz PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.tar.zst PeerTube-9bc3622320dc43474ce4b60c222ec25e6e657b97.zip |
Handle input error in markdown textarea
Diffstat (limited to 'client/src/app/+admin')
4 files changed, 34 insertions, 43 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index 68126281f..315cd1749 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html | |||
@@ -132,8 +132,8 @@ | |||
132 | <label i18n for="broadcastMessageMessage">Message</label><my-help helpType="markdownText"></my-help> | 132 | <label i18n for="broadcastMessageMessage">Message</label><my-help helpType="markdownText"></my-help> |
133 | 133 | ||
134 | <my-markdown-textarea | 134 | <my-markdown-textarea |
135 | name="broadcastMessageMessage" formControlName="message" textareaMaxWidth="500px" | 135 | name="broadcastMessageMessage" formControlName="message" |
136 | [classes]="{ 'input-error': formErrors['broadcastMessage.message'] }" | 136 | [formError]="formErrors['broadcastMessage.message']" |
137 | ></my-markdown-textarea> | 137 | ></my-markdown-textarea> |
138 | 138 | ||
139 | <div *ngIf="formErrors.broadcastMessage.message" class="form-error">{{ formErrors.broadcastMessage.message }}</div> | 139 | <div *ngIf="formErrors.broadcastMessage.message" class="form-error">{{ formErrors.broadcastMessage.message }}</div> |
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 f3bce8ee0..df523cedc 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 | |||
@@ -7,12 +7,21 @@ form { | |||
7 | padding-bottom: 1.5rem; | 7 | padding-bottom: 1.5rem; |
8 | } | 8 | } |
9 | 9 | ||
10 | input[type=text] { | 10 | my-markdown-textarea { |
11 | @include peertube-input-text($form-base-input-width); | 11 | display: block; |
12 | max-width: 500px; | ||
13 | } | ||
12 | 14 | ||
15 | .homepage my-markdown-textarea { | ||
13 | display: block; | 16 | display: block; |
17 | max-width: 90%; | ||
18 | |||
19 | ::ng-deep textarea { | ||
20 | height: 300px !important; | ||
21 | } | ||
14 | } | 22 | } |
15 | 23 | ||
24 | input[type=text], | ||
16 | input[type=number] { | 25 | input[type=number] { |
17 | @include peertube-input-text($form-base-input-width); | 26 | @include peertube-input-text($form-base-input-width); |
18 | 27 | ||
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html b/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html index 701c3c0c1..5339240bb 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-homepage.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | <ng-container formGroupName="instanceCustomHomepage"> | 3 | <ng-container formGroupName="instanceCustomHomepage"> |
4 | 4 | ||
5 | <div class="row mt-5"> <!-- homepage grid --> | 5 | <div class="homepage row mt-5"> <!-- homepage grid --> |
6 | <div class="col-12 col-lg-4 col-xl-3"> | 6 | <div class="col-12 col-lg-4 col-xl-3"> |
7 | <div i18n class="inner-form-title">INSTANCE HOMEPAGE</div> | 7 | <div i18n class="inner-form-title">INSTANCE HOMEPAGE</div> |
8 | </div> | 8 | </div> |
@@ -16,9 +16,9 @@ | |||
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <my-markdown-textarea | 18 | <my-markdown-textarea |
19 | name="instanceCustomHomepageContent" formControlName="content" textareaMaxWidth="90%" textareaHeight="300px" | 19 | name="instanceCustomHomepageContent" formControlName="content" |
20 | [customMarkdownRenderer]="getCustomMarkdownRenderer()" | 20 | [customMarkdownRenderer]="getCustomMarkdownRenderer()" |
21 | [classes]="{ 'input-error': formErrors['instanceCustomHomepage.content'] }" | 21 | [formError]="formErrors['instanceCustomHomepage.content']" |
22 | ></my-markdown-textarea> | 22 | ></my-markdown-textarea> |
23 | 23 | ||
24 | <div *ngIf="formErrors.instanceCustomHomepage.content" class="form-error">{{ formErrors.instanceCustomHomepage.content }}</div> | 24 | <div *ngIf="formErrors.instanceCustomHomepage.content" class="form-error">{{ formErrors.instanceCustomHomepage.content }}</div> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html index 5931cb459..b54733327 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html | |||
@@ -37,12 +37,10 @@ | |||
37 | </div> | 37 | </div> |
38 | 38 | ||
39 | <my-markdown-textarea | 39 | <my-markdown-textarea |
40 | name="instanceDescription" formControlName="description" textareaMaxWidth="500px" | 40 | name="instanceDescription" formControlName="description" |
41 | [customMarkdownRenderer]="getCustomMarkdownRenderer()" | 41 | [customMarkdownRenderer]="getCustomMarkdownRenderer()" |
42 | [classes]="{ 'input-error': formErrors['instance.description'] }" | 42 | [formError]="formErrors['instance.description']" |
43 | ></my-markdown-textarea> | 43 | ></my-markdown-textarea> |
44 | |||
45 | <div *ngIf="formErrors.instance.description" class="form-error">{{ formErrors.instance.description }}</div> | ||
46 | </div> | 44 | </div> |
47 | 45 | ||
48 | <div class="form-group"> | 46 | <div class="form-group"> |
@@ -127,22 +125,18 @@ | |||
127 | <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> | 125 | <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> |
128 | 126 | ||
129 | <my-markdown-textarea | 127 | <my-markdown-textarea |
130 | name="instanceTerms" formControlName="terms" textareaMaxWidth="500px" | 128 | name="instanceTerms" formControlName="terms" |
131 | [ngClass]="{ 'input-error': formErrors['instance.terms'] }" | 129 | [formError]="formErrors['instance.terms']" |
132 | ></my-markdown-textarea> | 130 | ></my-markdown-textarea> |
133 | |||
134 | <div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div> | ||
135 | </div> | 131 | </div> |
136 | 132 | ||
137 | <div class="form-group"> | 133 | <div class="form-group"> |
138 | <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> | 134 | <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> |
139 | 135 | ||
140 | <my-markdown-textarea | 136 | <my-markdown-textarea |
141 | name="instanceCodeOfConduct" formControlName="codeOfConduct" textareaMaxWidth="500px" | 137 | name="instanceCodeOfConduct" formControlName="codeOfConduct" |
142 | [ngClass]="{ 'input-error': formErrors['instance.codeOfConduct'] }" | 138 | [formError]="formErrors['instance.codeOfConduct']" |
143 | ></my-markdown-textarea> | 139 | ></my-markdown-textarea> |
144 | |||
145 | <div *ngIf="formErrors.instance.codeOfConduct" class="form-error">{{ formErrors.instance.codeOfConduct }}</div> | ||
146 | </div> | 140 | </div> |
147 | 141 | ||
148 | <div class="form-group"> | 142 | <div class="form-group"> |
@@ -150,11 +144,9 @@ | |||
150 | <div i18n class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> | 144 | <div i18n class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> |
151 | 145 | ||
152 | <my-markdown-textarea | 146 | <my-markdown-textarea |
153 | name="instanceModerationInformation" formControlName="moderationInformation" textareaMaxWidth="500px" | 147 | name="instanceModerationInformation" formControlName="moderationInformation" |
154 | [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }" | 148 | [formError]="formErrors['instance.moderationInformation']" |
155 | ></my-markdown-textarea> | 149 | ></my-markdown-textarea> |
156 | |||
157 | <div *ngIf="formErrors.instance.moderationInformation" class="form-error">{{ formErrors.instance.moderationInformation }}</div> | ||
158 | </div> | 150 | </div> |
159 | 151 | ||
160 | </div> | 152 | </div> |
@@ -172,11 +164,9 @@ | |||
172 | <div i18n class="label-small-info">A single person? A non-profit? A company?</div> | 164 | <div i18n class="label-small-info">A single person? A non-profit? A company?</div> |
173 | 165 | ||
174 | <my-markdown-textarea | 166 | <my-markdown-textarea |
175 | name="instanceAdministrator" formControlName="administrator" textareaMaxWidth="500px" | 167 | name="instanceAdministrator" formControlName="administrator" |
176 | [classes]="{ 'input-error': formErrors['instance.administrator'] }" | 168 | [formError]="formErrors['instance.administrator']" |
177 | ></my-markdown-textarea> | 169 | ></my-markdown-textarea> |
178 | |||
179 | <div *ngIf="formErrors.instance.administrator" class="form-error">{{ formErrors.instance.administrator }}</div> | ||
180 | </div> | 170 | </div> |
181 | 171 | ||
182 | <div class="form-group"> | 172 | <div class="form-group"> |
@@ -184,11 +174,9 @@ | |||
184 | <div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div> | 174 | <div i18n class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div> |
185 | 175 | ||
186 | <my-markdown-textarea | 176 | <my-markdown-textarea |
187 | name="instanceCreationReason" formControlName="creationReason" textareaMaxWidth="500px" | 177 | name="instanceCreationReason" formControlName="creationReason" |
188 | [ngClass]="{ 'input-error': formErrors['instance.creationReason'] }" | 178 | [formError]="formErrors['instance.creationReason']" |
189 | ></my-markdown-textarea> | 179 | ></my-markdown-textarea> |
190 | |||
191 | <div *ngIf="formErrors.instance.creationReason" class="form-error">{{ formErrors.instance.creationReason }}</div> | ||
192 | </div> | 180 | </div> |
193 | 181 | ||
194 | <div class="form-group"> | 182 | <div class="form-group"> |
@@ -196,11 +184,9 @@ | |||
196 | <div i18n class="label-small-info">It's important to know for users who want to register on your instance</div> | 184 | <div i18n class="label-small-info">It's important to know for users who want to register on your instance</div> |
197 | 185 | ||
198 | <my-markdown-textarea | 186 | <my-markdown-textarea |
199 | name="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" textareaMaxWidth="500px" | 187 | name="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" |
200 | [ngClass]="{ 'input-error': formErrors['instance.maintenanceLifetime'] }" | 188 | [formError]="formErrors['instance.maintenanceLifetime']" |
201 | ></my-markdown-textarea> | 189 | ></my-markdown-textarea> |
202 | |||
203 | <div *ngIf="formErrors.instance.maintenanceLifetime" class="form-error">{{ formErrors.instance.maintenanceLifetime }}</div> | ||
204 | </div> | 190 | </div> |
205 | 191 | ||
206 | <div class="form-group"> | 192 | <div class="form-group"> |
@@ -208,11 +194,9 @@ | |||
208 | <div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div> | 194 | <div i18n class="label-small-info">With your own funds? With user donations? Advertising?</div> |
209 | 195 | ||
210 | <my-markdown-textarea | 196 | <my-markdown-textarea |
211 | name="instanceBusinessModel" formControlName="businessModel" textareaMaxWidth="500px" | 197 | name="instanceBusinessModel" formControlName="businessModel" |
212 | [ngClass]="{ 'input-error': formErrors['instance.businessModel'] }" | 198 | [formError]="formErrors['instance.businessModel']" |
213 | ></my-markdown-textarea> | 199 | ></my-markdown-textarea> |
214 | |||
215 | <div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div> | ||
216 | </div> | 200 | </div> |
217 | 201 | ||
218 | </div> | 202 | </div> |
@@ -230,11 +214,9 @@ | |||
230 | <div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div> | 214 | <div i18n class="label-small-info">i.e. 2vCore 2GB RAM, a direct the link to the server you rent, etc.</div> |
231 | 215 | ||
232 | <my-markdown-textarea | 216 | <my-markdown-textarea |
233 | name="instanceHardwareInformation" formControlName="hardwareInformation" textareaMaxWidth="500px" | 217 | name="instanceHardwareInformation" formControlName="hardwareInformation" |
234 | [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" | 218 | [formError]="formErrors['instance.hardwareInformation']" |
235 | ></my-markdown-textarea> | 219 | ></my-markdown-textarea> |
236 | |||
237 | <div *ngIf="formErrors.instance.hardwareInformation" class="form-error">{{ formErrors.instance.hardwareInformation }}</div> | ||
238 | </div> | 220 | </div> |
239 | 221 | ||
240 | </div> | 222 | </div> |