Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into 53810-update-pageheade…
Browse files Browse the repository at this point in the history
…rs-subheaders-in-the-rails-project-pages
  • Loading branch information
HDinger committed Dec 5, 2024
2 parents cd1e321 + 55ab280 commit 381951f
Show file tree
Hide file tree
Showing 464 changed files with 12,911 additions and 1,853 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ gem "paper_trail", "~> 15.2.0"

gem "op-clamav-client", "~> 3.4", require: "clamav"

# Recurring meeting events definition
gem "ice_cube", "~> 0.17.0"

group :production do
# we use dalli as standard memcache client
# requires memcached 1.4+
Expand Down
13 changes: 7 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ GEM
awesome_nested_set (3.8.0)
activerecord (>= 4.0.0, < 8.1)
aws-eventstream (1.3.0)
aws-partitions (1.1015.0)
aws-partitions (1.1017.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
Expand All @@ -353,7 +353,7 @@ GEM
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.175.0)
aws-sdk-s3 (1.176.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -681,7 +681,7 @@ GEM
reline (>= 0.4.2)
iso8601 (0.13.0)
jmespath (1.6.2)
json (2.8.2)
json (2.9.0)
json-jwt (1.16.7)
activesupport (>= 4.2)
aes_key_wrap
Expand Down Expand Up @@ -1013,14 +1013,14 @@ GEM
rspec-support (3.13.1)
rspec-wait (1.0.1)
rspec (>= 3.4)
rubocop (1.69.0)
rubocop (1.69.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.36.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.2)
Expand Down Expand Up @@ -1270,6 +1270,7 @@ DEPENDENCIES
httpx
i18n-js (~> 4.2.3)
i18n-tasks (~> 1.0.13)
ice_cube (~> 0.17.0)
json_schemer (~> 2.3.0)
json_spec (~> 1.1.4)
ladle
Expand Down
Binary file modified app/assets/images/lookbook/hover_card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/lookbook/user_hover_card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
@import "op_primer/border_box_table_component"
@import "work_packages/exports/modal_dialog_component"
@import "work_package_relations_tab/index_component"
@import "users/hover_card_component"
4 changes: 2 additions & 2 deletions app/components/op_primer/border_box_table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class << self
#
# This results in the description columns to be hidden on mobile
def mobile_columns(*names)
return @mobile_columns || columns if names.empty?
return Array(@mobile_columns || columns) if names.empty?

@mobile_columns = names.map(&:to_sym)
end
Expand All @@ -54,7 +54,7 @@ def mobile_columns(*names)
#
# This results in the description columns to be hidden on mobile
def mobile_labels(*names)
return @mobile_labels if names.empty?
return Array(@mobile_labels) if names.empty?

@mobile_labels = names.map(&:to_sym)
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/shares/invite_user_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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:))
end

invite_form.with_area('permission') do
Expand Down
5 changes: 3 additions & 2 deletions app/components/shares/invite_user_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ class InviteUserFormComponent < ApplicationComponent # rubocop:disable OpenProje
include OpTurbo::Streamable
include 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_cards
end

def new_share
Expand Down
9 changes: 7 additions & 2 deletions app/components/shares/manage_shares_component.html.erb
Original file line number Diff line number Diff line change
@@ -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:))
end
end

Expand Down Expand Up @@ -100,10 +100,15 @@
end
else
strategy.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:))
end
end
end
end

if allow_hover_cards
modal_content.with_row do
helpers.angular_component_tag 'opce-custom-modal-overlay', class: 'op-user-share-modal-overlay'
end
end
%>
2 changes: 2 additions & 0 deletions app/components/shares/manage_shares_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ManageSharesComponent < ApplicationComponent # rubocop:disable OpenProject
attr_reader :strategy,
:entity,
:errors,
:allow_hover_cards,
:modal_content

def initialize(strategy:, modal_content:, errors: nil)
Expand All @@ -45,6 +46,7 @@ def initialize(strategy:, modal_content:, errors: nil)
@entity = strategy.entity
@errors = errors
@modal_content = modal_content
@allow_hover_cards = strategy.allow_hover_cards?
end

def self.wrapper_key
Expand Down
3 changes: 2 additions & 1 deletion app/components/shares/share_row_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
end

