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

Change card layout according to new specification

Henriette Darge57a2a8041289
diff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts
index 93ed909e097..69e98ff6f25 100644
--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts
@@ -2,7 +2,6 @@ import {
ChangeDetectionStrategy,
Component,
ElementRef,
- HostListener,
OnInit,
ViewChild,
} from '@angular/core';
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.sass b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.sass
index 66fc1a32053..57f724ab4ff 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.sass
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.sass
@@ -13,3 +13,11 @@
&--text
@include text-shortener
+
+ &_small
+ .op-wp-status-button--button
+ line-height: 16px
+ font-size: 12px
+ height: 16px
+ padding: 0px 5px
+ margin-right: 0
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.ts
index da45985efc2..a8ccdaf5440 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.component.ts
@@ -45,6 +45,8 @@ import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
export class WorkPackageStatusButtonComponent extends UntilDestroyedMixin implements OnInit {
@Input('workPackage') public workPackage:WorkPackageResource;
+ @Input() public small = false;
+
public text = {
explanation: this.I18n.t('js.label_edit_status'),
workPackageReadOnly: this.I18n.t('js.work_packages.message_work_package_read_only'),
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.html b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.html
index 6750ef16ddd..deebda6aa2a 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.html
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-status-button/wp-status-button.html
@@ -1,5 +1,6 @@
<div
class="op-wp-status-button"
+ [ngClass]="{'op-wp-status-button_small' : small}"
data-qa-selector="op-wp-status-button"
[attr.title]="buttonTitle"
*ngIf="status"
diff --git a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.html b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.html
index c5a4dcc7dea..da14e739a01 100644
--- a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.html
@@ -57,31 +57,37 @@
data-qa-selector="op-wp-single-card--content-type"
[ngClass]="typeHighlightingClass(workPackage)">
</span>
- <a class="op-wp-single-card--content-id"
- [href]="fullWorkPackageLink(workPackage)"
- [ngClass]="uiStateLinkClass"
- (click)="emitStateLinkClicked($event, workPackage)"
- >
- #{{workPackage.id}}
- </a>
- <span [textContent]="wpSubject(workPackage)"
- class="op-wp-single-card--content-subject"
+ <span class="op-wp-single-card--content-subject"
data-qa-selector="op-wp-single-card--content-subject">
+ <a class="op-wp-single-card--content-id"
+ [href]="fullWorkPackageLink(workPackage)"
+ [ngClass]="uiStateLinkClass"
+ (click)="emitStateLinkClicked($event, workPackage)"
+ >
+ #{{workPackage.id}}
+ </a>
+ <span [textContent]="wpSubject(workPackage)">
+ </span>
</span>
<img *ngIf="this.cardCoverImageShown(workPackage)"
[src]="this.bcfSnapshotPath(workPackage)"
class="op-wp-single-card--content-cover-image">
<wp-status-button *ngIf="showStatusButton"
[workPackage]="workPackage"
+ [small]="true"
class="op-wp-single-card--content-status">
</wp-status-button>
<op-principal
*ngIf="workPackage.assignee"
[principal]="workPackage.assignee"
- [hideName]="true"
+ [hideName]="false"
+ [link]="false"
size="mini"
class="op-wp-single-card--content-assignee"
data-qa-selector="op-wp-single-card--content-assignee"
></op-principal>
+ <span [textContent]="wpDates(workPackage)"
+ class="op-wp-single-card--content-dates">
+ </span>
</div>
</div>
diff --git a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.sass b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.sass
index bdf261acac1..9661ca9fee3 100644
--- a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.sass
+++ b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.sass
@@ -23,7 +23,7 @@
&_horizontal
height: 100%
-
+
&_vertical
margin-top: 10px
// Take care that the shadow of the last element is still visible
@@ -38,19 +38,22 @@
&:not(.-new)
display: grid
- grid-template-columns: auto 1fr auto
- grid-template-rows: auto auto auto 1fr auto
- grid-row-gap: 10px
- grid-template-areas: "project project project" "type type type" "subject subject subject" "image image image" "attributeTag avatar idlink"
+ grid-template-columns: max-content max-content max-content max-content 1fr
+ grid-template-rows: auto auto 1fr auto
+ grid-row-gap: 5px
+ grid-column-gap: 5px
+ grid-template-areas: "project type status status status" "subject subject subject subject subject" "image image image image image" "avatar avatar dates dates dates"
overflow: hidden
flex-grow: 1
+ font-size: 14px
+ line-height: 16px
&-project-name
grid-area: project
font-style: italic
color: var(--gray-dark)
- font-size: 12px
- @include text-shortener(false)
+ @include text-shortener
+ max-width: 80px
&-type
grid-area: type
&-subject
@@ -59,12 +62,12 @@
&-assignee
grid-area: avatar
place-self: center left
- &-id
- grid-area: idlink
- place-self: center right
+ color: var(--gray-dark)
+ font-size: 12px
&-status
- grid-area: attributeTag
+ grid-area: status
margin-right: 5px
+ place-self: center start
overflow: hidden
&-cover-image
grid-area: image
@@ -73,6 +76,12 @@
@media screen and (max-width: 679px)
max-height: 250px
+ &-dates
+ grid-area: dates
+ place-self: center end
+ color: var(--gray-dark)
+ font-size: 12px
+
&--highlighting
width: 5px
height: 100%
diff --git a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.ts b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.ts
index 3791897bb54..d8433bf90fa 100644
--- a/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-card-view/wp-single-card/wp-single-card.component.ts
@@ -126,6 +126,31 @@ export class WorkPackageSingleCardComponent extends UntilDestroyedMixin implemen
return wp.project?.name;
}
+ public wpDates(wp:WorkPackageResource):string {
+ const startDate = wp.startDate;
+ const dueDate = wp.dueDate;
+ const dateTimeFormat = new Intl.DateTimeFormat('en', {
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ });
+
+ if (startDate && dueDate) {
+ // see https://github.com/Microsoft/TypeScript/issues/23691
+ // @ts-ignore
+ return dateTimeFormat.formatRange(new Date(startDate), new Date(dueDate));
+ }
+ if (!startDate && dueDate) {
+ return `- ${dateTimeFormat.format(new Date(dueDate))}`;
+ }
+
+ if (startDate && !dueDate) {
+ return `${dateTimeFormat.format(new Date(startDate))} -`;
+ }
+
+ return '';
+ }
+
public fullWorkPackageLink(wp:WorkPackageResource):string {
return this.$state.href('work-packages.show', { workPackageId: wp.id });
}