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

Move principal icon list into its own component

Benjamin Bädorf6b40548aface
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
index 07353198248..1bed74cfab7 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
@@ -52,22 +52,12 @@
></span>
</ng-container>
- <div
- class="op-ian-item--actor"
- *ngIf="actors.length > 0"
- >
- <op-principal
- *ngFor="let actor of actors"
- [hide-name]="true"
- [principal]="actor"
- [link]="false"
- size="mini"
- ></op-principal>
- </div>
+ <op-principal-list
+ class="op-ian-item--actors"
+ [principals]="actors"
+ ></op-principal-list>
- <div
- class="op-ian-item--status"
- >
+ <div class="op-ian-item--status">
<op-in-app-notification-status [status]="workPackage.status"></op-in-app-notification-status>
</div>
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
index 4d32e5fea0b..1eb46040641 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
@@ -30,14 +30,14 @@ $subject-font-size: 14px
display: grid
grid-template-columns: 50px 1fr 200px 15% 15%
grid-template-rows: auto $subject-font-size 1fr
- grid-template-areas: "project project project project project" "title title status date buttons" "actor reason reason reason reason"
+ grid-template-areas: "project project project project project" "title title status date buttons" "actors reason reason reason reason"
grid-gap: 0.5rem
align-items: center
@media screen and (max-width: 679px)
grid-template-columns: 1fr 35px 30%
grid-template-rows: auto 1fr
- grid-template-areas: "project actor reason" "title actor date"
+ grid-template-areas: "project actors reason" "title actors date"
&_unexpandable
cursor: default
@@ -100,8 +100,8 @@ $subject-font-size: 14px
white-space: nowrap
max-width: 100%
- &--actor
- grid-area: actor
+ &--actors
+ grid-area: actors
@include text-shortener
&--status
diff --git a/frontend/src/app/shared/components/principal/principal-list.component.html b/frontend/src/app/shared/components/principal/principal-list.component.html
new file mode 100644
index 00000000000..62f40883086
--- /dev/null
+++ b/frontend/src/app/shared/components/principal/principal-list.component.html
@@ -0,0 +1,8 @@
+<op-principal
+ class="op-principal-list--principal"
+ *ngFor="let principal of principals"
+ [hide-name]="true"
+ [principal]="principal"
+ [link]="false"
+ size="mini"
+></op-principal>
diff --git a/frontend/src/app/shared/components/principal/principal-list.component.ts b/frontend/src/app/shared/components/principal/principal-list.component.ts
new file mode 100644
index 00000000000..9ff57a52675
--- /dev/null
+++ b/frontend/src/app/shared/components/principal/principal-list.component.ts
@@ -0,0 +1,21 @@
+import {
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+} from '@angular/core';
+import { PrincipalLike } from 'core-app/shared/components/principal/principal-types';
+
+@Component({
+ selector: 'op-principal-list',
+ templateUrl: './principal-list.component.html',
+ styleUrls: [],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ host: {
+ class: 'op-principal-list',
+ },
+})
+export class OpPrincipalListComponent {
+ @Input() principals:PrincipalLike[];
+
+ constructor() {}
+}
diff --git a/frontend/src/app/shared/components/principal/principal-rendering.module.ts b/frontend/src/app/shared/components/principal/principal-rendering.module.ts
index dc718fc47eb..99c76dbe7e9 100644
--- a/frontend/src/app/shared/components/principal/principal-rendering.module.ts
+++ b/frontend/src/app/shared/components/principal/principal-rendering.module.ts
@@ -1,17 +1,23 @@
import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
import { OpPrincipalComponent } from './principal.component';
+import { OpPrincipalListComponent } from './principal-list.component';
import { PrincipalRendererService } from './principal-renderer.service';
@NgModule({
- imports: [],
+ imports: [
+ CommonModule,
+ ],
exports: [
OpPrincipalComponent,
+ OpPrincipalListComponent,
],
providers: [
PrincipalRendererService,
],
declarations: [
OpPrincipalComponent,
+ OpPrincipalListComponent,
],
})
export class OpenprojectPrincipalRenderingModule { }
diff --git a/frontend/src/global_styles/content/_index.sass b/frontend/src/global_styles/content/_index.sass
index 7f1471356f5..110d8e5f830 100644
--- a/frontend/src/global_styles/content/_index.sass
+++ b/frontend/src/global_styles/content/_index.sass
@@ -46,6 +46,7 @@
@import journal
@import pagination
@import principal
+@import principal-list
@import progress_bar
@import request_for_confirmation
@import form_error_messages
diff --git a/frontend/src/global_styles/content/_principal-list.sass b/frontend/src/global_styles/content/_principal-list.sass
new file mode 100644
index 00000000000..464ffb1bfe4
--- /dev/null
+++ b/frontend/src/global_styles/content/_principal-list.sass
@@ -0,0 +1,5 @@
+.op-principal-list
+ display: flex
+
+ &--principal:not(:first-child)
+ margin-left: -12px