user_row_grid.with_area(:avatar, tag: :div) do
render(Users::AvatarComponent.new(user: principal, show_name: false, size: :medium))
render(Users::AvatarComponent.new(user: principal, show_name: false, size: :medium,
hover_card: { active: allow_hover_cards, target: :custom }))
end

user_row_grid.with_area(:user_details, tag: :div, classes: 'ellipsis') do
Expand Down
5 changes: 3 additions & 2 deletions app/components/shares/share_row_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ShareRowComponent < ApplicationComponent # rubocop:disable OpenProject/Add
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

def initialize(share:, strategy:, container: nil)
def initialize(share:, strategy:, container: nil, allow_hover_cards: false)
super

@share = share
Expand All @@ -45,6 +45,7 @@ def initialize(share:, strategy:, container: nil)
@principal = share.principal
@available_roles = strategy.available_roles
@container = container
@allow_hover_cards = allow_hover_cards
end

def wrapper_uniq_by
Expand All @@ -53,7 +54,7 @@ def wrapper_uniq_by

private

attr_reader :share, :entity, :principal, :container, :available_roles, :strategy
attr_reader :share, :entity, :principal, :container, :available_roles, :strategy, :allow_hover_cards

def share_editable?
@share_editable ||= User.current != share.principal && sharing_manageable?
Expand Down
15 changes: 11 additions & 4 deletions app/components/users/avatar_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ class AvatarComponent < ApplicationComponent
include AvatarHelper
include OpPrimer::ComponentHelpers

def initialize(user:, show_name: true, link: true, size: "default", classes: "", title: nil, name_classes: "")
def initialize(user:, show_name: true, link: true, size: "default", classes: "", title: nil, name_classes: "",
hover_card: { active: true, target: :default })
super

@user = user
@show_name = show_name
@link = link
@size = size
@title = title
@hover_card = hover_card
@classes = classes
@name_classes = name_classes
end
Expand All @@ -49,14 +51,19 @@ def render?
end

def call
helpers.avatar(
@user,
options = {
size: @size,
link: @link,
hide_name: !@show_name,
title: @title,
class: @classes,
name_classes: @name_classes
name_classes: @name_classes,
hover_card: @hover_card
}

helpers.avatar(
@user,
**options
)
end
end
Expand Down
86 changes: 86 additions & 0 deletions app/components/users/hover_card_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>

<%=
if @user.present?
flex_layout(classes: 'op-user-hover-card', data: { test_selector: "user-hover-card-#{@user.id}" }) do |flex|
flex.with_row do
render(Users::AvatarComponent.new(user: @user, show_name: false, link: false, hover_card: { active: false }))
end

flex.with_row do
flex_layout(classes: 'op-user-hover-card--info') do |f|
f.with_column(classes: 'op-user-hover-card--name') do
render(Primer::Beta::Text.new(font_weight: :semibold, data: { test_selector: 'user-hover-card-name' })) do
@user.name
end
end

if show_email?
f.with_column(classes: 'op-user-hover-card--email') do
render(Primer::Beta::Text.new(font_size: :small,
color: :muted,
data: { test_selector: 'user-hover-card-email' })) do
@user.mail
end
end
end
end
end

flex.with_row do
flex_layout(classes: 'op-user-hover-card--group-list') do |f|
f.with_column do
render(Primer::Beta::Octicon.new(icon: :people))
end

f.with_column do
render(Primer::Beta::Text.new(color: :muted, data: { test_selector: 'user-hover-card-groups' })) do
group_membership_summary
end
end
end
end

flex.with_row do
render(Primer::Beta::Button.new(tag: :a,
href: helpers.allowed_management_user_profile_path(@user),
data: { test_selector: 'user-hover-card-profile-btn' })) do
I18n.t("users.open_profile")
end
end
end
else
render Primer::Beta::Blankslate.new(border: false, narrow: true) do |component|
component.with_visual_icon(icon: "x-circle")
# Show a generic error message to avoid leaking information
component.with_heading(tag: :h3).with_content(I18n.t("http.response.unexpected"))
end
end
%>
Loading

0 comments on commit 381951f

Please sign in to comment.