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

Change to icons and other feedback

Oliver Güntherd0cb202d58b3
diff --git a/app/components/users/profile/attributes_component.html.erb b/app/components/users/profile/attributes_component.html.erb
index 7ea20ddc5dc..c5440e83a35 100644
--- a/app/components/users/profile/attributes_component.html.erb
+++ b/app/components/users/profile/attributes_component.html.erb
@@ -7,12 +7,15 @@
render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_information) }
end
- if User.current.admin?
+ if User.current.admin? || User.current == @user
heading.with_column do
- render(Primer::Beta::Link.new(
- href: edit_user_path(@user),
- scheme: :secondary
- )) { t(:label_manage) }
+ render(Primer::Beta::IconButton.new(
+ icon: :gear,
+ scheme: :invisible,
+ tag: :a,
+ "aria-label": t(:label_manage),
+ href: User.current == @user? my_account_path : edit_user_path(@user)
+ ))
end
end
end
diff --git a/app/components/users/profile/attributes_component.rb b/app/components/users/profile/attributes_component.rb
index 74cec513682..cc065a81b3f 100644
--- a/app/components/users/profile/attributes_component.rb
+++ b/app/components/users/profile/attributes_component.rb
@@ -40,10 +40,6 @@ module Users
end
def render?
- visible_user_information?
- end
-
- def visible_user_information?
@user.pref.can_expose_mail? || @user.visible_custom_field_values.any? { _1.value.present? }
end
diff --git a/app/components/users/profile/groups_component.html.erb b/app/components/users/profile/groups_component.html.erb
index 9ed5e58f13e..617e88fe3ef 100644
--- a/app/components/users/profile/groups_component.html.erb
+++ b/app/components/users/profile/groups_component.html.erb
@@ -4,15 +4,26 @@
details_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
heading.with_column(flex: 1) do
- render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_group_plural) }
+ flex_layout(align_items: :center) do |title|
+ title.with_column(mr: 2) do
+ render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_group_plural) }
+ end
+
+ title.with_column do
+ render(Primer::Beta::Counter.new(count: @groups.count, scheme: :primary))
+ end
+ end
end
if User.current.admin?
heading.with_column do
- render(Primer::Beta::Link.new(
- href: edit_user_path(@user, tab: :groups),
- scheme: :secondary
- )) { t(:label_manage) }
+ render(Primer::Beta::IconButton.new(
+ icon: :gear,
+ scheme: :invisible,
+ tag: :a,
+ "aria-label": t(:label_manage),
+ href: edit_user_path(@user, tab: :groups)
+ ))
end
end
end
diff --git a/app/components/users/profile/projects_component.html.erb b/app/components/users/profile/projects_component.html.erb
index 6bdea540b9d..62903bc350e 100644
--- a/app/components/users/profile/projects_component.html.erb
+++ b/app/components/users/profile/projects_component.html.erb
@@ -4,15 +4,26 @@
details_container.with_row do
flex_layout(align_items: :center, justify_content: :space_between) do |heading|
heading.with_column(flex: 1) do
- render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_project_plural) }
+ flex_layout(align_items: :center) do |title|
+ title.with_column(mr: 2) do
+ render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_project_plural) }
+ end
+
+ title.with_column do
+ render(Primer::Beta::Counter.new(count: @memberships.count, scheme: :primary))
+ end
+ end
end
if User.current.admin?
heading.with_column do
- render(Primer::Beta::Link.new(
- href: edit_user_path(@user, tab: :memberships),
- scheme: :secondary
- )) { t(:label_manage) }
+ render(Primer::Beta::IconButton.new(
+ icon: :gear,
+ scheme: :invisible,
+ tag: :a,
+ "aria-label": t(:label_manage),
+ href: edit_user_path(@user, tab: :memberships)
+ ))
end
end
end
diff --git a/spec/components/users/profile/attributes_component_spec.rb b/spec/components/users/profile/attributes_component_spec.rb
index 6d582df8593..d6b217d6345 100644
--- a/spec/components/users/profile/attributes_component_spec.rb
+++ b/spec/components/users/profile/attributes_component_spec.rb
@@ -33,8 +33,8 @@ require "rails_helper"
RSpec.describe Users::Profile::AttributesComponent, type: :component do
let(:component) { described_class.new(user:) }
- describe "visible_user_information?" do
- subject { component.visible_user_information? }
+ describe "render?" do
+ subject { component.render? }
context "when user has hide_mail = false in their preferences" do
let(:user) { build(:user, preferences: { hide_mail: false }) }