Fix display of start|due date in milestones

pull/5867/head
Oliver Günther 7 years ago
parent ed1a0c87de
commit 2aecba00f6
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 1
      app/assets/stylesheets/content/work_packages/timelines/elements/_labels.sass
  2. 2
      frontend/app/components/wp-fast-table/state/wp-table-timeline.service.ts
  3. 38
      frontend/app/components/wp-table/timeline/cells/timeline-milestone-cell-renderer.ts
  4. 23
      spec/features/work_packages/timeline/timeline_labels_spec.rb

@ -16,6 +16,7 @@
white-space: nowrap
// Position container left of bar
position: absolute
top: 3px
left: 0px
// Then translate by its own width + some margin
transform: translateX(calc(-100% - 10px))

@ -103,7 +103,7 @@ export class WorkPackageTableTimelineService extends WorkPackageTableBaseService
// Set to null to explicitly disable
if (attribute === '') {
labels[position] = null;
} else if (workPackage.schema[attribute]) {
} else {
labels[position] = attribute;
}
});

@ -209,4 +209,42 @@ export class TimelineMilestoneCellRenderer extends TimelineCellRenderer {
protected renderHoverLabels(labels:WorkPackageCellLabels, changeset:WorkPackageChangeset) {
this.renderLabel(changeset, labels, 'rightHover', 'date');
}
protected updateLabels(activeDragNDrop:boolean,
labels:WorkPackageCellLabels,
changeset:WorkPackageChangeset) {
const labelConfiguration = this.wpTableTimeline.getNormalizedLabels(changeset.workPackage);
if (!activeDragNDrop) {
// normal display
// Show only one date field if left=start, right=dueDate
if (labelConfiguration.left === 'startDate' && labelConfiguration.right === 'dueDate') {
this.renderLabel(changeset, labels, 'left', null);
this.renderLabel(changeset, labels, 'right', 'date');
} else {
this.renderLabel(changeset, labels, 'left', labelConfiguration.left);
this.renderLabel(changeset, labels, 'right', labelConfiguration.right);
}
this.renderLabel(changeset, labels, 'farRight', labelConfiguration.farRight);
}
// Update hover labels
this.renderHoverLabels(labels, changeset);
}
protected renderLabel(changeset:WorkPackageChangeset,
labels:WorkPackageCellLabels,
position:LabelPosition|'leftHover'|'rightHover',
attribute:string|null) {
// Normalize attribute
if (attribute === 'startDate' || attribute === 'dueDate') {
attribute = 'date';
}
super.renderLabel(changeset, labels, position, attribute);
}
}

@ -152,5 +152,28 @@ RSpec.feature 'Work package timeline labels',
row.expect_labels left: '-',
right: milestone_type.name,
farRight: milestone_work_package.status.name
# Set labels to start|due|subject
config_modal.open!
config_modal.expect_labels! left: 'Assignee',
right: 'Type',
farRight: 'Status'
config_modal.update_labels left: 'Start date',
right: 'Due date',
farRight: 'Subject'
# Check overriden labels
row = wp_timeline.timeline_row work_package.id
row.expect_labels left: '2017-08-21',
right: '2017-08-25',
farRight: work_package.subject
# Check default labels (milestone)
row = wp_timeline.timeline_row milestone_work_package.id
row.expect_labels left: nil,
right: '2017-08-30',
farRight: milestone_work_package.subject
end
end

Loading…
Cancel
Save