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

[#55581] only show hovercard if set active

Tobias Dillmannd3345689faef
diff --git a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.html b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.html
index 52081183f2f..5912ed0156e 100644
--- a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.html
+++ b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.html
@@ -7,6 +7,7 @@
*ngIf="item && item.href"
[principal]="item"
[hideName]="true"
+ [hoverCard]="true"
[hoverCardModalTarget]="custom"
size="mini"
></op-principal>
diff --git a/frontend/src/app/shared/components/principal/principal.component.ts b/frontend/src/app/shared/components/principal/principal.component.ts
index f8f78cbdb5b..955c9e5e13a 100644
--- a/frontend/src/app/shared/components/principal/principal.component.ts
+++ b/frontend/src/app/shared/components/principal/principal.component.ts
@@ -40,7 +40,7 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
-import { AvatarSize, HoverCardOptions, PrincipalRendererService } from './principal-renderer.service';
+import { AvatarOptions, AvatarSize, HoverCardOptions, PrincipalRendererService } from './principal-renderer.service';
import { PrincipalLike } from './principal-types';
import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
import { PrincipalType } from 'core-app/shared/components/principal/principal-helper';
@@ -76,6 +76,7 @@ export class OpPrincipalComponent implements OnInit {
@Input() avatarClasses? = '';
+ @Input() hoverCard= false;
@Input() hoverCardUrl= '';
@Input() hoverCardCloseDelay:number = 100;
@Input() hoverCardAlignment:string = 'top';
@@ -106,6 +107,15 @@ export class OpPrincipalComponent implements OnInit {
? PortalOutletTarget.Default : PortalOutletTarget.Custom,
};
+ const avatarOptions:AvatarOptions = {
+ hide: this.hideAvatar,
+ size: this.size,
+ };
+
+ if (this.hoverCard) {
+ avatarOptions.hoverCard = hoverCardOptions;
+ }
+
this.principalRenderer.render(
this.elementRef.nativeElement as HTMLElement,
this.principal,
@@ -114,11 +124,7 @@ export class OpPrincipalComponent implements OnInit {
link: this.link,
classes: this.nameClasses,
},
- {
- hide: this.hideAvatar,
- size: this.size,
- hoverCard: hoverCardOptions,
- },
+ avatarOptions,
this.title === '' ? null : this.title,
);
}
diff --git a/modules/avatars/app/helpers/avatar_helper.rb b/modules/avatars/app/helpers/avatar_helper.rb
index 3de580f6cf9..7404e88d676 100644
--- a/modules/avatars/app/helpers/avatar_helper.rb
+++ b/modules/avatars/app/helpers/avatar_helper.rb
@@ -111,6 +111,7 @@ module AvatarHelper
# The hover card will be triggered by hovering over the avatar (if enabled)
hover_card = tag_options[:hover_card]
if hover_card.fetch(:active, false)
+ inputs[:hoverCard] = true
inputs[:hoverCardModalTarget] = hover_card.fetch(:target, :default)
# Hardcoded properties for now: