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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#55581] hover cards only in project share, not wp share
Tobias Dillmann5d186422589f
diff --git a/app/components/shares/invite_user_form_component.html.erb b/app/components/shares/invite_user_form_component.html.erbindex dea952c59aa..f1bc280c58b 100644--- a/app/components/shares/invite_user_form_component.html.erb+++ b/app/components/shares/invite_user_form_component.html.erb@@ -10,7 +10,7 @@) do |form|grid_layout('invite-user-form', tag: :div) do |invite_form|invite_form.with_area('invitee') do- render(Shares::Invitee.new(form))+ render(Shares::Invitee.new(form, allow_hover_cards:))endinvite_form.with_area('permission') dodiff --git a/app/components/shares/invite_user_form_component.rb b/app/components/shares/invite_user_form_component.rbindex f8d40024bae..07f5559506f 100644--- a/app/components/shares/invite_user_form_component.rb+++ b/app/components/shares/invite_user_form_component.rb@@ -32,14 +32,15 @@ module Sharesinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers- attr_reader :entity, :strategy, :errors+ attr_reader :entity, :strategy, :errors, :allow_hover_cards- def initialize(strategy:, errors: nil)+ def initialize(strategy:, errors: nil, allow_hover_cards: false)super@strategy = strategy@entity = strategy.entity@errors = errors+ @allow_hover_cards = allow_hover_cardsenddef new_sharediff --git a/app/components/shares/manage_shares_component.html.erb b/app/components/shares/manage_shares_component.html.erbindex a584ee90d85..af18bb5f422 100644--- a/app/components/shares/manage_shares_component.html.erb+++ b/app/components/shares/manage_shares_component.html.erb@@ -1,7 +1,7 @@<%=if strategy.manageable?modal_content.with_row do- render(Shares::InviteUserFormComponent.new(strategy:, errors: errors))+ render(Shares::InviteUserFormComponent.new(strategy:, errors:, allow_hover_cards:))endend@@ -100,13 +100,15 @@endelsestrategy.shares.each do |share|- render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box))+ render(Shares::ShareRowComponent.new(share:, strategy:, container: border_box, allow_hover_cards:))endendendend- modal_content.with_row do- helpers.angular_component_tag 'opce-custom-modal-overlay', class: 'op-user-share-modal-overlay'+ if allow_hover_cards+ modal_content.with_row do+ helpers.angular_component_tag 'opce-custom-modal-overlay', class: 'op-user-share-modal-overlay'+ endend%>diff --git a/app/components/shares/manage_shares_component.rb b/app/components/shares/manage_shares_component.rbindex fa61c6afdd5..22246aed01a 100644--- a/app/components/shares/manage_shares_component.rb+++ b/app/components/shares/manage_shares_component.rb@@ -36,6 +36,7 @@ module Sharesattr_reader :strategy,:entity,:errors,+ :allow_hover_cards,:modal_contentdef initialize(strategy:, modal_content:, errors: nil)@@ -45,6 +46,7 @@ module Shares@entity = strategy.entity@errors = errors@modal_content = modal_content+ @allow_hover_cards = strategy.allow_hover_cards?enddef self.wrapper_keydiff --git a/app/components/shares/share_row_component.html.erb b/app/components/shares/share_row_component.html.erbindex 29ba414445d..47c931db3e7 100644--- a/app/components/shares/share_row_component.html.erb+++ b/app/components/shares/share_row_component.html.erb@@ -14,7 +14,7 @@user_row_grid.with_area(:avatar, tag: :div) dorender(Users::AvatarComponent.new(user: principal, show_name: false, size: :medium,- hover_card: { active: true, target: :custom }))+ hover_card: { active: allow_hover_cards, target: :custom }))enduser_row_grid.with_area(:user_details, tag: :div, classes: 'ellipsis') dodiff --git a/app/components/shares/share_row_component.rb b/app/components/shares/share_row_component.rbindex 45df3ab20e0..ae3b9845768 100644--- a/app/components/shares/share_row_component.rb+++ b/app/components/shares/share_row_component.rb@@ -36,7 +36,7 @@ module Sharesinclude OpTurbo::Streamableinclude OpPrimer::ComponentHelpers- def initialize(share:, strategy:, container: nil)+ def initialize(share:, strategy:, container: nil, allow_hover_cards: false)super@share = share@@ -45,6 +45,7 @@ module Shares@principal = share.principal@available_roles = strategy.available_roles@container = container+ @allow_hover_cards = allow_hover_cardsenddef wrapper_uniq_by@@ -53,7 +54,7 @@ module Sharesprivate- attr_reader :share, :entity, :principal, :container, :available_roles, :strategy+ attr_reader :share, :entity, :principal, :container, :available_roles, :strategy, :allow_hover_cardsdef share_editable?@share_editable ||= User.current != share.principal && sharing_manageable?diff --git a/app/forms/shares/invitee.rb b/app/forms/shares/invitee.rbindex 7b373f0c2dc..c60ed79d1c3 100644--- a/app/forms/shares/invitee.rb+++ b/app/forms/shares/invitee.rb@@ -52,14 +52,16 @@ module SharesfocusDirectly: true,appendToComponent: true,disabled: @disabled,- isOpenedInModal: true+ isOpenedInModal: true,+ hoverCards: @allow_hover_cards})end- def initialize(disabled: false)+ def initialize(disabled: false, allow_hover_cards: false)super()@disabled = disabled+ @allow_hover_cards = allow_hover_cardsendendenddiff --git a/app/models/sharing_strategies/base_strategy.rb b/app/models/sharing_strategies/base_strategy.rbindex bff01d94d89..25c00ff2e85 100644--- a/app/models/sharing_strategies/base_strategy.rb+++ b/app/models/sharing_strategies/base_strategy.rb@@ -50,6 +50,10 @@ module SharingStrategiesraise NotImplementedError, "Override in a subclass and return true if the current user can manage sharing"end+ def allow_hover_cards?+ raise NotImplementedError, "Override in a subclass and return true if hover cards should appear hovering users"+ end+def create_contract_classraise NotImplementedError, "Override in a subclass and return the contract class for creating a share"enddiff --git a/app/models/sharing_strategies/project_query_strategy.rb b/app/models/sharing_strategies/project_query_strategy.rbindex eb05b1970d7..7a898438bb6 100644--- a/app/models/sharing_strategies/project_query_strategy.rb+++ b/app/models/sharing_strategies/project_query_strategy.rb@@ -54,6 +54,10 @@ module SharingStrategies@entity.visible?end+ def allow_hover_cards?+ true+ end+def create_contract_classShares::ProjectQueries::CreateContractenddiff --git a/app/models/sharing_strategies/work_package_strategy.rb b/app/models/sharing_strategies/work_package_strategy.rbindex 556767dc08a..018c6b0f5c7 100644--- a/app/models/sharing_strategies/work_package_strategy.rb+++ b/app/models/sharing_strategies/work_package_strategy.rb@@ -53,6 +53,13 @@ module SharingStrategiesuser.allowed_in_project?(:view_shared_work_packages, @entity.project)end+ # Since the work package share dialog is embedded into an angular page, hover cards would compete for the+ # portal outlet when rendering, causing bugs. Until the work package share dialog is refactored to be an+ # async-dialog, we must disable hover cards for it.+ def allow_hover_cards?+ false+ end+def share_description(share) # rubocop:disable Metrics/PerceivedComplexity,Metrics/AbcSizescope = %i[sharing user_details]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.htmlindex 93c0ca81458..e7753cd2dfa 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]="hoverCards"[hoverCardModalTarget]="isOpenedInModal ? 'custom' : 'default'"size="mini"></op-principal>diff --git a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.ts b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.tsindex 66518a14878..8861ebdca3c 100644--- a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.ts+++ b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter-template.component.ts@@ -43,6 +43,7 @@ import { IAutocompleterTemplateComponent } from 'core-app/shared/components/autoexport class UserAutocompleterTemplateComponent implements IAutocompleterTemplateComponent {@Input() public inviteUserToProject:string|undefined;@Input() public isOpenedInModal:boolean = false;+ @Input() public hoverCards:boolean = true;@ViewChild('optionTemplate') optionTemplate:TemplateRef<Element>;@ViewChild('footerTemplate') footerTemplate?:TemplateRef<Element>;diff --git a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter.component.ts b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter.component.tsindex 3de589bdec4..c7188cb09cf 100644--- a/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter.component.ts+++ b/frontend/src/app/shared/components/autocompleter/user-autocompleter/user-autocompleter.component.ts@@ -88,6 +88,7 @@ export class UserAutocompleterComponent extends OpAutocompleterComponent<IUserAu@Input() public inviteUserToProject:string|undefined;@Input() public isOpenedInModal:boolean = false;+ @Input() public hoverCards:boolean = true;@Input() public url:string = this.apiV3Service.users.path;@@ -103,6 +104,7 @@ export class UserAutocompleterComponent extends OpAutocompleterComponent<IUserAuthis.applyTemplates(UserAutocompleterTemplateComponent, {inviteUserToProject: this.inviteUserToProject,isOpenedInModal: this.isOpenedInModal,+ hoverCards: this.hoverCards,});this