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
generalize required field indicator on time entry form
ulfertsf51cc50e6981
diff --git a/frontend/src/app/modules/time_entries/form/form.component.html b/frontend/src/app/modules/time_entries/form/form.component.htmlindex 4dc1df104a1..5287a47ae7c 100644--- a/frontend/src/app/modules/time_entries/form/form.component.html+++ b/frontend/src/app/modules/time_entries/form/form.component.html@@ -5,7 +5,10 @@(onSaved)="signalModifiedEntry($event)"><div class="attributes-map">- <div class="attributes-map--key -required" [textContent]="text.attributes.spentOn"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired('spentOn')}"+ [textContent]="text.attributes.spentOn">+ </div><div class="attributes-map--value"><editable-attribute-field [resource]="entry"[wrapperClasses]="'-tiny'"@@ -13,7 +16,10 @@</editable-attribute-field></div>- <div class="attributes-map--key -required" [textContent]="text.attributes.hours"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired('hours')}"+ [textContent]="text.attributes.hours">+ </div><div class="attributes-map--value"><editable-attribute-field [resource]="entry"[wrapperClasses]="'-tiny'"@@ -21,14 +27,20 @@</editable-attribute-field></div>- <div class="attributes-map--key -required" [textContent]="text.attributes.workPackage"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired('workPackage')}"+ [textContent]="text.attributes.workPackage">+ </div><div class="attributes-map--value"><editable-attribute-field [resource]="entry"[fieldName]="'workPackage'"></editable-attribute-field></div>- <div class="attributes-map--key -required" [textContent]="text.attributes.activity"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired('activity')}"+ [textContent]="text.attributes.activity">+ </div><div class="attributes-map--value"><editable-attribute-field *ngIf="workPackageSelected"[resource]="entry"@@ -39,7 +51,10 @@</i></div>- <div class="attributes-map--key" [textContent]="text.attributes.comment"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired('comment')}"+ [textContent]="text.attributes.comment">+ </div><div class="attributes-map--value"><editable-attribute-field [resource]="entry"[fieldName]="'comment'">@@ -47,7 +62,10 @@</div><ng-container *ngFor="let cf of customFields">- <div class="attributes-map--key" [textContent]="cf.label"></div>+ <div class="attributes-map--key"+ [ngClass]="{'-required': isRequired(cf.key)}"+ [textContent]="cf.label">+ </div><div class="attributes-map--value"><editable-attribute-field [resource]="entry"[fieldName]="cf.key">diff --git a/frontend/src/app/modules/time_entries/form/form.component.ts b/frontend/src/app/modules/time_entries/form/form.component.tsindex 26ff11b8f8c..87491dc2241 100644--- a/frontend/src/app/modules/time_entries/form/form.component.ts+++ b/frontend/src/app/modules/time_entries/form/form.component.ts@@ -72,6 +72,16 @@ export class TimeEntryFormComponent implements OnInit, OnDestroy {return this.entry.isNew;}+ public isRequired(field:string) {+ // Other than defined in the schema, we consider the work package to be required.+ // Remove once the schema requires it explicitly.+ if (field === 'workPackage') {+ return true;+ } else {+ return this.entry.schema[field].required;+ }+ }+private setCustomFields(schema:SchemaResource) {Object.entries(schema).forEach(([key, keySchema]) => {if (key.match(/customField\d+/)) {