OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Update styles for spot-form-field
Benjamin Bädorfeafde7a30bb6
diff --git a/frontend/src/app/features/invite-user-modal/message/message.component.html b/frontend/src/app/features/invite-user-modal/message/message.component.htmlindex df27693f6ce..8865fb36608 100644--- a/frontend/src/app/features/invite-user-modal/message/message.component.html+++ b/frontend/src/app/features/invite-user-modal/message/message.component.html@@ -8,7 +8,7 @@<div class="spot-modal--body op-form"><spot-form-field [label]="text.label">- <p class="spot-form-field--description" slot="description">+ <p slot="description">{{ text.description() }}</p><textareadiff --git a/frontend/src/app/features/invite-user-modal/role/role.component.html b/frontend/src/app/features/invite-user-modal/role/role.component.htmlindex 1728dc7226c..320809daf7a 100644--- a/frontend/src/app/features/invite-user-modal/role/role.component.html+++ b/frontend/src/app/features/invite-user-modal/role/role.component.html@@ -11,16 +11,16 @@[label]="text.label()"required>- <p- class="spot-form-field--description"- slot="description"- [innerHtml]="text.description()"- ></p><op-ium-role-search[spotFormBinding]="roleControl"slot="input"></op-ium-role-search>+ <p+ slot="description"+ [innerHtml]="text.description()"+ ></p>+<divslot="errors"class="spot-form-field--error"diff --git a/frontend/src/app/spot/components/form-field/form-field.component.ts b/frontend/src/app/spot/components/form-field/form-field.component.tsindex 523dc562f29..f02cd41f262 100644--- a/frontend/src/app/spot/components/form-field/form-field.component.ts+++ b/frontend/src/app/spot/components/form-field/form-field.component.ts@@ -60,6 +60,8 @@ export class SpotFormFieldComponent {return false;}+ console.log(this.formControl.errors);+if (this.showValidationErrorOn === 'submit') {return this.formControl.invalid && this._formGroupDirective?.submitted;} if (this.showValidationErrorOn === 'blur') {diff --git a/frontend/src/app/spot/spot-docs.component.html b/frontend/src/app/spot/spot-docs.component.htmlindex b64d1dfe4f6..a7cbf7cb4ff 100644--- a/frontend/src/app/spot/spot-docs.component.html+++ b/frontend/src/app/spot/spot-docs.component.html@@ -444,20 +444,67 @@ Currently selected value is {{ toggleValue }}<h1>Form Field</h1><section class="space-children">- <spot-form-field- label="Username"- required="true"- >+ <spot-form-field label="Some input"><spot-text-fieldslot="input"- [(ngModel)]="usernameValue"- >- <span- slot="before"- class="spot-icon spot-icon_user"- ></span>- </spot-text-field>+ [(ngModel)]="textFieldValue"+ ></spot-text-field>++ <p+ slot="description"+ class="spot-form-field--description"+ >This is a description for the form field</p></spot-form-field>++ <form+ [formGroup]="usernameForm"+ (ngSubmit)="onUsernameSubmit()"+ >+ <spot-form-field+ label="Validated input"+ [required]="true"+ >+ <spot-text-field+ slot="input"+ formControlName="username"+ >+ <span+ slot="before"+ class="spot-icon spot-icon_user"+ ></span>+ </spot-text-field>++ <p+ slot="description"+ class="spot-form-field--description"+ >+ This field has validation; try typing in it. The current value is "{{ usernameForm.get('username')!.value }}"+ </p>++ <p+ slot="errors"+ class="spot-form-field--error"+ *ngIf="usernameForm.get('username')!.errors?.required"+ >+ This field is required+ </p>++ <p+ slot="errors"+ class="spot-form-field--error"+ *ngIf="usernameForm.get('username')!.errors?.minlength"+ >+ A username must have at least 3 characters+ </p>+ <p+ slot="errors"+ class="spot-form-field--error"+ *ngIf="usernameForm.get('username')!.errors?.maxlength"+ >+ A username must have at most 5 characters+ </p>+ </spot-form-field>+ </form></section><h1>Drop Modal</h1>diff --git a/frontend/src/app/spot/spot-docs.component.ts b/frontend/src/app/spot/spot-docs.component.tsindex 91877019625..5b5b2a9b56c 100644--- a/frontend/src/app/spot/spot-docs.component.ts+++ b/frontend/src/app/spot/spot-docs.component.ts@@ -1,4 +1,5 @@import { Component, ViewEncapsulation } from '@angular/core';+import { FormControl, FormGroup, Validators } from '@angular/forms';@Component({selector: 'spot-docs',@@ -15,7 +16,13 @@ export class SpotDocsComponent {textFieldValue = 'ngModel value';- usernameValue = '';+ usernameForm = new FormGroup({+ username: new FormControl('', [+ Validators.required,+ Validators.minLength(3),+ Validators.maxLength(5),+ ]),+ });dropModalOpen = false;@@ -46,4 +53,8 @@ export class SpotDocsComponent {return 'false (unchecked)';}++ onUsernameSubmit() {+ alert(this.usernameForm.get('username')?.value);+ }}diff --git a/frontend/src/app/spot/spot.module.ts b/frontend/src/app/spot/spot.module.tsindex 071f1dcfe67..123b85c906e 100644--- a/frontend/src/app/spot/spot.module.ts+++ b/frontend/src/app/spot/spot.module.ts@@ -1,5 +1,6 @@import { NgModule } from '@angular/core';import { FormsModule } from '@angular/forms';+import { ReactiveFormsModule } from '@angular/forms';import { CommonModule } from '@angular/common';import { A11yModule } from '@angular/cdk/a11y';import { UIRouterModule } from '@uirouter/angular';@@ -20,6 +21,7 @@ import { SpotDocsComponent } from './spot-docs.component';// Routes for /spot-docsUIRouterModule.forChild({ states: SPOT_DOCS_ROUTES }),FormsModule,+ ReactiveFormsModule,CommonModule,],providers: [diff --git a/frontend/src/app/spot/styles/sass/components/form-field.children.sass b/frontend/src/app/spot/styles/sass/components/form-field.children.sassindex f7d19e1e1f0..283c9acb86d 100644--- a/frontend/src/app/spot/styles/sass/components/form-field.children.sass+++ b/frontend/src/app/spot/styles/sass/components/form-field.children.sass@@ -1,7 +1,8 @@.spot-form-field_invalid.ng-select-container,- .spot-input,- .spot-option-list--item,+ .op-input,+ .op-option-list--item,+ .spot-text-field,.document-editor__editable-container,.ck.ck-toolbar- border-color: var(--content-form-error-color)+ border-color: $spot-color-danger-lightdiff --git a/frontend/src/app/spot/styles/sass/components/form-field.sass b/frontend/src/app/spot/styles/sass/components/form-field.sassindex f998950a4ea..c801140eeed 100644--- a/frontend/src/app/spot/styles/sass/components/form-field.sass+++ b/frontend/src/app/spot/styles/sass/components/form-field.sass@@ -3,7 +3,6 @@.spot-form-fielddisplay: flexflex-direction: column- line-height: 1.6rem// This is a fix for the formly-forms, which render the wrapper around a non-visible input&:empty@@ -18,7 +17,6 @@display: flexflex-direction: rowalign-items: center- min-height: $spot-spacing-1_5margin-bottom: $spot-spacing-0_25@include spot-body-small@@ -27,20 +25,23 @@&-indicatorcolor: $spot-color-basic-black- &_invalid &--label- color: var(--content-form-error-color)+ &--input+ margin-bottom: $spot-spacing-0_25&--description- font-size: 12px+ @include spot-caption+ font-style: italic+ margin-bottom: $spot-spacing-0_25+ color: $spot-color-basic-gray-2&--errorsdisplay: flexflex-direction: column&--error- color: var(--content-form-error-color)- margin-bottom: 1rem- font-size: 0.8rem+ @include spot-caption+ color: $spot-color-danger-dark+ margin-bottom: $spot-spacing-0_25&--label,&--description,