Skip to content

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

Remove custom labels for form labels and use schema instead

Oliver Günther4449669eb791
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 58ed199c38b..5316684176b 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -728,14 +728,7 @@ en:
settings: "Settings"
time_entry:
- project: 'Project'
- work_package: 'Work package'
work_package_required: 'Requires selecting a work package first.'
- activity: 'Activity'
- comment: 'Comment'
- duration: 'Duration'
- spent_on: 'Date'
- hours: 'Hours'
title: 'Log time'
two_factor_authentication:
diff --git a/frontend/src/app/shared/components/time_entries/form/form.component.html b/frontend/src/app/shared/components/time_entries/form/form.component.html
index e147e055545..bed034f1ad0 100644
--- a/frontend/src/app/shared/components/time_entries/form/form.component.html
+++ b/frontend/src/app/shared/components/time_entries/form/form.component.html
@@ -6,7 +6,7 @@
<div class="attributes-map">
<div class="attributes-map--key"
[ngClass]="{'-required': isRequired('user')}"
- [textContent]="text.attributes.user">
+ [textContent]="schema.user.name">
</div>
<div class="attributes-map--value">
<editable-attribute-field [resource]="entry"
@@ -17,7 +17,7 @@
<div class="attributes-map--key"
[ngClass]="{'-required': isRequired('spentOn')}"
- [textContent]="text.attributes.spentOn">
+ [textContent]="schema.spentOn.name">
</div>
<div class="attributes-map--value">
<editable-attribute-field [resource]="entry"
@@ -28,7 +28,7 @@
<div class="attributes-map--key"
[ngClass]="{'-required': isRequired('hours')}"
- [textContent]="text.attributes.hours">
+ [textContent]="schema.hours.name">
</div>
<div class="attributes-map--value">
<editable-attribute-field [resource]="entry"
@@ -40,7 +40,7 @@
<div *ngIf="showWorkPackageField"
class="attributes-map--key"
[ngClass]="{'-required': isRequired('workPackage')}"
- [textContent]="text.attributes.workPackage">
+ [textContent]="schema.workPackage.name">
</div>
<div *ngIf="showWorkPackageField"
class="attributes-map--value">
@@ -51,7 +51,7 @@
<div class="attributes-map--key"
[ngClass]="{'-required': isRequired('activity')}"
- [textContent]="text.attributes.activity">
+ [textContent]="schema.activity.name">
</div>
<div class="attributes-map--value">
<editable-attribute-field *ngIf="workPackageSelected"
@@ -65,7 +65,7 @@
<div class="attributes-map--key"
[ngClass]="{'-required': isRequired('comment')}"
- [textContent]="text.attributes.comment">
+ [textContent]="schema.comment.name">
</div>
<div class="attributes-map--value">
<editable-attribute-field [resource]="entry"
diff --git a/frontend/src/app/shared/components/time_entries/form/form.component.ts b/frontend/src/app/shared/components/time_entries/form/form.component.ts
index d0a359d101f..eb31e442d0b 100644
--- a/frontend/src/app/shared/components/time_entries/form/form.component.ts
+++ b/frontend/src/app/shared/components/time_entries/form/form.component.ts
@@ -17,6 +17,7 @@ import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { EditFormComponent } from 'core-app/shared/components/fields/edit/edit-form/edit-form.component';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/resource-changeset';
+import { SchemaResource } from 'core-app/features/hal/resources/schema-resource';
@Component({
templateUrl: './form.component.html',
@@ -34,22 +35,14 @@ export class TimeEntryFormComponent extends UntilDestroyedMixin implements OnIni
@ViewChild('editForm', { static: true }) editForm:EditFormComponent;
text = {
- attributes: {
- comment: this.i18n.t('js.time_entry.comment'),
- hours: this.i18n.t('js.time_entry.hours'),
- activity: this.i18n.t('js.time_entry.activity'),
- workPackage: this.i18n.t('js.time_entry.work_package'),
- spentOn: this.i18n.t('js.time_entry.spent_on'),
- user: 'Resource',
- },
wpRequired: this.i18n.t('js.time_entry.work_package_required'),
};
public workPackageSelected = false;
- public customFields:{ key:string, label:string }[] = [];
+ public schema:SchemaResource;
- public availableAssigneesPath:string;
+ public customFields:{ key:string, label:string }[] = [];
constructor(readonly halEditing:HalResourceEditingService,
readonly cdRef:ChangeDetectorRef,
@@ -71,6 +64,7 @@ export class TimeEntryFormComponent extends UntilDestroyedMixin implements OnIni
}
});
+ this.schema = this.changeset.schema;
this.setCustomFields();
this.cdRef.detectChanges();
}
@@ -109,8 +103,4 @@ export class TimeEntryFormComponent extends UntilDestroyedMixin implements OnIni
}
});
}
-
- private get schema() {
- return this.changeset.schema;
- }
}