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

[31369] Default placeholder for all formattable fields

Oliver Günther837a2d8c8b4f
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 22b75204a80..e556e869884 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -750,7 +750,7 @@ en:
label_content: "Click here to skip over the menu and go to the content"
placeholders:
default: "-"
- description: "Click to enter description..."
+ formattable: "%{name}: Click to edit..."
query:
column_names: "Columns"
group_by: "Group results by"
diff --git a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts
index cb3d9b4b6e5..e74137780f0 100644
--- a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts
+++ b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts
@@ -127,9 +127,6 @@ export class WorkPackageSingleViewComponent implements OnInit, OnDestroy {
fields: {
description: this.I18n.t('js.work_packages.properties.description'),
},
- description: {
- placeholder: this.I18n.t('js.work_packages.placeholders.description')
- },
infoRow: {
createdBy: this.I18n.t('js.label_created_by'),
lastUpdatedOn: this.I18n.t('js.label_last_updated_on')
diff --git a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html
index b02fa67ea9d..61e6b8e92ec 100644
--- a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html
+++ b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html
@@ -86,8 +86,7 @@
<editable-attribute-field [fieldName]="'description'"
[resource]="workPackage"
[isDropTarget]="true"
- [wrapperClasses]="'-no-label'"
- [displayPlaceholder]="text.description.placeholder">
+ [wrapperClasses]="'-no-label'">
</editable-attribute-field>
</div>
</div>
diff --git a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts b/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
index 105df88d2c6..36e67bbd51d 100644
--- a/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
+++ b/frontend/src/app/components/wp-edit-form/display-field-renderer.ts
@@ -33,7 +33,7 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
public render(resource:T,
name:string,
change:ResourceChangeset<T>|null,
- placeholder = cellEmptyPlaceholder):HTMLSpanElement {
+ placeholder?:string):HTMLSpanElement {
const [field, span] = this.renderFieldValue(resource, name, change, placeholder);
@@ -49,7 +49,7 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
public renderFieldValue(resource:T,
name:string,
change:ResourceChangeset<T>|null,
- placeholder = cellEmptyPlaceholder):[DisplayField|null, HTMLSpanElement] {
+ placeholder?:string):[DisplayField|null, HTMLSpanElement] {
const span = document.createElement('span');
const schemaName = this.getSchemaName(resource, change, name);
const fieldSchema = resource.schema[schemaName];
@@ -61,7 +61,7 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
}
const field = this.getField(resource, fieldSchema, schemaName, change);
- field.render(span, this.getText(field, placeholder));
+ field.render(span, this.getText(field, fieldSchema, placeholder));
const title = field.title;
if (title) {
@@ -109,9 +109,9 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
return this.displayFieldService.getField(resource, name, fieldSchema, context);
}
- private getText(field:DisplayField, placeholder:string):string {
+ private getText(field:DisplayField, fieldSchema:IFieldSchema, placeholder?:string):string {
if (field.isEmpty()) {
- return placeholder;
+ return placeholder || this.getDefaultPlaceholder(fieldSchema);
} else {
return field.valueString;
}
@@ -191,4 +191,12 @@ export class DisplayFieldRenderer<T extends HalResource = HalResource> {
return name;
}
+
+ private getDefaultPlaceholder(fieldSchema:IFieldSchema):string {
+ if (fieldSchema.type === 'Formattable') {
+ return this.I18n.t('js.work_packages.placeholders.formattable', { name: fieldSchema.name });
+ }
+
+ return cellEmptyPlaceholder;
+ }
}