[#55581] make user hover card opt-out

By default, it will now be shown. Since we want to have it almost
anywhere on the page, it makes sense that `true` is the default setting.
This commit is contained in:
Tobias Dillmann
2024-11-25 12:33:09 +01:00
parent 2501760cec
commit 52cdcdd9f2
16 changed files with 22 additions and 35 deletions
+1 -2
View File
@@ -46,8 +46,7 @@ module Members
end
def name
render Users::AvatarComponent.new(user: principal, size: :mini, link: true, show_name: true,
hover_card: { active: true })
render Users::AvatarComponent.new(user: principal, size: :mini, link: true, show_name: true)
end
def mail
+1 -1
View File
@@ -33,7 +33,7 @@ module Users
include OpPrimer::ComponentHelpers
def initialize(user:, show_name: true, link: true, size: "default", classes: "", title: nil, name_classes: "",
hover_card: { active: false, target: :default })
hover_card: { active: true, target: :default })
super
@user = user
@@ -15,7 +15,7 @@
header_container.with_column(flex_layout: true,
classes: "work-packages-activities-tab-journals-item-component--header-start-container ellipsis") do |header_start_container|
header_start_container.with_column(mr: 2) do
render Users::AvatarComponent.new(user: journal.user, show_name: false, size: :mini, hover_card: { active: true })
render Users::AvatarComponent.new(user: journal.user, show_name: false, size: :mini)
end
header_start_container.with_column(mr: 1, flex_layout: true,
classes: "work-packages-activities-tab-journals-item-component--user-name-container hidden-for-desktop") do |user_name_container|
@@ -96,7 +96,7 @@ module WorkPackages
def render_user_avatar(container)
container.with_column(mr: 2) do
render Users::AvatarComponent.new(user: journal.user, show_name: false, size: :mini, hover_card: { active: true })
render Users::AvatarComponent.new(user: journal.user, show_name: false, size: :mini)
end
end
+1 -3
View File
@@ -3,9 +3,7 @@
<ul class="widget-box--arrow-links">
<% @news.each do |news| %>
<li class="widget-box--arrow-multiline">
<%= avatar(news.author,
class: 'widget-box--avatar news-author-avatar hidden-for-mobile',
hover_card: { active: true }) %>
<%= avatar(news.author, class: 'widget-box--avatar news-author-avatar hidden-for-mobile') %>
<div class="widget-box--project">
<%= link_to_project(news.project) + ': ' %>
<%= link_to h(news.title), news_path(news) %>
+2 -4
View File
@@ -58,10 +58,8 @@ See COPYRIGHT and LICENSE files for more details.
<% if @newss.any? %>
<% @newss.each do |news| %>
<div class="news">
<h3 class="news--header">
<%= avatar(news.author, hover_card: { active: true }) %>
<%= link_to_project(news.project) + ': ' unless news.project == @project %>
<%= link_to h(news.title), news_path(news) %>
<h3 class="news--header"><%= avatar(news.author) %><%= link_to_project(news.project) + ': ' unless news.project == @project %>
<%= link_to h(news.title), news_path(news) %>
<%= "(#{t(:label_x_comments, count: news.comments_count)})" if news.comments_count > 0 %></h3>
<p class="author additional-information"><%= authoring news.created_at, news.author %></p>
<div class="wiki op-uc-container">
+2 -4
View File
@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%= toolbar title: "#{avatar(@news.author, hover_card: { active: true })} #{h @news.title}".html_safe do %>
<%= toolbar title: "#{avatar(@news.author)} #{h @news.title}".html_safe do %>
<% if User.current.allowed_in_project?(:manage_news, @project) %>
<li class="toolbar-item">
<%= link_to(edit_news_path(@news),
@@ -88,9 +88,7 @@ See COPYRIGHT and LICENSE files for more details.
title: t(:button_delete),
alt: t(:button_delete) %>
</div>
<h4 class="author additional-information">
<%= avatar(comment.author, hover_card: { active: true }) %><%= authoring comment.created_at, comment.author %>
</h4>
<h4 class="author additional-information"><%= avatar(comment.author) %><%= authoring comment.created_at, comment.author %></h4>
<%= format_text(comment.comments, object: comment) %>
</div>
<% end %>
@@ -146,7 +146,6 @@
*ngIf="workPackage.assignee"
[principal]="workPackage.assignee"
[hideName]="true"
[hoverCard]="true"
[link]="false"
size="mini"
class="op-wp-single-card--content-assignee"
@@ -7,7 +7,6 @@
*ngIf="item && item.href"
[principal]="item"
[hideName]="true"
[hoverCard]="true"
[hoverCardModalTarget]="isOpenedInModal ? 'custom' : 'default'"
size="mini"
></op-principal>
@@ -26,7 +26,6 @@
<ng-container *ngFor="let principal of usersByRole.users; let last = last">
<op-principal
[principal]="principal"
[hoverCard]="true"
size="mini"
></op-principal>
<ng-container *ngIf="!last">, </ng-container>
@@ -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 { AvatarOptions, AvatarSize, HoverCardOptions, PrincipalRendererService } from './principal-renderer.service';
import { AvatarOptions, AvatarSize, 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,7 +76,7 @@ export class OpPrincipalComponent implements OnInit {
@Input() avatarClasses? = '';
@Input() hoverCard= false;
@Input() hoverCard= true;
@Input() hoverCardUrl= '';
@Input() hoverCardModalTarget:'default'|'custom' = 'default';
@@ -97,19 +97,17 @@ export class OpPrincipalComponent implements OnInit {
ngOnInit() {
if (this.principal.name) {
const hoverCardOptions:HoverCardOptions = {
url: this.hoverCardUrl,
modalTarget: this.hoverCardModalTarget === 'custom'
? PortalOutletTarget.Custom : PortalOutletTarget.Default,
};
const avatarOptions:AvatarOptions = {
hide: this.hideAvatar,
size: this.size,
};
if (this.hoverCard) {
avatarOptions.hoverCard = hoverCardOptions;
avatarOptions.hoverCard = {
url: this.hoverCardUrl,
modalTarget: this.hoverCardModalTarget === 'custom'
? PortalOutletTarget.Custom : PortalOutletTarget.Default,
};
}
this.principalRenderer.render(
+1 -1
View File
@@ -138,7 +138,7 @@ module Redmine::MenuManager::TopMenuHelper
end
def render_user_drop_down(items)
avatar = avatar(User.current, class: "op-top-menu-user-avatar")
avatar = avatar(User.current, class: "op-top-menu-user-avatar", hover_card: { active: false })
render_menu_dropdown_with_items(
label: avatar.presence || "",
label_options: {
+2 -2
View File
@@ -45,7 +45,7 @@ module AvatarHelper
# Returns the avatar image tag for the given +user+ if avatars are enabled
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
def avatar(principal, size: "default", hide_name: true, hover_card: { active: false, target: :default }, name_classes: "", **)
def avatar(principal, size: "default", hide_name: true, hover_card: { active: true, target: :default }, name_classes: "", **)
build_principal_avatar_tag(principal, size:, hide_name:, hover_card:, name_classes:, **)
rescue StandardError => e
Rails.logger.error "Failed to create avatar for #{principal}: #{e}"
@@ -147,7 +147,7 @@ module AvatarHelper
def hover_card_options(user, inputs = {}, tag_options = {})
# 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)
if hover_card.fetch(:active, true)
inputs[:hoverCard] = true
inputs[:hoverCardModalTarget] = hover_card.fetch(:target, :default)
@@ -45,7 +45,7 @@
grid.with_area(:presenter, tag: :div, classes: 'ellipsis') do
flex_layout(align_items: :flex_end) do |flex|
flex.with_column(classes: 'ellipsis custom-presenter-flex') do
render(Users::AvatarComponent.new(user: @meeting_agenda_item.presenter, size: 'mini', title:, classes: 'op-principal_flex', hover_card: { active: true }))
render(Users::AvatarComponent.new(user: @meeting_agenda_item.presenter, size: 'mini', title:, classes: 'op-principal_flex'))
end
end
end
@@ -60,8 +60,7 @@ module Meetings
flex.with_column(classes: "ellipsis") do
render(Users::AvatarComponent.new(user: participant.user,
size: :medium,
classes: "op-principal_flex",
hover_card: { active: true }))
classes: "op-principal_flex"))
end
render_participant_state(participant, flex)
end
@@ -15,7 +15,7 @@
render(Primer::Beta::Text.new(color: :subtle)) { t("label_added_by", author: nil) }
end
authoring.with_column(mr: 1, classes: 'ellipsis') do
render(Users::AvatarComponent.new(user: @meeting_agenda_item.author, size: 'mini', classes: 'op-principal_flex', hover_card: { active: true }))
render(Users::AvatarComponent.new(user: @meeting_agenda_item.author, size: 'mini', classes: 'op-principal_flex'))
end
authoring.with_column do
render(Primer::Beta::RelativeTime.new(color: :subtle, datetime: @meeting_agenda_item.created_at))