Correct milestone attribute name in cell builder

pull/5193/head
Oliver Günther 8 years ago
parent eb3faf84e0
commit 7c4138ea62
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 21
      frontend/app/components/wp-fast-table/builders/cell-builder.ts

@ -18,12 +18,13 @@ export class CellBuilder {
injectorBridge(this);
}
public build(workPackage:WorkPackageResource, name:string) {
let fieldSchema = workPackage.schema[name];
public build(workPackage:WorkPackageResource, attribute:string) {
const name = this.correctDateAttribute(workPackage, attribute);
const fieldSchema = workPackage.schema[name];
let td = document.createElement('td');
const td = document.createElement('td');
td.classList.add(tdClassName, name);
let span = document.createElement('span');
const span = document.createElement('span');
span.classList.add(cellClassName, 'inplace-edit', 'wp-edit-field', name);
span.dataset['fieldName'] = name;
@ -36,7 +37,6 @@ export class CellBuilder {
}
const field = this.wpDisplayField.getField(workPackage, name, fieldSchema) as DisplayField;
let text;
if (name === 'id') {
@ -66,6 +66,17 @@ export class CellBuilder {
return td;
}
/**
* Milestones should display the 'date' attribute for start and due dates
*/
private correctDateAttribute(workPackage:WorkPackageResource, name:string):string {
if (workPackage.isMilestone && (name === 'dueDate' || name === 'startDate')) {
return 'date';
}
return name;
}
}
CellBuilder.$inject = ['wpDisplayField'];

Loading…
Cancel
Save