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

Let images get the most space in a card. Thus we move the title to the bottom for better alignment with other cards.

Henriette Dingerf5de6ecc18bf
diff --git a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.html b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.html
index ce4f7c00365..7a24949e5bc 100644
--- a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.html
+++ b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.html
@@ -38,7 +38,9 @@
</div>
</edit-form>
- <img *ngIf="this.bcfSnapshotPath(workPackage)" [src]="this.bcfSnapshotPath(workPackage)" class="wp-card--cover-image">
+ <img *ngIf="this.cardCoverImageShown(workPackage)"
+ [src]="this.bcfSnapshotPath(workPackage)"
+ class="wp-card--cover-image">
<div *ngIf="!workPackage.isNew"
class="wp-card--content">
diff --git a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.sass b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.sass
index 2e950c5fac8..f6d7f96c8c4 100644
--- a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.sass
+++ b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.sass
@@ -36,6 +36,12 @@
wp-single-card:host.gu-transit &
@include modifying--placeholder
+ &.-with-card-cover-image
+ justify-content: space-between
+
+ .wp-card--content
+ flex-grow: 0
+
.wp-card--content:not(.-new)
display: grid
grid-template-columns: auto 1fr auto
diff --git a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
index 3d133202600..5d0b12d3008 100644
--- a/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
+++ b/frontend/src/app/components/wp-card-view/wp-single-card/wp-single-card.component.ts
@@ -4,7 +4,8 @@ import {
Component,
EventEmitter,
Input,
- OnDestroy, OnInit,
+ OnDestroy,
+ OnInit,
Output
} from "@angular/core";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
@@ -87,6 +88,7 @@ export class WorkPackageSingleCardComponent implements OnDestroy, OnInit {
classes += ' wp-card-' + this.workPackage.id;
classes += ' -' + this.orientation;
classes += this.shrinkOnMobile ? ' -shrink' : '';
+ classes += this.cardCoverImageShown(this.workPackage) ? ' -with-card-cover-image' : '';
return classes;
}
@@ -110,9 +112,12 @@ export class WorkPackageSingleCardComponent implements OnDestroy, OnInit {
this.onRemove.emit(wp);
}
+ public cardCoverImageShown(wp:WorkPackageResource):boolean {
+ return this.bcfSnapshotPath(wp) !== null;
+ }
+
public bcfSnapshotPath(wp:WorkPackageResource) {
- let vp = _.get(wp, 'bcfViewpoints[0]');
- return vp ? `${vp.href}/snapshot` : null;
+ return wp.bcfViewpoints && wp.bcfViewpoints.length > 0 ? wp.bcfViewpoints[0].href + '/snapshot' : null;
}
private isSelected(wp:WorkPackageResource):boolean {